Skip to content

Instantly share code, notes, and snippets.

View pansapiens's full-sized avatar

Andrew Perry pansapiens

  • Melbourne, Australia
View GitHub Profile
@pansapiens
pansapiens / gist:a40a847f37a7aa5d0dc9
Last active August 29, 2015 14:23
Electron density to VRML notes
# Tools:
# sf-convert: http://sw-tools.pdb.org/apps/SF-CONVERT/doc/V1-0-00/documentation.html
# Coot
# CCP4
# Pymol
# Get mmCIF format structure factors, and PDB coordinates
wget http://www.rcsb.org/pdb/files/r4J1Ysf.ent.gz
wget http://www.rcsb.org/pdb/files/4J1Y.pdb.gz
gunzip r4J1Ysf.ent.gz 4J1Y.pdb.gz
@pansapiens
pansapiens / inmembrane_signalp_trim.ipynb
Created September 3, 2015 00:56
Example of trimming SignalP predicted signal sequences using inmembrane
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pansapiens
pansapiens / ec2unifiedshell.py
Created January 20, 2010 04:45 — forked from anonymous/ec2unifiedshell.py
script to connect to all of your running EC2 instances, and to provide a single SSH prompt
#!/usr/bin/python
WhatThisIS="""
This is a hacked together script to connect to all of your running EC2 instances, and to provide a single SSH prompt amongst all of them, and to assist in uploading, splitting, and downloading files. email me at winniningham at and email server called gmail.com :P
"""
import paramiko
from numpy import *
@pansapiens
pansapiens / gae_json_rest.py
Created January 27, 2010 11:22 — forked from gerad/gae_json_rest.py
turn google app engine to a big json db in the cloud
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from django.utils import simplejson as json
from google.appengine.ext import db
import re
import pdb, sys
debugger = pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__)
@pansapiens
pansapiens / gist:3127897
Created July 17, 2012 08:03
Ezproxy URL munging bookmarklet
javascript:(function(){var%20url_regex=/(https?:\/\/(?:[-\w\.]+)+(?::\d+)?)((?:\/([\w/_\-\.]*(\?\S+)?)?)?)/,url_results=url_regex.exec(document.location),new_url%20=%20url_results[1]+".proxy.com"+url_results[2];window.location=new_url;})()
@pansapiens
pansapiens / merge_dicts.py
Created November 25, 2015 04:55
Merge Python dictionaries
# This version accepts any number of dictionaries
# http://stackoverflow.com/a/26853961
def merge_dicts(*dict_args):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for dictionary in dict_args:
result.update(dictionary)
@pansapiens
pansapiens / gist:6016434
Created July 17, 2013 00:09
Bash one liner to monitor if the IP for a domain has changed each hour. Beep and tiny window alert. Users should change the domain (www.example.com) and the domains current A record IP (192.168.0.1).
while true; do if host www.example.com | grep "192.168.0.1"; then sleep 3600; else printf "\a"; xmessage -center "Domain propagated"; fi done
@pansapiens
pansapiens / filter_counts.py
Last active October 26, 2016 22:42
Given a counts table from featureCounts (subread) and a GTF/GFF FeatureDB database, output a table with a gene name column ("symbol") containing only counts from "protein_coding" exon features.
#!/usr/bin/env python
import sys
import os
import argparse
import pandas as pd
import gffutils
def create_featuredb(gtf_file, output_file=':memory:'):
"""
@pansapiens
pansapiens / daves_bracket_challenge.py
Created March 7, 2017 02:48
Check that brackets are balanced
friend = {'}':'{', ']':'[', ')':'('}
close = friend.keys()
open = friend.values()
def check(input):
stack = []
for c in input:
if c in open:
stack.append(c)
elif c in close:
@pansapiens
pansapiens / hamming_paths.ipynb
Last active March 19, 2017 00:37
Dave & Bernie's Hamming Challenge
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.