This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[paths] | |
default = ssh://[email protected]/somerepo | |
github = git+ssh://[email protected]:bngsudheer/somerepo | |
[ui] | |
username = sudheer | |
[merge-tools] | |
mymergetool.something = meld |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set shiftwidth=4 | |
set tabstop=4 | |
set expandtab | |
set autoindent | |
" The default yellow for Search highlight sucks | |
hi Search ctermbg=Grey | |
hi Visual ctermbg=Grey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def my_decorator(f): | |
@wraps(f) | |
def wrapper(*args, **kwargs): | |
print 'Calling decorated function' | |
print "args in wrapper(): " | |
print args | |
print "kwargs in wrapper()" | |
print kwargs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set shiftwidth=4 | |
set tabstop=4 | |
set expandtab | |
set autoindent | |
map mS i<CR><ESC> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import ConfigParser | |
from email.MIMEText import MIMEText | |
from smtplib import SMTP | |
import sys | |
parser = argparse.ArgumentParser() | |
parser.add_argument("subject") | |
parser.add_argument("recipient") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_necessary_decimals(number): | |
if number%1: | |
number = "{0}".format(str(round(number,1))) | |
else: | |
number = int(number) | |
return number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
f="$1" | |
ffmpeg -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(0, 8): | |
print "{0:03b} = {1}".format(i, i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Encrpyt the string 'abcdefghijklmnop' | |
from Crypto.Cipher import DES | |
from Crypto import Random | |
iv = Random.get_random_bytes(8) | |
des1 = DES.new('issecret', DES.MODE_CFB, iv) | |
text = 'abcdefghijklmnop' | |
cipher_text = des1.encrypt(text) | |
print cipher_text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
# Usage is | |
# ./apache-data-transfer-day-report.awk -v date=20/Oct/2011 /path/to/access/log | |
# Typically, you have an access log file for a domain | |
# This has been tested only on CentOS 6. | |
# Fork or ask for a feature or bug fix. | |
# | |
BEGIN { | |
datepart = date | |
printf ("\nData transfer for the domain for %s:\n", datepart); |