Skip to content

Instantly share code, notes, and snippets.

View leewin12's full-sized avatar

greg.lee leewin12

View GitHub Profile
@whitekid
whitekid / aes.py
Created May 30, 2013 13:54
MySQL aes_encrypt compatible encrypt/decrypt function
def aes_encrypt(data, key):
"""MySQL aes_encrypt compatible encrypt function"""
import mcrypt
import binascii
m = mcrypt.MCRYPT('rijndael-128', 'ecb')
m.init(key)
# MySQL은 여기다 padding을 붙여서 진행하니까...
@johanmeiring
johanmeiring / gist:3002458
Created June 27, 2012 08:32
"git lg" alias for pretty git log
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
@gfrison
gfrison / groovy-date-time-operations
Created February 5, 2011 15:00
How to add months, days, years to a date in Groovy
Groovy also has a Time Category class which gives you DSL style syntax for manipulating dates. Here is an example:
import org.codehaus.groovy.runtime.TimeCategory
now = new Date()
println now
use(TimeCategory) {
footballPractice = now + 1.week - 4.days + 2.hours - 3.seconds
}
println footballPractice
which will produce output like this: