Skip to content

Instantly share code, notes, and snippets.

@sdouglas
sdouglas / keybase.md
Created June 6, 2016 15:20
keybase.md

Keybase proof

I hereby claim:

  • I am sdouglas on github.
  • I am smd (https://keybase.io/smd) on keybase.
  • I have a public key whose fingerprint is 111F BCB7 C7D6 4FB5 8B24 E9DF 0773 C632 375A 0C83

To claim this, I am signing this object:

@sdouglas
sdouglas / .bash_profile
Last active September 22, 2018 11:18
bash profile
PS1="\[\033[38;5;11m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;12m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;11m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"
alias ls='ls -G'
export WORKON_HOME=$HOME/.venvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
@sdouglas
sdouglas / ifttt_rss2md.py
Last active August 29, 2015 14:04
find PMID in txt file, fetch XML from pubmed, parse into jekyll post, write markdown file to ~/Desktop
#!/usr/bin/env python
# encoding: utf-8
"""
ifttt_rss2md.py
Created on 2014-07-14.
The MIT License (MIT)
Copyright (c) 2014. Shawn Douglas
@sdouglas
sdouglas / makewikis.sh
Created July 30, 2012 20:32
Clones a MediaWiki database
#!/bin/sh
if [ $# -ne 2 ]; then
echo 1>&2 Usage: $0 firstdb lastdb
exit 1
fi
START=$1
END=$2
@sdouglas
sdouglas / gist:3209877
Created July 30, 2012 20:25
Display "View Source" link in MediaWiki for logged out users
if ( !$wgUser->isAllowed('edit') ) {
# if ( $wgUser->isAnon() ) {
# $this->userNotLoggedInPage();
# return;
# } else {
# $wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
# return;
# }
# Make source available to anon users
@sdouglas
sdouglas / print-upgrade.pl
Created July 30, 2012 20:19
Runs mediawiki update and rebuildall scripts for each wiki instance in a wikifarm
#!/usr/bin/perl
# Copyright (c) 2007 Shawn M. Douglas (shawndouglas.com)
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
@sdouglas
sdouglas / gist:1502896
Created December 20, 2011 19:39
Default cadnano colors (hex and decimal)
Colors are stored in decimal format in the json output. RGB values included for reference.
<br><font style="color:#cc0000;">#cc0000</font> = 13369344 = (204,0,0)
<br><font style="color:#f74308;">#f74308</font> = 16204552 = (247,67,8)
<br><font style="color:#f7931e;">#f7931e</font> = 16225054 = (247,147,30)
<br><font style="color:#aaaa00;">#aaaa00</font> = 11184640 = (170,170,0)
<br><font style="color:#57bb00;">#57bb00</font> = 5749504 = (87,187,0)
<br><font style="color:#007200;">#007200</font> = 29184 = (0,114,0)
<br><font style="color:#03b6a2;">#03b6a2</font> = 243362 = (3,182,162)
<br><font style="color:#1700de;">#1700de</font> = 1507550 = (23,0,222)
@sdouglas
sdouglas / parseJson
Created December 6, 2011 18:45
Parses a cadnano file and prints the [helix, index] for each base in all strands.
#!/usr/bin/env python
# encoding: utf-8
"""
parseJson.py
Created by Shawn M. Douglas on 2011-12-06.
"""
import sys
import os
@sdouglas
sdouglas / dna_rcomp.py
Created July 26, 2011 15:34
DNA reverse complement
import string
complement = string.maketrans('ACGTacgt','TGCATGCA')
def rcomp(s):
"""Returns the reverse complement of the sequence in s."""
return s.translate(complement)[::-1]
@sdouglas
sdouglas / timeit.py
Created July 26, 2011 15:27
Performance comparisons using timeit
#!/usr/bin/env python
# encoding: utf-8
import random
import string
from array import array
from timeit import Timer
repeats = 3 # report the best of these repeats
executions = 100000