Skip to content

Instantly share code, notes, and snippets.

View yeban's full-sized avatar

Anurag Priyam yeban

View GitHub Profile
@yeban
yeban / .tmux.conf
Created February 28, 2012 11:22
Tmux configuration
# use ` for prefix
set -g prefix `
# number windows from 1
set -g base-index 1
# highlight the active window
setw -g window-status-current-bg colour0
set -g set-titles on
@yeban
yeban / xorg.conf
Created June 20, 2010 20:37
My xorg.conf with tapping enabled on dell inspiron 1525 running debian.
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "touchpad" "AlwaysCore"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
require "rubygems"
require "xml"
#add a list of namespaces to the node
#the namespaces formal parameter is a hash
#with "prefix" and "prefix_uri" as
#key, value pairs
#prefix for the default namespace is "default"
def add_namespaces( node, namespaces )
#pass nil as the prefix to create a default node
@yeban
yeban / output
Created May 18, 2010 00:11
Output of parsing samples.xml
Node # 1
Name: nex:nexml
Prefix: nex
Local: nexml
Depth: 0
Attribute # 1
Name: xmlns:xsi
Prefix: xmlns
Local: xsi
Depth: 1
@yeban
yeban / reader.rb
Created May 18, 2010 00:06
Simple demo script for ruby libxml's reader api.
require "rubygems"
require "xml"
#parse the sample.xml ignoring whitespaces and
#performing entity substitution.
doc = XML::Reader.file("sample.xml", :options => XML::Parser::Options::NOBLANKS |
XML::Parser::Options::NOENT
)
#display a node's name: local and prefix
@yeban
yeban / sample.xml
Created May 17, 2010 23:59
A sample xml file to demonstrate ruby libxml's reader api.
<?xml version="1.0" encoding="ISO-8859-1"?>
<nex:nexml
version="0.8"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/1.0 ../xsd/nexml.xsd"
xmlns:nex="http://www.nexml.org/1.0"
generator="mesquite"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.nexml.org/1.0">
<otus
@yeban
yeban / fonts.conf
Created May 16, 2010 16:47
.fonts.conf file for rendering fonts beautifully (like Ubuntu). Tested on a Debian box.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
<edit mode="assign" name="autohint" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="rgba" >
/*
* =====================================================================================
*
* Filename: threads.c
*
* Description: Familiarising with pthreads.
*
* Version: 1.0
* Created: Thursday 11 March 2010 01:25:12 IST
* Revision: none
@yeban
yeban / xmonad.diff
Created February 22, 2010 11:46
A diff of my xmonad.hs with the default one
15a16,21
> import XMonad.Hooks.ManageDocks
> import XMonad.Hooks.EwmhDesktops
>
> import XMonad.Layout.Maximize
>
>
19c25
< myTerminal = "xterm"
---
IplImage* dilate( const IplImage* src, const IplImage* kernel){
//create a destination image with the same parametrs as the source image
IplImage* dst = cvCreateImage(cvSize(src->height, src->width), IPL_DEPTH_8U, 1);
vector<uchar> pix_values; //to store all the pixels that are covered
int i, j;
//loop over each row
for( int row = 0; row < src->height; row++ ){