Skip to content

Instantly share code, notes, and snippets.

View dpwrussell's full-sized avatar

Douglas Russell dpwrussell

View GitHub Profile
@dpwrussell
dpwrussell / lda.sh
Created November 30, 2012 14:18
ldap experiment to determine how to query LDAP without basing with an OU
#!/bin/bash
(
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
dpwrussell / dict_of_dict.py
Last active December 24, 2015 17:19
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
dpwrussell / fast_lookup_filter.py
Created October 7, 2013 08:17
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:
#!/bin/bash
#
# DESCRIPTION:
#
# 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
dpwrussell / web-dev-runserver
Created November 10, 2013 15:21
omero-web-dev scripts. To setup and run django dev server in the OMERO environment.
#!/bin/bash
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/
cd $OMERO_PREFIX
# need to remove the built omeroweb code so it doesn't get imported
rm -rf lib/python/omeroweb/
@dpwrussell
dpwrussell / ice01.make
Last active December 28, 2015 05:39
Homebrew ice 3.5 with xcode tools and homebrew python 2.7
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
dpwrussell / test1.py
Last active December 28, 2015 22:39
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
dpwrussell / .gitignore
Last active December 29, 2015 04:39
Python sendmail
email_details.cfg
@dpwrussell
dpwrussell / .gitignore
Last active December 29, 2015 17:59
OMERO basic setup for quick tests
omero_details.cfg
*.pyc