Skip to content

Instantly share code, notes, and snippets.

View armanbilge's full-sized avatar
😵
Declaring notification bankruptcy. If I forgot your PR please ping me!

Arman Bilge armanbilge

😵
Declaring notification bankruptcy. If I forgot your PR please ping me!
View GitHub Profile
@armanbilge
armanbilge / PhylipDeinterleaver.py
Created July 30, 2013 03:56
A script to deinterleave phylip-formatted sequence files.
#!/usr/bin/env python
import sys
try:
stream = open(sys.argv[1], 'r')
except:
stream = sys.stdin
is_header = True
grep -oe "^[A-Za-z]*[0-9]*" COI.phy | nl -nln -v 0 | tail -n+2 > weevils.imap
@armanbilge
armanbilge / isolate_target_tree.pl
Created August 9, 2013 23:29
Isolates a target tree from a BEAST trees file
#!/usr/bin/env perl
#
# isolate_target_tree.pl
# Usage: isolate_target_tree.pl <target_tree_id> <trees_file>
use strict;
use warnings;
my $target_tree = shift;
@armanbilge
armanbilge / diversity_index.py
Last active December 20, 2015 22:49
College diversity index calculator
#!/usr/bin/env python
# Usage: diversity_index.py [percentage1 [percentage2 [...]]]
import sys
total = 0
for i in sys.argv[1:]:
total += float(i) ** 2
print 1 - total
@armanbilge
armanbilge / PoissonStats.py
Last active December 21, 2015 08:08
Basic simulation of multiple events under independent Poisson processes and visualization of its stats
#!/usr/bin/env python
import sys
import numpy
import pylab
import random
lambd_A = random.random()
lambd_B = random.random()
@armanbilge
armanbilge / HUJA.applescript
Last active December 21, 2015 10:09
Enables easy access to journals and other resources via Harvard's subscription (requires a Harvard ID).
#!/usr/bin/env osascript
-- HUJA: Harvard University Journal Access
set MY_USERNAME to "username"
set MY_PASSWORD to "password"
set PROXY_SERVER to ".ezp-prod1.hul.harvard.edu"
set loginAnyway to false
tell application "Safari" to set origURL to URL of front document as string
@armanbilge
armanbilge / FirstClassParser.py
Created August 30, 2013 02:48
Extracts student names and homerooms from a FirstClass directory's HTML source.
#!/usr/bin/env python
import sys
try:
stream = open(sys.argv[1], 'r')
except:
stream = sys.stdin
students = []
@armanbilge
armanbilge / outsmart-slurm.bash
Last active December 22, 2015 00:39
Outsmarts SLURM by automatically increasing the memory allocation for a failing job.
#!/usr/bin/bash
# outsmart-slurm.bash
# Outsmarts SLURM by automatically increasing the memory allocation for a failing job.
# Usage: bash outsmart-slurm.bash [SBATCH file]
# Download the latest revision at https://gist.github.com/armanbilge/6390764
if [ -z "$1" ]
then
echo "*** ERROR *** No SBATCH file specified." 1>&2
echo "Usage: bash outsmart-slurm.bash [SBATCH file]" 1>&2
grep fullhostname rstb20120196supp1.xml | sed -e 's/\(<[^<][^<]*>\)//g' | sort | uniq | sed -e 's/^[[:space:]]*//' > bat-species.txt
/**
* Buzzer.java
*
* Buzzer
*/
package org.lexingtonma.lhs.nhb;
import java.awt.Color;
import java.awt.DefaultKeyboardFocusManager;
import java.awt.Font;