Skip to content

Instantly share code, notes, and snippets.

🔛

James J Porter porterjamesj

🔛
Block or report user

Report or block porterjamesj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View packets.txt
[2014-02-27 16:02:13] DEBUG lt-chitcpd <<< New state: CLOSING
[2014-02-27 16:02:13] DEBUG lt-chitcpd <<< Finished handling event PACKET_ARRIVAL on state FIN_WAIT_1
[2014-02-27 16:02:13] DEBUG lt-chitcpd >>> Handling event PACKET_ARRIVAL on state CLOSING
[2014-02-27 16:02:13] DEBUG lt-chitcpd <<< New state: CLOSING
[2014-02-27 16:02:13] DEBUG lt-chitcpd >>> TCP data BEFORE handling:
[2014-02-27 16:02:13] DEBUG lt-chitcpd ······················································
[2014-02-27 16:02:13] DEBUG lt-chitcpd CLOSING
[2014-02-27 16:02:13] DEBUG lt-chitcpd
[2014-02-27 16:02:13] DEBUG lt-chitcpd ISS: 3949 IRS: 3949
[2014-02-27 16:02:13] DEBUG lt-chitcpd SND.UNA: 3950
@porterjamesj
porterjamesj / bcbio.log
Last active Aug 29, 2015
ioerrors galore
View bcbio.log
"""
Traceback (most recent call last):
File "/usr/local/share/bcbio-nextgen/anaconda/lib/python2.7/site-packages/bcbio/provenance/do.py", line 22, in run
_do_run(cmd, checks)
File "/usr/local/share/bcbio-nextgen/anaconda/lib/python2.7/site-packages/bcbio/provenance/do.py", line 113, in _do_run
raise subprocess.CalledProcessError(exitcode, error_msg)
CalledProcessError: Command '/usr/local/share/bcbio-nextgen/anaconda/bin/cutadapt --times=2 --quality-base=33 --quality-cutoff=20 --format=fastq --minimum-length=0 --output=/glusterfs/netapp/infvol/PORT
ERJAMESJ/brca/work/trim/tx/tmpCEp9YB/111101_UNC13-SN749_0133_BC04U8ABXX.5_2_trimmed.fastq /glusterfs/netapp/infvol/PORTERJAMESJ/brcafqs/111101_UNC13-SN749_0133_BC04U8ABXX.5_2.fastq
Traceback (most recent call last):
File "/usr/local/share/bcbio-nextgen/anaconda/bin/cutadapt", line 10, in <module>
@porterjamesj
porterjamesj / pipeline.py
Last active Aug 29, 2015
the interface
View pipeline.py
from pipeline.main import pipeline_from_config
from pipeline.tools import async
from genomics_tools import parse_bowtie_output
with pipeline_from_config("/path/to/config.yaml") as p:
with async():
p.run("cutadapt --quality-base=33 --quality-cutoff=20 --format=fastq --minimum-length=0 --output={path1}/{name1}.trimmed.fastq {path1}/{name1}.fastq")
p.run("cutadapt --quality-base=33 --quality-cutoff=20 --format=fastq --minimum-length=0 --output={path2}/{name2}.trimmed.fastq {path2}/{name1}.fastq")
@porterjamesj
porterjamesj / weirdplot.csv
Created Mar 11, 2014
some data that makes a weird plot in python ggplot
View weirdplot.csv
C error gamma
0 1 0.1513 0.001
1 1 0.0967 0.005
2 1 0.0802 0.01
3 1 0.0698 0.02
4 1 0.0718 0.03
5 1 0.0772 0.04
6 1 0.0895 0.05
7 2 0.1211 0.001
8 2 0.0842 0.005
View final.jl
# some further optimizations
# Parameters
const S0 = 600; # current bitcoin price
const r = 0.02; # risk neutral payoff, assumed 2% for this exercise, in reality probably less.
const sigma = 2; # extremely high sigma due to spike in bitcoin prices late last year
const T = 1.0; # 1 Time cycle
const M = 100; # 100 steps
const dt = T / M # dt
@porterjamesj
porterjamesj / get_analysis_ids.py
Last active Aug 29, 2015
horrible regex abuse i used to get the analysis ids corresponding to pipeline outputs
View get_analysis_ids.py
import os
import re
xml_file = sys.argv[1]
tree = ET.parse(xml_file)
root = tree.getroot()
@porterjamesj
porterjamesj / balanced.py
Created Jun 11, 2014
fun exercise from programming praxis
View balanced.py
def balanced(s):
raise NotImplementedError("Implement me!")
def test():
for s in ["{}", "[]", "()", "a(b)c", "abc[d]", "a(b)c{d[e]}"]:
assert balanced(s)
for s in ["{]", "(]", "a(b]c", "abc[d}", "a(b)c{d[e}"]:
assert not balanced(s)
View first_try.jl
using BinDeps
@BinDeps.setup
gumbo = library_dependency("libgumbo")
provides(Sources,
URI("https://github.com/google/gumbo-parser/archive/master.zip"),
gumbo,
unpacked_dir="gumbo-parser-master")
@porterjamesj
porterjamesj / async.jl
Created Oct 28, 2014
demonstration that Julia task-switching happens only when a task has to wait on IO
View async.jl
function do_computation_then_print(message::String)
sum = 1
for i = 1:(rand() * 10^7)
sum *= i
end
# print out the sum so the compiler doesn't elide the loop
print("$message: $sum\n")
end
@porterjamesj
porterjamesj / echo.py
Last active Aug 29, 2015
tiny echo server with asyncio
View echo.py
import asyncio
@asyncio.coroutine
def server_callback(reader, writer):
while True:
data = yield from reader.readline()
yield from asyncio.sleep(1)
writer.write(data)
yield from writer.drain()
You can’t perform that action at this time.