Skip to content

Instantly share code, notes, and snippets.

View alexsparrow's full-sized avatar

Alex Sparrow alexsparrow

View GitHub Profile
@alexsparrow
alexsparrow / gist:967246
Created May 11, 2011 20:18
Arch changes
  • Used qtconfig to change font/QT style. Fixes weird looking skype.
Second sound is a temperature wave which travels at a speed of ~20m/s in superfluid hellium.
The second sound detector is an oscillating superleak transducer (OST) containing a flexible, porous membrane for transmitting the movement of superfluid and normalfluid component.
By determining the second sound wave travel time to the quench location and the second sound speed, triangulation offers an alternative method for quench localization. The technique has become highly complimentary (??!) in the pool of SRF cavity diagnostics for its easy assembly, flexible installation and fast measurement.
A series of second sound measurement results will be presented for justification of the OSTs used for the Superconducting Proton Linac test cavity (740MHz) at CERN (revise this).
@alexsparrow
alexsparrow / sconsenv.sh
Created July 5, 2011 10:26
Script to setup scons in private area via virtualenv
#!/bin/sh
echo ">> Downloading virtualenv..." && \
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.6.4.tar.gz#md5=1072b66d53c24e019a8f1304ac9d9fc5 && \
echo ">> Extracting..." && \
tar -xvzf virtualenv-1.6.4.tar.gz && \
echo ">> Creating '.pythondir'..." && \
mkdir .pythondir && \
cd virtualenv-1.6.4 && \
echo ">> Installing virtualenv..." && \
python setup.py install --prefix ../.pythondir && \
@alexsparrow
alexsparrow / post-receive
Created October 11, 2011 13:31
Git post-receive hook for building thesis
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
#export GEM_HOME=/home/hep/as1604/.gems/
git checkout -f
cd $HOME/Research/thesis_workdir
cp -r packages/* ~/texmf
texhash $HOME/texmf
#ruby -I ~/.rubygem/lib -I ~/lib64/ruby/ ~/.gems/bin/rake pdf
source ~/.thesis_env/bin/activate
scons pdf
cp thesis.pdf ~/public_html/thesis/
@alexsparrow
alexsparrow / TPyMultiGenFunction.py
Created November 2, 2011 14:50
Example using TPyMultiGenFunction
import ROOT as r
class Rosenbrock( r.TPyMultiGenFunction ):
def __init__( self ):
print "CREATED"
r.TPyMultiGenFunction.__init__( self, self )
def NDim( self ):
print 'PYTHON NDim called'
@alexsparrow
alexsparrow / gambit.sh
Created October 10, 2012 15:15
gambit
ANS=$(wget -qO- http://quiz.gambitresearch.com/ --save-cookies "gambit.cookies" | grep "To apply" | cut -f 2 -d ':' | cut -f 2 -d '{' | cut -f 1 -d '}' | bc -l)
echo $ANS
wget -qO- --load-cookies "gambit.cookies" http://quiz.gambitresearch.com/job/$ANS
class Node(object):
def __init__(self, depth):
# Node children keyed by character
self.children = {}
# Reference count
self.count = 0
# Depth from root node
self.depth = depth
def add(self, key):
class Node:
def __init__(self, name, left, right):
self.name = name
self.left = left
self.right = right
class Tree:
def __init__(self):
self.root = Node('1', Node('2', Node('4', None, None), Node('5', None, None)), Node('3', Node('6', None, None), Node('7', None, None)))
@alexsparrow
alexsparrow / my-formula.rb
Created April 30, 2013 15:13
Homebrew formula exhibiting hanging system call
require 'formula'
require 'find'
require 'version'
class MyFormula < Formula
BASEDIR=File.dirname(Pathname.new(__FILE__).realpath)
def self.init
homepage 'www.foo.com'
keg_only "We don't need all the stuff on the PATH"
depends_on 'foo/brew/postgis-15'
from fastkml import kml
k = kml.KML()
k.from_string(open("data/48cb6f8ca308484097e6ed4720b27faa_1.kml").read())
# This map will be a dict of borough name -> shapely geometry
map = {}
doc = list(k.features())[0]
for folder in doc.features():