Skip to content

Instantly share code, notes, and snippets.

View jonathansick's full-sized avatar

Jonathan Sick jonathansick

View GitHub Profile
@jasoncodes
jasoncodes / gist:1223731
Created September 17, 2011 07:45
Installing Ruby 1.9.3 with rbenv on OS X
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p286
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
@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.
@trey
trey / Gruntfile.js
Last active October 22, 2018 12:59
This is a braindump of the first time I was actually able to get Grunt to do all of what I wanted.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {},
}
},
@matthewmccullough
matthewmccullough / gist:47267
Created January 15, 2009 05:15 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@fccoelho
fccoelho / cgibbs.pyx
Created December 28, 2010 09:37
Comparison of MCMC implementations in Python and Cython. This is discussed here: http://pyinsci.blogspot.com/2010/12/efficcient-mcmc-in-python.html
'''
Pure cython version
compile with:
$ cython cgibbs.pyx
$ gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.6 -o cgibbs.so cgibbs.c
then import from python shell and call main()
'''
import random,math, time

EUPS distrib binary "tarball" products

The EUPS distrib facility (eups distrib ...) has support for packaging and publishing binary builds in a package format called "tarballs". Unlike the "eupspkg" (source) package format that was the sole DM published product format, "tarballs" are inherently tied to the microarchitecture and ABI of a platform. As there are currently multiple supported "stack" build platforms, a means of coordinating multiple independent binary builds from identical sources is needed both to ensure consistency of product versions across platforms and

@jmatt
jmatt / change-resource-record-sets.json
Created October 12, 2015 20:03
Bash command to add CNAME
{
"Comment": "A new CNAME for jsick's Read the Docs documentation.",
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "docs.lsst.codes.",
"Type": "CNAME",
"SetIdentifier" : "Read the Docs",
"Weight": 10,
@tylermenezes
tylermenezes / drafttypekit.userscript.js
Created December 9, 2013 22:35
Adds a personal Typekit kit to Draft
// ==UserScript==
// @name Draft Typekitizer
// @namespace http://tyler.menez.es/
// @version 1
// @description Adds Typekit to Draft
// @match http*://*.draftin.com/*
// @copyright 2013 Tyler Menezes
// ==/UserScript==
(function() {
@jhoblitt
jhoblitt / graph.sh
Created November 12, 2015 16:48
Build a graph of the EUPS product dependencies
git clone https://github.com/lsst-sqre/build-graph.git
cd build-graph/
wget https://raw.githubusercontent.com/lsst/versiondb/master/manifests/b1780.txt
virtualenv deps
. deps/bin/activate
pip install -r requirements.txt
./deps.py b1780.txt
import cPickle as pickle
import numpy as np
from bson.binary import Binary
from pymongo.son_manipulator import SONManipulator
class NumpySONManipulator(SONManipulator):
def transform_incoming(self, value, collection):
if isinstance(value, (list,tuple,set)):
return [self.transform_incoming(item,collection) for item in value]
if isinstance(value,dict):