Skip to content

Instantly share code, notes, and snippets.


Douglas Russell dpwrussell

  • MathWorks
  • Cambridge, UK
View GitHub Profile
dpwrussell /
Created Nov 30, 2012
ldap experiment to determine how to query LDAP without basing with an OU
set -e
set -u
export CLASSPATH=.:`echo lib/server/*.jar | sed 's/ /:/g'`
cat > ldap.xml <<EOF
#!/usr/bin/env python
import psycopg2
import datetime
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
conn = psycopg2.connect("dbname=omerodb user=omerouser host=localhost")
dpwrussell /
Last active Dec 24, 2015
Dictionary of Dictionaries, for Tara.
dict1 = {'data1':'Lorem', 'data2':'ipsum', 'data3':'dolor'}
dict2 = {'data1':'sit', 'data2':'amet', 'data3':'consectetur'}
dict3 = {'data1':'adipisicing', 'data2':'elit', 'data3':'sed'}
#Basically just offically names each dictionary to the same as it's variable name,
dict_of_dict = {'dict1':dict1, 'dict2':dict2,'dict3':dict3}
# To find 'dict1_data2'
thing_to_find = 'dict1_data2'
dpwrussell /
Created Oct 7, 2013
Fast lookup index which writes lines to a file if they have a matching id in the index. For Tara.
test = set([])
keep = 'keep.txt'
all = 'input.txt'
out = 'output.txt'
outputfile = open(out, 'w')
with open(keep, 'rb') as file:
for line in file:
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
dpwrussell / web-dev-runserver
Created Nov 10, 2013
omero-web-dev scripts. To setup and run django dev server in the OMERO environment.
View web-dev-runserver
export OMERO_PREFIX=~/Checkouts/openmicroscopy/dist # Example server build path
# Make sure the Django code etc can be imported
#export PYTHONPATH=$OMERO_PREFIX/lib/python/
# need to remove the built omeroweb code so it doesn't get imported
rm -rf lib/python/omeroweb/
dpwrussell / ice01.make
Last active Dec 28, 2015
Homebrew ice 3.5 with xcode tools and homebrew python 2.7
View ice01.make
dpwrussell@bioch3117 ~
$ cat /Users/dpwrussell/Library/Logs/Homebrew/ice/01.make
making all in config
echo ""
making all in src
making all in IceUtil
making all in ca
cp iceca ../../bin/iceca
cp ImportKey.class ../../lib/ImportKey.class
dpwrussell /
Last active Dec 28, 2015
Demonstration of method_decorator failure
from functools import update_wrapper
from django.utils.decorators import method_decorator
class MyDecorator(object):
def __init__(self):
print 'MyDecorator init'
def __call__(self, f):
print 'MyDecorator call'
dpwrussell / .gitignore
Last active Dec 29, 2015
Python sendmail
View .gitignore
dpwrussell / .gitignore
Last active Dec 29, 2015
OMERO basic setup for quick tests
View .gitignore