Skip to content

Instantly share code, notes, and snippets.

andrewbtran / gsiterator.R
Created Jun 19, 2019
gsiterator template
View gsiterator.R
# Authorize user on Google
gs_auth(new_user = TRUE)
# Naming the sheet
name_of_googlesheet <- "Testing out gsiterator"
# Test array
judy2k / parse_dotenv.bash
Created Mar 22, 2017
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
pocin / .zshrc
Last active Jan 12, 2020
Use conda+pyenv to manage python
View .zshrc
# $ brew install pyenv #pay attention to caveats ($ brew info pyenv)
# $ brew install pyenv-virtualenv
# this goes into .zshrc
export PYENV_ROOT=/usr/local/var/pyenv
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
OnlyInAmerica /
Created Apr 3, 2014
Find an AWS IAM user corresponding to an AWS Access Key
# Find the IAM username belonging to the TARGET_ACCESS_KEY
# Useful for finding IAM user corresponding to a compromised AWS credential
# Requirements:
# Environmental variables:
# python:
# boto
DanHerbert /
Last active Jan 25, 2021
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
ghing /
Created Apr 30, 2013
Send OpenNI skeleton data over a websocket. Uses gevent-websocket for the websockety things.
#!/usr/bin/env python
## The equivalent of:
## "Working with the Skeleton"
## in the OpenNI user guide.
This shows how to identify when a new user is detected, look for a pose for
that user, calibrate the users when they are in the pose, and track them,
sending updates about joint position over a websocket.
from haystack import indexes
# The easiest, per-object approach.
class CustomSearchIndex(indexes.SearchIndex, indexes.Indexable):
# The usual fields.
def prepare(self, obj):
prepared = super(CustomSearchIndex, self).prepare(obj)
cspanring /
Created Feb 8, 2012
Add GeoJSON support for geometry fields in django-tastypie
# Shamelessly stolen from
from django.contrib.gis.db.models import GeometryField
from django.utils import simplejson
from tastypie.bundle import Bundle
from tastypie.fields import ApiField, CharField
from tastypie.resources import ModelResource
unixcharles / backbone.iframe.sync.js
Created Oct 11, 2011
Backbone.sync implementation that use iframe + multipart/form-data
View backbone.iframe.sync.js
(function () {
Backbone.syncWithoutUpload = Backbone.sync
Backbone.syncWithUpload = function(method, model, options) {
// Create iframe
var iframe_id = 'file_upload_iframe_' +
, iframe = jQuery('<iframe id="' + iframe_id + '" name="' + iframe_id + '" ></iframe>').hide()
// Create an hidden form
var authToken = jQuery('meta[name=csrf-token]').attr('content')
, authParam = jQuery('meta[name=csrf-param]').attr('content')