Skip to content

Instantly share code, notes, and snippets.

View ashwin's full-sized avatar

Ashwin Nanjappa ashwin

View GitHub Profile
@ashwin
ashwin / nvidia_panic_crash.txt
Created March 30, 2015 12:37
Comparison of syslog of NVIDIA kernel panic and without panic
rsyslogd: [origin software="rsyslogd" swVersion="7.4.4" x-pid="817" x-info="http://www.rsyslog.com"] start
rsyslogd: rsyslogd's groupid changed to 104
rsyslogd: rsyslogd's userid changed to 101
kernel: Initializing cgroup subsys cpuset
kernel: Initializing cgroup subsys cpu
kernel: Initializing cgroup subsys cpuacct
kernel: Linux version 3.13.0-44-generic (buildd@lamiak) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 (Ubuntu 3.13.0-44.73-generic 3.13.11-ckt12)
kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-3.13.0-44-generic root=UUID=946c230f-28fc-4512-874e-14a400c778a8 ro quiet splash
kernel: KERNEL supported cpus:
kernel: Intel GenuineIntel
@ashwin
ashwin / default_errorformat.vim
Created March 24, 2015 09:26
Default value of errorformat in Vim
%*[^"]"%f"%*\D%l: %m
"%f"%*\D%l: %m
%-G%f:%l: (Each undeclared identifier is reported only once
%-G%f:%l: for each function it appears in.)
%-GIn file included from %f:%l:%c:
%-GIn file included from %f:%l:%c\,
%-GIn file included from %f:%l:%c
%-GIn file included from %f:%l
%-G%*[ ]from %f:%l:%c
%-G%*[ ]from %f:%l:
@ashwin
ashwin / guifont.vim
Created March 11, 2015 09:53
How to set font in GVim
" This works on Windows, but is ineffective on Linux
set guifont="Ubuntu Mono 10"
" This works on Linux
set guifont=Ubuntu\ Mono\ 10
@ashwin
ashwin / checkstyle.xml
Created February 19, 2015 12:11
CheckStyle configuration file for Algorithms book and course by Prof. Sedgewick
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<!-- Checks that property files contain the same keys. -->
@ashwin
ashwin / config.py
Created February 18, 2015 04:27
Read values from INI file using ConfigParser
#!/usr/bin/env python
"""
This module provides methods to read values from a INI file.
"""
import ConfigParser
class Config(object):
@ashwin
ashwin / google_style_guide.py
Created February 15, 2015 06:38
Example of Google Python Style Guide
#!/usr/bin/env python
"""
Illustration of Google Python Style Guide:
https://google-styleguide.googlecode.com/svn/trunk/pyguide.html
This module provides a class to play TicTacToe game.
"""
__author__ = "Gamer Dude"
@ashwin
ashwin / replace_full_word.vim
Created February 12, 2015 10:17
How to search and replace full word in Vim
:%s/\<foo\>/abracadabra/
@ashwin
ashwin / getopt_long_example.cpp
Last active April 5, 2023 21:42
How to parse options in C++ using getopt_long
#include <getopt.h>
#include <iostream>
int num = -1;
bool is_beep = false;
float sigma = 2.034;
std::string write_file = "default_file.txt";
void PrintHelp()
{
@ashwin
ashwin / lock_guard_queue.cpp
Created January 14, 2015 01:53
Example of using lock_guard to control concurrent access to a queue
#include <mutex>
#include <queue>
std::queue<int> q; // Queue which multiple threads might add/remove from
std::mutex m; // Mutex to protect this queue
void AddToQueue(int i)
{
std::lock_guard<std::mutex> lg(m); // Lock will be held from here to end of function
q.push(i);
@ashwin
ashwin / mutex_queue.cpp
Created January 14, 2015 01:44
Example of using mutex to control concurrent access to a queue
#include <mutex>
#include <queue>
std::queue<int> q; // Queue which multiple threads might add/remove from
std::mutex m; // Mutex to protect this queue
void AddToQueue(int i)
{
m.lock();
q.push(i);