Skip to content

Instantly share code, notes, and snippets.

View dcai's full-sized avatar
🥃
need a drink

dcai

🥃
need a drink
View GitHub Profile
@dcai
dcai / id_rsa.pub
Last active August 29, 2015 14:06
id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxH+9GYhS8qlhTcdlJuWkS38IKHbVuxsbcFHKSOaI9IbauvEkTfcR9DaAZrhFLDeDifSi9cy6IpzjZL30n1MkV9tN6i2TJ/OvhZPaJtNpKTFNyTLo/jY/NxRle/24LjSm4BnMmb1iijDpL91mi/EjkeccwO8LnWm/wMoRTJKimQSWTknhGmewDMRLXsmaCHOofQRLyOow0+xBGVjlDrO3Qp3r/CgD27ZgkkR/o/b52kxp8/N7EBCknV8Ytrw72IPlVZtlsjOBdkL5taXmhdBhOARBl1fWzUmm89ikITlwctpohDocnj/Qe/hYmh6p/gbgl/av5TwBfbx5KTsbKnTmNQ==
@dcai
dcai / mount_smb.sh
Last active August 29, 2015 14:13
Mount samba
#!/bin/sh
# smbclient -L 10.0.1.1
mounttc ()
{
sudo echo -n;
if [[ -z $1 ]]; then
SERVER="10.0.1.1";
else
SERVER="$1";
fi;
@dcai
dcai / ca.cert
Created July 24, 2015 00:09
My CA public certificate
-----BEGIN CERTIFICATE-----
MIIGLTCCBBWgAwIBAgIJAMHi/0z+LKQcMA0GCSqGSIb3DQEBDQUAMGwxCzAJBgNV
BAYTAkFVMQwwCgYDVQQIEwNOU1cxFjAUBgNVBAoTDURvbmdzaGVuZyBDYWkxFjAU
BgNVBAMTDWRvbmdzaGVuZy5vcmcxHzAdBgkqhkiG9w0BCQEWEGhpQGRvbmdzaGVu
Zy5vcmcwHhcNMTQxMDIyMDUwNDI1WhcNMjQxMDE5MDUwNDI1WjBsMQswCQYDVQQG
EwJBVTEMMAoGA1UECBMDTlNXMRYwFAYDVQQKEw1Eb25nc2hlbmcgQ2FpMRYwFAYD
VQQDEw1kb25nc2hlbmcub3JnMR8wHQYJKoZIhvcNAQkBFhBoaUBkb25nc2hlbmcu
b3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7rHCBJbrQXnf5fgP
lEdOKG2DamPRdCzeSJH75uERxpVD8J+9vz8g+RJJtU50uotKbn1JzFXKiyxbgFyA
WC5fNuIHSil6LoXMqu+RycUT1snyx4Uv/Bj1kCaHFl8RYvzK0wK5aRKdR0vqK1jE
@dcai
dcai / gitolite.sh
Created July 4, 2011 08:56 — forked from masnick/gitolite_hn.bash
Setting up gitolite for archlinux
# First, get you id_rsa.pub onto the server as /tmp/YourName.pub
scp ~/ssh/id_rsa.pub you@git.you.com:/tmp/dongsheng.pub
# Then, as root:
cd $HOME
yaourt -S gitolite-git
su git
@dcai
dcai / gist:1186444
Created September 1, 2011 15:41
Bluk unrar xvid files
find . -name '*.part01.rar' -exec unrar -y x {} \;
@dcai
dcai / gist:1278207
Created October 11, 2011 14:22
shrinkImage
static UIImage *shrinkImage(UIImage *original, CGSize size) {
CGFloat scale = [UIScreen mainScreen].scale;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, size.width * scale,
size.height * scale, 8, 0, colorSpace, kCGImageAlphaPremultipliedFirst);
CGContextDrawImage(context,
CGRectMake(0, 0, size.width * scale, size.height * scale),
original.CGImage);
CGImageRef shrunken = CGBitmapContextCreateImage(context);
@dcai
dcai / configure-cli.sh
Created March 5, 2012 14:37
confgiure of php 5.4 for OS X 10.7 Lion
'./configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/private/etc' '--with-config-file-path=/etc' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--with-curl=/usr' '--enable-dba' '--with-ndbm=/usr' '--enable-exif' '--enable-ftp' '--with-gd' '--with-freetype-dir=/usr/X11/' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/X11/' '--enable-gd-native-ttf' '--with-icu-dir=/usr' '--with-iodbc=/usr' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--with-libedit=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--without-pear' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-readline=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--enabl
@dcai
dcai / configure-cli.sh
Created March 6, 2012 05:55
php 5.3.10 for OS X Lion
'./configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/private/etc' '--with-config-file-path=/etc' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--with-curl=/usr' '--enable-dba' '--with-ndbm=/usr' '--enable-exif' '--enable-ftp' '--with-gd' '--with-freetype-dir=/usr/X11' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/X11' '--enable-gd-native-ttf' '--with-iodbc=/usr' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--with-libedit=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-readline=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sqlite-utf8' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-tidy' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--enable-zend-multibyte'
@dcai
dcai / 2010-10-02-14-00-test-migration.py
Created June 26, 2012 14:08 — forked from galvez/2010-10-02-14-00-test-migration.py
A minimalist Python migration management script based on Fabric and sqlwitch
# 2010-10-02 14h00
# Update created field in user_prefs table
def migrate(db):
with db.select('user_id, created', from_='users'):
all_users = db.fetchall()
for user in all_users:
with db.update('user_prefs') as obj:
obj.created = user['created']
db.where('user_id = %s', user['user_id'])
@dcai
dcai / gist:3187294
Created July 27, 2012 10:20
Restore dmg image
sudo asr restore -source /Volumes/saturn/Software/InstallESD.dmg -target /Volumes/InstallOSX/ -erase -noverify --noprompt