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:204861
Last active July 24, 2019 19:07
Django template for RFC-822 time format used in RSS feeds
<!--
Django template snippet that gives the current time,
as an "RFC-822 compliant" date-time suitable for RSS feeds.
Of course, you will probably never need to use this, since
generating RSS feeds via Django templates isn't the best way ...
you should use the Django feed syndication framework instead
( https://docs.djangoproject.com/en/dev/ref/contrib/syndication/ )
-->
@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 / 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 / standalone_html.py
Last active October 6, 2023 23:16
Convert HTML to a self contained file with inline Base64 encoded PNG images
#!/usr/bin/env python
# A simple script to suck up HTML, convert any images to inline Base64
# encoded format and write out the converted file.
#
# Usage: python standalone_html.py <input_file.html> <output_file.html>
#
# TODO: Consider MHTML format: https://en.wikipedia.org/wiki/MHTML
import os
from bs4 import BeautifulSoup
@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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pansapiens
pansapiens / cloudstor_link_convert.py
Last active January 11, 2019 09:07
[DEPRECATED] Convert a list of CloudStor (& Owncloud?) shared file page links into direct download links.
@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)