Skip to content

Instantly share code, notes, and snippets.

@nkrumm
nkrumm / deploy.sh
Created April 21, 2014 05:19
Deploying jekyll blog w/ extensions to github pages
# Deployment_info
# Notes: to use this worklflow, develop site and write posts in a "source" branch, then use the master branch for deployment.
## Clean build
jekyll build
## Pre-deployment gitfu:
git branch -D master
git checkout -b master
@nkrumm
nkrumm / [NRG] ASD Power calculations.ipynb
Created February 20, 2014 19:29
NRG power calculations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nkrumm
nkrumm / qpop.sh
Created February 10, 2014 08:52
qpop
function qpop { qstat -s p | tail -n+3 | awk '{print $1}' | head -n${1-1} | xargs qrls; }
@nkrumm
nkrumm / install_openblas.sh
Last active January 4, 2016 21:39
Installing openBLAS with multi-core support on eeek
#!/bin/bash
# Get and install openblas
mkdir -p ~/bin/openblas
cd ~/bin/openblas
wget https://github.com/xianyi/OpenBLAS/archive/v0.2.9.rc1.zip
unzip v0.2.9.rc1
cd OpenBLAS-0.2.9.rc1/
make
@nkrumm
nkrumm / Tufte Boxplots (pub).ipynb
Created January 20, 2014 18:15
ET boxplot challenge working draft
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# On EC2, /mnt is usually already on
mounted=$(mount | grep /mnt | wc -l)
if [ $mounted -eq 1 ]; then
umount -l /mnt
fi
# Install mdadm unattended
DEBIAN_FRONTEND=noninteractive apt-get -y install mdadm
# Create a RAID0 volume, don't ask for permission (--run)
@nkrumm
nkrumm / scriptrunner.py
Created January 7, 2014 00:58
Simple starcluster script runner
from starcluster.clustersetup import ClusterSetup
class ScriptRunner(ClusterSetup):
"""
Runs local scripts on node or master startup
"""
def __init__(self, node_startup_script):
self.node_startup_script = node_startup_script
def on_add_node(self, node, nodes, master, user, user_shell, volumes):
@nkrumm
nkrumm / aspera_to_s3.sh
Created December 23, 2013 07:14
DIY Direct-to-S3 Aspera solution. This snipped monitors a directory for new files (uploaded via aspera, for example) and then starts a background s3cmd job to upload those files Using the --partial-file-suffix=.part for the ascp command ensures that inotifywait only gets trigger when the file is finished uploading.
inotifywait -m -e moved_to $BASE | while read line
do
F=$(echo $line | cut -f3 -d" ")
echo "Now uploading $F"
s3cmd --force --no-progress put $F s3://mybucket/ &
done
@nkrumm
nkrumm / gist:7989588
Created December 16, 2013 16:11
Command line random line sampling from a file
awk 'BEGIN { srand(systime()); } {if (rand() < 0.3) { print $0; } }' data.csv
@nkrumm
nkrumm / merge_intervals.py
Created November 26, 2013 18:28
pandas compatible merge interval function
def merge_intervals(df, start_col="start", stop_col="stop"):
out = []
df = df.sort(start_col)
first_row = True
for ix, row in df.iterrows():
if first_row:
current_start = row[start_col]
current_stop = row[stop_col]
first_row = False
start = row[start_col]