Skip to content

Instantly share code, notes, and snippets.

@brainstorm
brainstorm / genologics postgresql migrate
Last active December 18, 2015 23:59
Migrates PostgreSQL database from Genologics LIMS, from production to staging.
#!/bin/bash -e
# Dumps a PostgresSQL over the network, from production to staging
DB="clarityDB"
DB_USER="clarity"
PROD=""
STAGING=""
echo "Preventing new connections from happening on $STAGING..."
ssh $STAGING "psql -U $DB_USER $DB -c 'REVOKE CONNECT ON DATABASE \"$DB\" FROM PUBLIC;'"
@brainstorm
brainstorm / simple_amqp.py
Created June 26, 2013 09:29
Simple AMQP tester
#!/usr/bin/env python
from kombu import BrokerConnection, Exchange, Queue
media_exchange = Exchange("media", "direct", durable=True)
video_queue = Queue("video", exchange=media_exchange, routing_key="video")
def process_media(body, message):
print body
message.ack()
@brainstorm
brainstorm / gist:6025344
Created July 17, 2013 23:08
Python Koans student evaluations
#!/usr/bin/env python
import sys
import re
import json
from collections import defaultdict
from travisParser import *
builds_list = ""
@brainstorm
brainstorm / irods_logstash.conf
Last active March 11, 2016 09:24
Parsing iRODS log files with logstash
input {
file {
type => "rodslog"
start_position => beginning
debug => true
sincedb_path => "/root/logstash/.sincedb"
path => [ "/root/logstash/logs/eu/var/log/irods/rodsLog.*" ]
}
}
@brainstorm
brainstorm / aws_credits_scrape.py
Created February 19, 2014 16:36
Get amazon remaining grant credits... scraping an AWS site
"""
Fetches the remaining EDU grant credits in an Amazon account using scraping
with Python's RoboBrowser (perl's WWW::Mechanize look-alike)
"""
from robobrowser import RoboBrowser
credits_url = 'https://portal.aws.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=credits'
browser = RoboBrowser(history=True)
browser.open(credits_url)
@brainstorm
brainstorm / Preferential attachment algorithm.ipynb
Last active August 29, 2015 14:00
Preferential attachment algorithm with Guido's graph notation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am brainstorm on github.
  • I am brainstorm (https://keybase.io/brainstorm) on keybase.
  • I have a public key whose fingerprint is F12F E607 E080 588A F5CE D8F1 12A5 388F 08F8 0CB5

To claim this, I am signing this object:

@brainstorm
brainstorm / piperget.sh
Last active August 29, 2015 14:02
piperget.sh: Fetching pipermail gzipped archives and converting them to .mbox format
#!/bin/sh
# Usage: piperget.sh https://mail.nmr.mgh.harvard.edu/pipermail/freesurfer/
# automated retrieval of pipermail archives & conversion to mbox file
# Last edit: 2012/10/09 Tue 23:16 PDT
listname=$(echo "$1" | sed 's:^\(http.*\)/\([^/]*\)/$:\2:')
cd /tmp
wget -r -l 1 -nH -A *.txt.gz "$1"
touch /tmp/pipermail/$listname/$listname.mbox
chmod 600 /tmp/pipermail/$listname/$listname.mbox
cd /tmp/pipermail/$listname
@brainstorm
brainstorm / dataspace-kibana.json
Created June 25, 2014 15:20
DataSpace Kibana JSON definition
{
"title": "Logstash Search",
"services": {
"query": {
"list": {
"0": {
"query": "loglevel: ERROR",
"alias": "errors",
"color": "#BF1B00",
"id": 0,
@brainstorm
brainstorm / efika_card_build.sh
Created September 1, 2014 10:10
Buildbot scripts for Efika MX image/release engineering
#!/bin/bash
dcfldd if=/dev/$1 bs=1M count=1800 status=on statusinterval=1 | xz -z -T3 -c -e >$2