This file contains 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
window.location.param = function(key) { | |
var value; | |
window.location.search.slice(1).split('&').map(function(e) { | |
e = decodeURIComponent(e); | |
if (e.indexOf(key + '=') === 0) { | |
value = e.slice(key.length + 1); | |
return false; | |
} | |
}); | |
return value; |
This file contains 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
World War Z - Isolated System by Muse | |
Inception - Time by Hans Zimmer | |
Man of Steel - Ideal of Hope by Hans Zimmer | |
X-Men: First Class - First Class by Henry Jackman | |
Bourne Ultimatum - Extreme Ways by Mobi | |
Tron: Legacy - The Son of Flynn by Daft Punk | |
Tron: Legacy - Flynn Lives by Daft Punk |
This file contains 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
# Top 20 most used commands in your ZSH shell | |
cat ~/.zsh_history | cut -d ';' -f 2- | awk {'print $1'} | sort | uniq -c | sort -r | head -20 |
This file contains 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
# Compress file | |
zip compressed.zip file_name.txt | |
# Compress Folder | |
zip -r compressed.zip folder_name/ | |
# Uncompress zipped file to current directory | |
unzip compressed.zip | |
# Uncompress zipped to current directory to specific location |
This file contains 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/python | |
# Abhinay Omkar | |
from urllib2 import urlopen | |
import simplejson as json | |
from lxml import etree | |
root = etree.fromstring(urlopen("http://www.thehindu.com/?service=rss").read()) | |
items = root[0].findall('item') | |
output = [] |
This file contains 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 usage(): | |
""" Script Usage """ | |
print "Usage: python main.py OPTIONS INPUT_FILE [OUTPUT_FILE] " | |
print "OPTIONS:" | |
print " --help, --usage, -h: Show this help message" | |
print " --meta=, -m: Meta File" | |
print "ARGS:" | |
print " INPUT_FILE: input file name or path" | |
print " OUTPUT_FILE: output file path" | |
print "" |
This file contains 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
# Benchmark - ngnix vs Cherokee | |
# Django + Cherokee | |
127.0.0.1 ➜ ~ httperf --client=0/1 --server=abhiomkar.in --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=10 --num-calls=10 | |
httperf --client=0/1 --server=abhiomkar.in --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=10 --num-calls=10 | |
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE | |
Maximum connect burst length: 1 | |
Total: connections 10 requests 100 replies 100 test-duration 70.575 s |
This file contains 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
# One Liner to get Network Data Received in GB | |
echo "`netstat -bi | grep -v Ibytes | grep -v "-" | grep "^en" | awk '{ x += $7 } END { print x / (1024 * 1024 * 1024) }'` + `netstat -bi | grep -v Ibytes | grep -v "-" | grep "^lo" | awk '{ x += $6 } END { print x / (1024 * 1024 * 1024) }'`" | bc |
This file contains 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
# Resize Image | |
find . -maxdepth 1 -iname '*jpg' -exec convert -resize 800x500\> -quality 85 {} low/{} \; |
This file contains 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 is_prime(x): | |
""" Return True if 'x' is prime number, otherwise, return False """ | |
# positive numbers | |
x = abs(int(x)) | |
# 0, 1 are not prime | |
if x < 2: | |
return False |