Skip to content

Instantly share code, notes, and snippets.

View gourneau's full-sized avatar
🎯
Focusing

Joshua Gourneau gourneau

🎯
Focusing
View GitHub Profile
@gourneau
gourneau / launch.sh
Created January 11, 2013 00:21
Plugin to create PDF at the end of a run for Ion Torrent
#!/bin/bash
VERSION="0.1"
#Set the URL for the API requests
plugin_url=http://127.0.0.1/rundb/api/v1/results/${RUNINFO__PK}/plugin/
page_url=http://127.0.0.1/${RUNINFO__URL_ROOT}/
#Set the HTTP Headers
api_header="Content-Type: application/json;Accept: application/json"
from __future__ import division
import requests
import math
import sys
def human_size(size_bytes):
"""
format a size in bytes into a 'human' file size, e.g. bytes, KB, MB, GB, TB, PB
Note that bytes/KB will be reported in whole numbers but MB and above will have greater precision
e.g. 1 byte, 43 bytes, 443 KB, 4.3 MB, 4.43 GB, etc
{ "pluginconfig" :
{
"torrent_variant_caller":{
"downsample_to_coverage":2000,
"min_indel_count_for_genotyping":5,
"min_mapping_quality_score":4,
"min_allele_frequency":0.2,
"hp_low_stringency":0,
"hp_min_cov_each_strand":3,
"hp_stb_fpe_min_coverage":30,
import random
class shorter_float(float):
"""A float which returns only 3 digits after the decimal"""
def __repr__(self):
return "%0.3f" % self
ires = 100.0 # Inverse resolution
left = -100
right = 101
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" media="all" href="/site_media/resources/bootstrap/css/bootstrap.min.css" type="text/css">
<script type="text/javascript" src="/site_media/resources/jquery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="/site_media/resources/bootstrap/js/bootstrap.min.js"></script>
blackbird.ite
```apace
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
from __future__ import division
import requests
import math
r = requests.get("http://ionwest.itw/rundb/api/v1/pluginresult/?format=json&endtime__gte=2013-01-10&limit=0")
s = [o["state"] for o in r.json["objects"] if o["state"] != "Queued" or o["state"] != "Pending"]
success = 0
error = 0
@gourneau
gourneau / pg_activity.sh
Created April 16, 2013 23:16
Install pg_activity on Ubuntu 10.04 from source
#https://github.com/julmon/pg_activity
#install
sudo aptitude install postgresql-server-dev-8.4 python-virtualenv
virtualenv --no-site-packages venv
source venv/bin/activate
sudo chmod -R 777 /usr/share/man/man1/
pip install https://github.com/julmon/pg_activity/archive/master.zip
#run
@gourneau
gourneau / startplugin.py
Created May 29, 2013 19:56
Start Ion Torrent plugins via the API using a Python script
import requests
import json
#load config from your json files, and convert it to a python dict
config = {}
payload = {'plugin': ["HelloWorld"], "pluginconfig" : config }
headers = {'content-type': 'application/json'}
#the number is the primary key of the result to run the plugin on
r = requests.post("http://bebop.itw/rundb/api/v1/results/224/plugin/", data=json.dumps(payload), auth=('ionadmin', 'ionadmin'),headers=headers)
@gourneau
gourneau / email.scpt
Created July 8, 2013 05:29
AppleScript script to compose email using Microsoft Outlook
tell (current date) to get (it's month as integer) & "-" & day & "-" & (it's year as integer)
set MyDay to the result as text
set Mytitle to "Daily Email - " as text
set Mytitle to Mytitle & MyDay
tell application "Microsoft Outlook"
set newMessage to make new outgoing message with properties {subject:Mytitle}
make new recipient at newMessage with properties {email address:{name:"Name", address:"test@example.com"}}
#make new cc recipient at newMessage with properties {email address:{name:"Name", address:"test@example.com"}}