Skip to content

Instantly share code, notes, and snippets.

View abhiomkar's full-sized avatar

Abhinay Omkar abhiomkar

View GitHub Profile
@abhiomkar
abhiomkar / parseMobileNumbers.py
Created March 24, 2011 19:43
Parse Mobile Numbers (10 Digits) from Text File. PS: Regex is very lame in this code.
import re
db_txt = open('~/Downloads/phone_database.txt').read()
ph_str = '\r\n'.join(re.findall('\d{10}', db_txt)
open('/tmp/ph_numbers.txt', 'w').write(ph_str)
#!/bin/bash
# Runs Clojure using the classpath specified in the `.clojure` file of the
# current directory.
#
# Mark Reid <http://mark.reid.name>
# CREATED: 2009-03-29
JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java
CLJ_DIR=$HOME/Library/Clojure/lib
CLOJURE=$CLJ_DIR/clojure.jar
CONTRIB=$CLJ_DIR/clojure-contrib.jar
@abhiomkar
abhiomkar / postgresql_starters.sh
Created June 13, 2011 20:26
PostgreSQL Starter Lines
# Create a new user/role
$ createuser -P abhiomkar
@abhiomkar
abhiomkar / mysql_backup_restore.sh
Created June 15, 2011 09:00
MySQL Backup/Restore Script
# Backup using MySQL Dump
mysqldump --user=root --password=very_strong_password --database mydb > ~/backups/mydb_backup_$(date '+%F_%H%M%S').sql
# Restore
mysql --verbose --user=root --password=very_strong_password mydb < ~/backups/mydb_backup_2011-06-15_085322.sql
@abhiomkar
abhiomkar / ssh_keygen.sh
Created June 16, 2011 10:47
SSH Snippets
# SSH Keygen - Protocol 2
ssh-keygen -t rsa -b 2048 -C "username macbook/YYYY-MM-DD" -f ~/.ssh/id_rsa
# Reuse the existing ssh connection
# add these 3 lines to ~/.ssh/config
host *
controlmaster auto
controlpath /tmp/ssh-%r@%h:%p
// @ Abhinay Omkar
// In Javascript Console at Bombay Production Page while any song is running
var loop = 0,
songs_list = [],
StopThis = function() { clearInterval(loop) };
loop = setInterval(
function() {
prev_song_link = '';
song_direct_link = $("#jquery_jplayer audio").attr('src');
@abhiomkar
abhiomkar / wtf_code_quotations.txt
Created June 20, 2011 05:16
WTF Code Quotations
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." --Martin Golding
"Programming is like sex: one mistake and you’re providing support for a lifetime." --Michael Sinz
"The trouble with programmers is that you can never tell what a programmer is doing until it’s too late." --Seymour Cray
"Good code is its own best documentation." --Steve McConnell
"Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves." --Alan Kay
@abhiomkar
abhiomkar / postgresl_hints.sql
Created June 24, 2011 20:19 — forked from luisuribe/Postgresl hints
Postgresql snippets
-- show tables
\dt
-- create a new database
# CREATE DATABASE mydb;
-- create user
# CREATE USER abhinay with password 'secret';
@abhiomkar
abhiomkar / rsync_copy.sh
Created June 25, 2011 18:17
Rsync - Copy files from remote server with Resume Feature
rsync --partial --progress --rsh=ssh user@hostname:/path/to/file /local/destination/path
@abhiomkar
abhiomkar / git.sh
Created June 29, 2011 10:51
Git Cheat-sheet
## GIT Colors ON
git config color.branch auto
git config color.diff auto
git config color.interactive auto
git config color.status auto
## GIT Default Editor
git config --global core.editor vim
## Undo the Push (Revert the changes on Remote)