Skip to content

Instantly share code, notes, and snippets.

View abhiomkar's full-sized avatar

Abhinay Omkar abhiomkar

View GitHub Profile
@abhiomkar
abhiomkar / getopt.py
Created August 30, 2012 10:50
Python Script Input
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 ""
@abhiomkar
abhiomkar / thehindu.py
Created April 30, 2013 09:52
The Hindu Quick Scraper
#!/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 = []
@abhiomkar
abhiomkar / zip-tar-cheatsheet.sh
Last active January 2, 2018 23:35
zip tar cheatsheet
# 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
@abhiomkar
abhiomkar / most_used_cmds.sh
Created May 22, 2013 10:59
Most used commands in ZSH
# 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
@abhiomkar
abhiomkar / play-when-coding.txt
Created July 1, 2013 08:08
Programmer's Background Score
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
@abhiomkar
abhiomkar / window_location_param.js
Created July 16, 2013 07:12
read query parameter values from current URL in JavaScript
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;
@abhiomkar
abhiomkar / python_logging.py
Last active December 30, 2020 21:10
Python Logging Cheatsheet
import logging
# prints log to stdout and also saves to specified log file
logger = logging.getLogger('my_logfile')
fh = logging.FileHandler('my_logfile.log')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
ch = logging.StreamHandler()
ch.setFormatter(formatter)
logger.addHandler(fh)

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@abhiomkar
abhiomkar / facebook.com_stylebot.css
Created April 10, 2014 07:13
Stylebot CSS for New Design of Facebook
/*
url: facebook.com
*/
body, #contentCol, .fbTimelineScrubber {
background: #fff;
}
.fbChatSidebar {
display: none ;
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<polymer-element name="my-element">
<template>
<style>
:host {