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
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) |
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
#!/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 |
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
# Create a new user/role | |
$ createuser -P abhiomkar | |
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
# 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 |
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
# 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 |
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
// @ 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'); |
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
"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 |
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
-- show tables | |
\dt | |
-- create a new database | |
# CREATE DATABASE mydb; | |
-- create user | |
# CREATE USER abhinay with password 'secret'; |
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
rsync --partial --progress --rsh=ssh user@hostname:/path/to/file /local/destination/path |
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
## 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) |