Skip to content

Instantly share code, notes, and snippets.

@frankzhao
frankzhao / install_packages
Last active August 29, 2015 14:10
Things to install on new *nix
xubuntu-desktop
git openssh-server tmux zsh clang curl texlive vagrant vim
rvm ruby-2.1.0 rails postgresql
cuda-toolkit
python-numpy python-scipy python-matplotlib ipython python-pip python-setuptools
ipython-notebook python-pandas python-sympy python-nose
pycuda
terminator guake xchat
(find / -name 'libGLU*')
libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev freeglut3 freeglut3-dev
@frankzhao
frankzhao / mac_setup.md
Last active August 29, 2015 14:10
Setting up a Macbook Pro for Computer Scientists

This is written for OS X 10.10 Yosemite.

Essential applications

  • iTerm (Terminal alternative)
  • TextMate (Text editor)
  • SublimeText (Text editor)
  • Xcode
  • Chrome
  • MagicPrefs (Advanced gestures, mouse configurations)
@frankzhao
frankzhao / test_compile_wireworlds.py
Last active August 29, 2015 14:18
Batch compile Wireworlds
# Frank Zhao 2015
# Test compilation of Wireworld submissions
from os import listdir, mkdir
from subprocess import Popen, PIPE, STDOUT
from shutil import copy2
import zipfile
def attempt_compilation(folder, path):
path = path + "/"
copy2(compile_script, path + compile_script)
@frankzhao
frankzhao / vnc-active.md
Last active August 29, 2015 14:19
VNC currently active desktop

sudo apt-get install x11vnc

Set password x11vnc -storepasswd password /path/to/passfile or x11vnc -storepasswd to use ~/.vnc/passwd

x11vnc -display :0 -auth .Xauthority -rfbauth /path/to/passfile

or

@frankzhao
frankzhao / test_compile_kalaha.py
Last active August 29, 2015 14:22
Batch compile Kalaha players
# Frank Zhao 2015
# Test compilation of Kalaha submissions
from subprocess import Popen, PIPE, STDOUT
import os, shutil, glob, zipfile
def attempt_compilation(folder, path):
path = path + "/"
os.mkdir(path + sources_dir)
copytree(sources_dir, path + sources_dir) # Copy assignment template files
shutil.copy2(compile_script, path + compile_script) # Copy compile script
@frankzhao
frankzhao / install_mdsplus.sh
Last active December 12, 2021 01:17
Installation script for MDSplus on Mac OS X
#!/bin/bash
# Frank Zhao, July 2015
echo "Download prerequisites... [1 of 4]"
curl -O http://www.ist-inc.com/motif/download/motif_files/openmotif-compat-2.1.32_IST.macosx10.5.dmg
curl -O ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
curl -O http://xquartz.macosforge.org/downloads/SL/XQuartz-2.7.7.dmg
curl -O http://www.mdsplus.org/dist/macosx/stable/MDSplus-7-0-103-osx.pkg
echo "Installing OpenMotif... [1 of 4]"
hdiutil attach openmotif-compat-2.1.32_IST.macosx10.5.dmg
@frankzhao
frankzhao / install_cockpit_ubuntu.sh
Last active January 10, 2016 08:14
Install cockpit on Ubuntu 15.04
wget -qO- https://github.com/cockpit-project/cockpit/releases/download/0.90/cockpit-0.90.tar.bz2 | tar xvj
mv cockpit-0.90 cockpit
apt-get install -y nodejs npm intltool libsystemd-journal-dev \
libsystemd-daemon-dev libjson-glib-dev libpolkit-agent-1-dev \
libssh-dev libkeyutils-dev libpcp3-dev libpcp-import1-dev \
libpcp-pmda3-dev libpam-dev xsltproc xmlto
cd cockpit && ./configure --libexecdir=/usr/bin
make && make install
@frankzhao
frankzhao / docker_cleanup.sh
Last active January 12, 2016 23:57
Clean up after docker
docker rm -v `docker ps --no-trunc -aq`
docker rmi $(docker images -f "dangling=true" -q)

Keybase proof

I hereby claim:

  • I am frankzhao on github.
  • I am frankzhao (https://keybase.io/frankzhao) on keybase.
  • I have a public key ASAt37kruNhhijoY5YKOkJaREepHwQTs_g4Hr1kLjqjI5wo

To claim this, I am signing this object:

@frankzhao
frankzhao / backlight.sh
Created June 15, 2017 00:41
Fix backlight in i3
#!/bin/bash
set -e
file="/sys/class/backlight/intel_backlight/brightness"
current=$(cat "$file")
new="$current"
if [ "$1" = "-inc" ]
then
new=$(( current + $2 ))
fi
if [ "$1" = "-dec" ]