Skip to content

Instantly share code, notes, and snippets.

View elprup's full-sized avatar

elprup elprup

View GitHub Profile
@elprup
elprup / channel.py
Created April 5, 2012 06:43
Simple async callback using tornado and redis
'''
Simple async callback using tornado and redis
example:
from channel import *
import tornado.ioloop
import functools
def callback(x, prefix=''):
print prefix+str(x)
@elprup
elprup / sendemail.py
Created July 30, 2012 09:56
send email with attachments in Python
'''
email send service library. Using SMTP.
author: yaowei
last modify: 2012-07-30
'''
import datetime
import logging
import os
@elprup
elprup / loganalyze.py
Created August 27, 2012 05:19
hadoop log viewer in Python
import re
mode = r'([A-Z_]*)="([^"]+)"'
vmode = r'\(([^)]+)\)\(([^)]+)\)\(([^)]+)\)'
filename = 's3.txt'
f = open(filename,'r')
lines = f.readlines()
jobinfo = lines[-1]
info = []
for k,v in re.findall(mode, jobinfo):
for kk1, kk2, vv in re.findall(vmode, v):
@elprup
elprup / syncuser.py
Created September 13, 2012 02:23
syncuser command from svn to reviewboard
#!/usr/bin/python
'''
sync user from svn to review board
sample usage:
syncuser.py -c root:password@localhost:rbdatabase --update /var/svn/passwd
'''
import datetime
import getopt
import MySQLdb as mdb
import re
@elprup
elprup / s3lzocp.py
Created October 12, 2012 09:34
sync scribe file from local to amazon s3 (with lzo compress)
#!/usr/bin/python
'''
s3lzocp
Version 0.2 2012-10-22
sync log from local to s3 and lzo it.
make sure lzop and s3cmd is installed.
usage:
s3lzocp.py /path/to/dir s3://bucket-name/path/to/dir
'''
import re
@elprup
elprup / s3load.py
Created October 31, 2012 06:13
copy plain log to category log in s3 system
#!/usr/bin/python
'''
s3load
Version 0.2 2012-11-09
copy plain log to category log in s3 system
usage:
s3load.py source destination
'''
import re
import os
@elprup
elprup / scribe_lucid_install.sh
Last active February 15, 2017 09:09
install facebook/scribe in ubuntu lucid 10.04 script
#!/bin/bash
sudo apt-get update
sudo apt-get install libboost-all-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev git-core make
wget http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz
tar xzvf thrift-0.9.0.tar.gz
cd thrift-0.9.0
@elprup
elprup / mysqlsvn.py
Created November 27, 2012 08:00
MySQL tables svn-like sync between server
#!/bin/python
'''
MySQL tables svn-like sync between server
@ through ssh connect
@ incremental sync
@ can retry and redo
@ svn-style mode
@ timeout
version 1.2
modified 2012-12-11
@elprup
elprup / mpbot.py
Created January 16, 2013 01:57
non-blocking gtalk bot using multiple process
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# non-blocking gtalk bot using multiple process
#
import sys
import time
from multiprocessing import Pool

Going from GUI Git to Command Line Git

Preface

First of all, the ladies love command line. You are guaranteed to pick up twice as many chicks because you are in a completely black application window with monospace font. That's dark. Like, Sabbath dark.

Seriously though...

It's a piece of cake. And you don't need to abandon the GUI. Sometimes it's nice to see what's going on, so don't feel like a jabroni if you hit up something like Tower or Github for Mac.

Let's Git (see what I did there?) Started...

First of all, setup Git so all your diffs are in color. As suggested by Erik Reagan, this helped me a ton. Just run git config --global color.ui true in your command line and you'll be set.