Skip to content

Instantly share code, notes, and snippets.

View brantfaircloth's full-sized avatar

Brant Faircloth brantfaircloth

View GitHub Profile
'''Problems with file descriptors remaining open when making a LOT of
subprocess calls can occasionally be solved by calling os.close() on
the file descriptor (returned by os.open() or pipe).'''
stdout, self.stderr = subprocess.Popen('primer3_core %s' % self.tf[1],\
shell=True, stdout=subprocess.PIPE, stdin=None, \
stderr=subprocess.PIPE, universal_newlines=True).communicate()
# make sure that we close the stupid ass input file or we're going
q = qplot(chr_only$target_chromo, chr_only$count, geom="bar")
q + opts(axis.text.x=theme_text(angle=-45, hjust=0))
@brantfaircloth
brantfaircloth / gist:253908
Created December 11, 2009 01:35
median and mode in mysql
on handle_string(s)
set cmd to "~/Bin/gcalcli quick " & quoted form of s
doTerminal(cmd)
end handle_string
on doTerminal(cmd)
do shell script cmd
end doTerminal
@brantfaircloth
brantfaircloth / gist:260331
Created December 20, 2009 02:09
Python multiprocessing.JoinableQueue()
import os
import subprocess
import multiprocessing
def q_runner(n_procs, list_item, function, *args):
'''generic function used to start worker processes'''
task_queue = multiprocessing.Queue()
results_queue = multiprocessing.JoinableQueue()
if args:
arguments = (task_queue, results_queue,) + args
export VERSIONER_PYTHON_PREFER_32_BIT=yes
# Create a new repo at github called `test`
# On your local machine:
$ cd test
$ git init
Initialized empty Git repository in /Users/bcf/Git/me/test/.git/
$ touch README
$ git add .
$ git commit -m 'first commit'
# wire everything up to the remote at github (replace yourName)
Index: py2app/build_app.py
===================================================================
--- py2app/build_app.py (revision 89)
+++ py2app/build_app.py (working copy)
@@ -40,7 +40,7 @@
from py2app import recipes
from distutils.sysconfig import get_config_var
-PYTHONRAMEWORK=get_config_var('PYTHONFRAMEWORK')
+PYTHONFRAMEWORK=get_config_var('PYTHONFRAMEWORK')
python configure.py CFLAGS+='-arch x86_64 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk' CXXFLAGS+='-arch x86_64 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk' LFLAGS+='-arch x86_64 -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk'
#!/usr/local/bin
"""
setup.py - script for building MyApplication
Usage:
% python setup.py py2app
"""
from setuptools import setup
import os, sys, shutil