Skip to content

Instantly share code, notes, and snippets.

View ldct's full-sized avatar

Li Xuanji ldct

View GitHub Profile
@ldct
ldct / gist:11224718
Last active August 29, 2015 14:00
Cool People/Blogs
https://github.com/antimatter15
http://tessrinearson.com/
http://conra.dk/
http://alexeymk.com/
http://alykhan.com/#portfolio
@ldct
ldct / good-design-sites
Last active August 29, 2015 14:00
Cool personal sites
http://www.marksimonson.com/info/about
http://jashkenas.github.io/docco/
@ldct
ldct / keybase
Last active August 29, 2015 14:06
keybase
### Keybase proof
I hereby claim:
* I am zodiac on github.
* I am xuanji (https://keybase.io/xuanji) on keybase.
* I have a public key whose fingerprint is 1FE4 A508 985D F775 7BBF 702E 6D52 D694 6CFF 4AD2
To claim this, I am signing this object:
@ldct
ldct / postgres.sh
Last active September 13, 2018 07:26
postgres 9.6 ubuntu 15.04
sudo apt-get install git build-essential curl xclip
sudo apt-get install bison flex libreadline-dev libz-dev
git clone git://git.postgresql.org/git/postgresql.git
cd postgresql; ./configure; make; sudo make install
cd contrib; make; sudo make install
sudo adduser postgres
sudo mkdir /usr/local/pgsql/data
sudo chown postgres -R /usr/local/pgsql/data
sudo apt-get install awesome
sudo mount /dev/cdrom /mnt
cd /mnt
sudo ./VBoxLinuxAdditions.run
reboot
sudo apt-get remove --purge libreoffice* rhythmbox thunderbird ubuntu-docs samba*
# bluez* gnome-user-guide
sudo apt-get clean
@ldct
ldct / ec2
Created August 28, 2015 00:58
EC2 / VPC gotchas
- lb must use same security group
- health check and redirect port might accidentally diverge
- must open custom ports on security group
def decode_execute(instruction):
d, s, t = (instruction >> 11) & 0b11111, (instruction >> 21) & 0b11111, (instruction >> 16) & 0b11111
i = instruction & 0b1111111111111111
if i & 0x8000: i -= 0x10000 # make sure we interpret the value as a signed 16 bit integer
if instruction & 0b11111100000000000000011111111111 == 0b00000000000000000000000000100000: # add (add)
return "add $%d $%d $%d" % (d, s, t)
elif instruction & 0b11111100000000000000011111111111 == 0b00000000000000000000000000100010: # subtract (sub)
return "sub $%d $%d $%d" % (d, s, t)
elif instruction & 0b11111100000000001111111111111111 == 0b00000000000000000000000000011000: # multiply (mult)
class PrefixStringSet {
public:
map<char, *PrefixStringSet> m;
bool contains(string s) {
cout << "contains " << s << endl;
if (s.size() == 0) {
return true;
}
if (m.find(s[0]) == m.end()) {
return false;
apt-get update
apt-get upgrade
apt-get install build-essential libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev curl git
mkdir tools
cd tools
mkdir erlang
cd erlang
curl -O https://raw.githubusercontent.com/yrashk/kerl/master/kerl
chmod +x ./kerl
./kerl list releases
@ldct
ldct / theanno
Created January 22, 2016 06:33
theanno
# ubuntu 14.04
# https://github.com/BVLC/caffe/wiki/Install-Caffe-on-EC2-from-scratch-(Ubuntu,-CUDA-7,-cuDNN)
# http://deeplearning.net/software/theano/install.html#gpu-linux
export PATH=$PATH:/usr/local/cuda-7.0/bin
export LD_LIBRARY_PATH=:/usr/local/cuda-7.0/lib64
export CUDA_ROOT=/usr/local/cuda
export THEANO_FLAGS='cuda.root=/path/to/cuda/root,device=gpu,floatX=float32'
sudo apt-get install python-pip python-dev