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
| #!/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
| 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 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
| 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
| 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 | |
| " 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
| [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
| # You can nicely pass the dictionary items as keyword arguments | |
| def my_function(a, b, c): | |
| print a, b, c | |
| # Pass keyword arguments | |
| my_function(a=10, b=20, c=30) | |
| args_dict = {'a': 100, 'b': 200, 'c':300} | |
| # Pass keyword arguments using a dictionary | |
| # The dictionary keys map to names of the keyword arguments |
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
| #!/bin/bash | |
| # Find process that tries to establish outbound SSH connections | |
| for (( ; ; )) | |
| do | |
| sleep 1 | |
| lsof -i tcp:22 -P -R | |
| if [ $? -eq 0 ]; then | |
| echo 'found something. See above for details' | |
| exit | |
| else |