Skip to content

Instantly share code, notes, and snippets.

Avatar

James Casbon jamescasbon

View GitHub Profile
@jamescasbon
jamescasbon / gist:8707177
Last active Aug 29, 2015
difference between xdress clang and clang++
View gist:8707177
Compiling with clang++ with the same options as cindex uses
❯ clang++ -v -std=c++11 -I. -c build/sodium_sodium.cpp-sodium_sodium.h.cpp
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.2
@jamescasbon
jamescasbon / rest.py
Created Jun 17, 2011
REST handlers for backbone.js based on cyclone
View rest.py
# hmm no imports ;)
class BaseHandler(cyclone.web.RequestHandler):
def get_current_user(self):
return self.get_secure_cookie("user")
class LoginHandler(BaseHandler):
def get(self):
err = self.get_argument("e", None)
self.finish("""
View gist:1231739
# quickly fix mapping qualities in samfiles generated by SSAHA2
# mapq 255 is undefined according to spec, but SSAHA2 is not
# following this convention
import pysam
infile = pysam.Samfile( "-", "rb" )
outfile = pysam.Samfile( "-", "wb", template = infile )
for s in infile:
if s.mapq == 255:
s.mapq = 244
View gist:1232114
$ make
cd ../bamtools && mkdir -p build && cd build && cmake .. && make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/james/src/freebayes/bamtools/build
make[1]: Entering directory `/home/james/src/freebayes/bamtools/build'
make[2]: Entering directory `/home/james/src/freebayes/bamtools/build'
make[3]: Entering directory `/home/james/src/freebayes/bamtools/build'
make[3]: Leaving directory `/home/james/src/freebayes/bamtools/build'
make[3]: Entering directory `/home/james/src/freebayes/bamtools/build'
@jamescasbon
jamescasbon / melt_vcf.py
Created Oct 19, 2011
Melt VCF files into a reasonable tab delimited format, one genotype per line
View melt_vcf.py
#!/usr/bin/env python
""" Melt a VCF file into a tab delimited set of calls, one per line
VCF files have all the calls from different samples on one line. This
script reads vcf on stdin and writes all calls to stdout in tab delimited
format with one call in one sample per line. This makes it easy to find
a given sample's genotype with, say, grep.
"""
import sys
@jamescasbon
jamescasbon / gist:1585116
Created Jan 9, 2012
Python template example
View gist:1585116
d = Doc()
with d.html:
with d.head:
d.title ('example page')
d.link (rel='stylesheet', href='/style.css', type='text/css')
with d.body (style='foo'):
d.a ('other stuff on another page', href='/other.html')
@jamescasbon
jamescasbon / gist:1835715
Created Feb 15, 2012
steps file to go with the feature
View gist:1835715
from lettuce import *
from fabric import api
from fabric.api import env
import socket
servers = {
'xxx.local': {
'ip': ' xxxx',
'roles': ['production']
@jamescasbon
jamescasbon / gist:1835699
Created Feb 15, 2012
Example sysadmin feature
View gist:1835699
Feature: Mail
In order to handle mail
Scenario: Mail relay
Given I am a production server
And I am not a mail server
Then I should have postfix installed
And I should have a mail relay to mail.example.org
Scenario: Mail server
View bottle_redis.py
import redis
import inspect
class RedisPlugin(object):
name = 'redis'
def __init__(self,host='localhost',port=6379,database=0,keyword='rdb'):
self.host = host
self.port = port
self.database = database
@jamescasbon
jamescasbon / file1.txt
Created Apr 3, 2012
the description for this gist
View file1.txt
String file contents