Skip to content

Instantly share code, notes, and snippets.

use Bio::DB::Sam;
# high level API
my $sam = Bio::DB::Sam->new(-bam =>"data/ex1.bam",
-fasta=>"data/ex1.fa",
);
my @targets = $sam->seq_ids;
my @alignments = $sam->get_features_by_location(-seq_id => 'seq2',
-start => 500,
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY bo "http://graingert.co.uk/broadcast-ontology/" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
@graingert
graingert / foo.tex
Last active December 17, 2015 21:28
These fully centralized systems have a simple design and implementation however, there are some key issues that affect the users of the system - both merchants and customers - two of which are discussed here.
The first issue is that the trusted entity has a legal responsibility to handle ``charge-backs'' or reverse transactions, the cost for this escrow service - in which the central authority acts as an arbiter in disputes - is placed on the customer as a transfer fee or to the merchant as a fine, or worse\cite{violin}\footnote{\url{http://www.guardian.co.uk/world/2012/jan/04/paypal-buyer-destroys-violin}}.
The second major disadvantage of a centralized system is that it allows for a single point of failure resulting in a lack of reliability from the perspective of the user. The central authority has complete control over the status of the users' account - that authority can freeze the funds of that account at their discretion according to their own terms of service, this can include pressure from legal
from uuid import uuid1
from time import time
def main():
test = dict()
limit = 10 ** 10
while limit:
limit -= 1
x = {n:uuid1().hex for n in range(15)}
if len(set(x.values())) != len(x.keys()):
>>> def f():
... try:
... g()
... except:
... raise
...
>>> def g():
... try:
... 1/0
... except:
@graingert
graingert / xkcd.json
Last active December 27, 2015 18:49
{
"version": "0.15",
"groups": [
{
"name": "XKCD",
"urls": [],
"substitutions": [
{
"input": "witnesses",
"inputType": "text",
[INFO ] Executing state npm.installed for bower
[INFO ] Executing command 'npm --version' in directory '/root'
[DEBUG ] output: 1.3.14
[INFO ] Executing command 'npm list --json --global "bower"' in directory '/root'
[ERROR ] Command 'npm list --json --global "bower"' failed with return code: 1
[ERROR ] stdout: {}
[ERROR ] Error installing 'bower':
$ pip install drf-nested-routers==0.1.1
Downloading/unpacking drf-nested-routers==0.1.1
Downloading drf-nested-routers-0.1.1.tar.gz
Running setup.py egg_info for package drf-nested-routers
Requirement already satisfied (use --upgrade to upgrade): djangorestframework in /home/graingert/.virtualenvs/zonza/lib/python2.7/site-packages (from drf-nested-routers==0.1.1)
Installing collected packages: drf-nested-routers
Running setup.py install for drf-nested-routers
Successfully installed drf-nested-routers
import gc
def super_patch(old_obj, new_obj):
if old_obj is new_obj:
return
gc.collect()
for referrer_obj in gc.get_referrers(old_obj):
if hasattr(referrer_obj, "iteritems"):
for key, value in referrer_obj.iteritems():
$ nosetests test_stuff.py
E.E
======================================================================
ERROR: test_assert_true (test_stuff.TestFail)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/test_stuff.py", line 17, in test_assert_true
raise Exception
Exception