Skip to content

Instantly share code, notes, and snippets.

View mhkeller's full-sized avatar

Michael Keller mhkeller

View GitHub Profile
@davidmcooper
davidmcooper / gist:5cd3e30572583b3f8815
Last active August 29, 2015 14:01
Bookmarklet for Adding Sort-By-Date to a Google Search
Create a new bookmark in your browser's book toolbar, but instead of bookmarking a URL, include the following code. This will create a button which, when-clicked, will add the necessary parameters to include sort-by-date functionality to your Google search. This button should only be used after you've already searched for something in Google.
javascript:(function(){location.href=location.href+'&tbs=sbd%3A1%2Ccdr%3A1%2Ccd_min%3A1%2F1%2F1800%2Ccd_max%3A&tbm=';})();
@amandabee
amandabee / use_git.md
Last active August 29, 2015 14:03
You should use Git

Git is a version control system. Github is a proprietary hosting service that manages central git repositories. A git repository doesn't have to be public, but there are some great free hosts available if you do want to make your work available. Github, obviously, or Gitorious, especially if you're offended by github's ugly gender politics. Github's GUI is much nicer than any generalized Git GUI's I've seen, which is a vote for using Github, but it really doesn't matter.

So here are a few good reasons you should use git to manage teaching materials:

  • Greg Wilson explains it pretty well to a Python conference. You have to listen to him talk about a few other things first, but the whole talk is interesting so go ahead.

Any newsroom with an

@veltman
veltman / gist:7e65d96b93403f8cbc77
Created January 22, 2015 23:01
Saving tiles locally
var request = require("request"),
fs = require("fs"),
xyz = require("xyz-affair"),
queue = require("queue-async")(10), //max concurrency
path = require("path"),
mkdirp = require("mkdirp");
var bounds = [
[
-74.00596618652344,
@abelsonlive
abelsonlive / genVarNames.R
Created May 27, 2012 02:33
Automatically generate variable names from Pattern, R
#// Say you were building a dataset and wanted to automatically
#// generate variable names by some pattern.
#// For instance, you might want to do this with population counts
#// within 100 census tracts by race
#// IE:
#
# tracts <- paste("c", rep(1:100), sep="")
# race - c("black", "white", "hispanic")
#
#// In this case you would want to generate 300 unique variable names
@abelsonlive
abelsonlive / assignColors.R
Created November 2, 2012 17:32
assignColors.R
# this function takes an input numeric vector and
# partitions it into a set number of breaks
# it then assigns a color to each break via RColorBrewer
assignColors <- function(var,
n = 9, # number of colors / breaks
style = "jenks", # can be changed to other methods in "classIntervals"
pal = "RdYlBu", # Palettes from RColorBrewer
na_color ='#787878', # Color to give NA's
na_omit = FALSE, # Logical, argument above will be irrelevant if TRUE
@artero
artero / keyrepeat.shell
Created November 5, 2012 14:36 — forked from kconragan/keyrepeat.shell
Enable key repeat in Apple Lion for Sublime Text 2 in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text 2 if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@abelsonlive
abelsonlive / gist:4090899
Created November 16, 2012 21:04 — forked from brianboyer/gist:1696819
Lion dev environment notes
import requests
import tweepy
import time
import oauth2
import re
from urllib import quote
# THIS IS WHAT YOU CUSTOMIZE #
# terms
LIST = "members-of-congress"
@mhkeller
mhkeller / gist:6590111
Last active December 23, 2015 05:49
PostGis query to shp
$ pgsql2shp -f <path to output shapefile> -h <hostname> -u <username> -P <password> databasename "<query>"
$ pgsql2shp -f ca_hex_2000_ided.shp -h localhost -u mike mike "SELECT ca_hex_2000_ided.geom, ca_hex_2000_ided.hex_id FROM ca_hex_2000_ided, bounder WHERE ST_Intersects(ca_hex_2000_ided.geom, bounder.geom) "
@dannguyen
dannguyen / unix-spell-checker-fun.md
Last active February 5, 2016 02:12
How to write a transcription of a video describing a UNIX spell checker

In progress: Attempting to write a set of command-line steps to process IBM Watson Speech-to-Text data to transcribe an old video about UNIX.

UNIX: Making Computers Easier To Use -- AT&T Archives film from 1982, Bell Laboratories

via this HN discussion: https://news.ycombinator.com/item?id=10789019

The discussion of the spell checker starts at the 5th minute with Brian Kernighan: https://www.youtube.com/watch?v=XvDZLjaCJuw&t=5m15s

It continues at the 13th minute with Lorinda Cherry: https://youtu.be/XvDZLjaCJuw?t=13m47s