Skip to content

Instantly share code, notes, and snippets.

View annawoodard's full-sized avatar

Anna Woodard annawoodard

  • University of Chicago
  • Chicago, USA
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 27, 2024 00:18
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ryin
ryin / tmux_local_install.sh
Last active April 23, 2024 01:06
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@adrn
adrn / density_contour.py
Created November 1, 2012 14:35
Make a 2D density contour plot with matplotlib
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as so
def find_confidence_interval(x, pdf, confidence_level):
return pdf[pdf > x].sum() - confidence_level
def density_contour(xdata, ydata, nbins_x, nbins_y, ax=None, **contour_kwargs):
""" Create a density contour plot.
@dnmellen
dnmellen / timeout_decorator.py
Created January 23, 2014 15:39
Threaded timeout Python decorator
import threading
import logging
from functools import wraps
logger = logging.getLogger(__name__)
def timeout(secs=None):
def my_decorator(target, *args, **kwargs):
@garyvdm
garyvdm / test_tools.py
Created May 12, 2014 19:18
Alternative to nost.tools.with_setup decorator, which allows arguments to be returned form the setup function, and passed to the test and teardown functions.
def with_setup_args(setup, teardown=None):
"""Decorator to add setup and/or teardown methods to a test function::
@with_setup_args(setup, teardown)
def test_something():
" ... "
The setup function should return (args, kwargs) which will be passed to
test function, and teardown function.
@CamDavidsonPilon
CamDavidsonPilon / 538.json
Last active November 28, 2021 07:37
Use the two files below to mimic graphs on 538. www.dataorigami.net/blogs/fivethirtyeight-mpl
{
"lines.linewidth": 2.0,
"examples.download": true,
"patch.linewidth": 0.5,
"legend.fancybox": true,
"axes.color_cycle": [
"#30a2da",
"#fc4f30",
"#e5ae38",
"#6d904f",
@cranmer
cranmer / RooMomentMorphExample.py
Last active December 31, 2021 11:54
RooMomentMorph example for RooFit
#for C++ look here: https://gist.github.com/cranmer/b67830e46d53d5f7cf2d
import ROOT
import numpy as np
def testMomentMorph():
#Going to make a few statistical models we want to interpolate
#initialize workspace with some common background part
w = ROOT.RooWorkspace('w')
w.factory('Exponential::e(x[-5,15],tau[-.15,-3,0])')
x = w.var('x')
@rmcgibbo
rmcgibbo / free-slots.py
Last active October 26, 2021 15:04
Summarize free slots on SLURM queues [script].
#!/usr/bin/python
from __future__ import print_function, division
import os
import re
import sys
import itertools
from pprint import pprint
import subprocess
from distutils.spawn import find_executable
from collections import defaultdict
@markfink
markfink / game_of_life_32x64.ino
Last active July 28, 2017 04:49
Arduino Conway's Game of Life on 32 x 62 LED Matrix
// Conway's Game Of Life 32 x 64
// based on https://github.com/markfink/GoL_Javascript
#include <avr/pgmspace.h>
#include "pins_arduino.h"
// Connections to board
const byte pinSTB=7;
const byte pinClock=12;
const byte pinURed=10;
const byte pinUGreen=11;
@manugarri
manugarri / parking map.ipynb
Created February 21, 2016 21:19
Where the f*** can I park?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.