Skip to content

Instantly share code, notes, and snippets.

@timf
timf / gist:1718425
Created February 1, 2012 18:15
Throttling BW and latency on OSX
sudo ipfw pipe 1 config bw 150kbit/s delay 150ms
sudo ipfw add pipe 1 dst-ip 0.0.0.0/0
# do slow stuff
# done:
sudo ipfw flush
scala> case class C(a: String, b: Option[String])
defined class C
scala> val constructors = C("",None).getClass.getConstructors
constructors: Array[java.lang.reflect.Constructor[_]] = Array(public C(java.lang.String,scala.Option))
scala> constructors.length
res13: Int = 1
scala> constructors(0).getParameterTypes
#!/bin/sh
CUSTOM_OSX="/Applications/Emacs.app/Contents/MacOS/Emacs"
EXE=`which emacs`
if [ `uname` == "Darwin" ]; then
if [ -f $CUSTOM_OSX ]; then
EXE=$CUSTOM_OSX
fi
elif [ -f /usr/bin/emacs-snapshot ]; then
@timf
timf / gist:1191338
Created September 3, 2011 15:24
OpenShift Open Source
https://www.redhat.com/openshift/faq
When will OpenShift Open Source?
We are planning to open source but we don't have a timeframe just yet.
Part of the code came from an acquisition and we need to work through
some legal processes and create a development environment in order to
engage the community.
@timf
timf / gist:979708
Created May 18, 2011 22:13
diskspace alias
alias duf='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'''
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.6/./src/irods.o build/temp.linux-i686-2.6/./src/PyApiNumber.o build/temp.linux-i686-2.6/./src/PyAuth.o build/temp.linux-i686-2.6/./src/PyChkObjPermAndStat.o build/temp.linux-i686-2.6/./src/PyDataObj.o build/temp.linux-i686-2.6/./src/PyGetRodsEnv.o build/temp.linux-i686-2.6/./src/PyMd5.o build/temp.linux-i686-2.6/./src/PyMiscUtil.o build/temp.linux-i686-2.6/./src/PyModAccessControl.o build/temp.linux-i686-2.6/./src/PyMsParam.o build/temp.linux-i686-2.6/./src/PyObf.o build/temp.linux-i686-2.6/./src/PyParseCommandLine.o build/temp.linux-i686-2.6/./src/PyRcConnect.o build/temp.linux-i686-2.6/./src/PyRcMisc.o build/temp.linux-i686-2.6/./src/PyRodsAdmin.o build/temp.linux-i686-2.6/./src/PyRodsDef.o build/temp.linux-i686-2.6/./src/PyRodsError.o build/temp.linux-i686-2.6/./src/PyRodsExec.o build/temp.linux-i686-2.6/./src/PyRodsFile.o build/temp.linux-i686-2.6/./src/PyRodsInfo.o build/temp.linux-i686-2.6/./src/PyRodsIO.o build/temp.linux-i68
@timf
timf / cmds.sh
Created November 18, 2010 03:47
Cleaning up a bit
rm fuuuuuuuuuu
rm arrggh.txt
rm sigh
rm test
rm wtf2.html
[plan]
run_plan: launch_plan.py
[runlevels]
level1: level1/level.conf
level2: level2/level.conf
level3: level3/level.conf
level4: level4/level.conf
[svc-rabbit]
# Well known names, launch plan author needs to coordinate with these constants
from bootstrap.names import *
# This is called by the outer program, well known signature
def run_plan(confs, services, launcher, tester):
"""
@param confs Bag of anything the operator configures or overrides
@param services Service configurations from launch plan
@param launcher Will launch a service/node/epu
node[:services].each do |service, service_spec|
service_config = "/home/#{node[:username]}/lcaarch/res/config/#{service}-ionservices.cfg"
template "#{service_config}" do
source "ionservices.cfg.erb"
owner "#{node[:username]}"
variables(:service_spec => service_spec)
end