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 / SecretSnowflakeCoordinator.py
Last active January 1, 2016 19:59
Web app that automatically coordinates a Secret Snowflake Gift Exchange
#!/usr/bin/env python
# SecretSnowflakeOrganizer.py
# Web app that automatically coordinates a Secret Snowflake Gift Exchange
COORDINATOR_PASSWORD = 'COORDINATOR_PASSWORD'
DB_HOST = 'DB_HOST'
DB_USER = 'DB_USER'
DB_PASSWORD = 'DB_PASSWORD'
DB_NAME = 'DB_NAME'
GMAIL_USER = 'EMAIL'
@armanbilge
armanbilge / FlickrSetDownloadr.py
Created December 27, 2013 22:49
Downloads photos from a Flickr set
#!/usr/bin/env python
# FlickrSetDownloadr.py
# Downloads photos from a Flickr set
# Usage: python FlickrSetDownloadr.py [PHOTOSET_ID]
import sys
from collections import deque
try:
from xml.etree.cElementTree import fromstring
except:
@armanbilge
armanbilge / nexus2newick.py
Last active December 24, 2015 20:59
Converts trees from Nexus format to Newick format. Depends on Dendropy.
#!/usr/bin/env python
import sys
from dendropy import TreeList
NEWICK = 'newick'
NEXUS = 'nexus'
try:
stream = sys.argv[1]
/**
* Buzzer.java
*
* Buzzer
*/
package org.lexingtonma.lhs.nhb;
import java.awt.Color;
import java.awt.DefaultKeyboardFocusManager;
import java.awt.Font;
grep fullhostname rstb20120196supp1.xml | sed -e 's/\(<[^<][^<]*>\)//g' | sort | uniq | sed -e 's/^[[:space:]]*//' > bat-species.txt
@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
@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 / 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 / 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 / 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