Skip to content

Instantly share code, notes, and snippets.

View mhkeller's full-sized avatar

Michael Keller mhkeller

View GitHub Profile
@mhkeller
mhkeller / left_join.js
Created February 8, 2014 20:08
SQL-like left joins in JavaScript
var _ = require('underscore');
var geo_key = 'name',
value_key = 'state_name';
var geo_data = [
{
"name": 'AK',
"geom": '1'
},
@mhkeller
mhkeller / merge_shp.sh
Last active August 29, 2015 13:56
Merge a directory of shapefiles into one shapefile
#!/bin/bash
mkdir merged;
for f in *.shp;
do
if [ -f merged/merged.shp ]
printf $f
then
ogr2ogr -f "ESRI Shapefile" -update -append merged/merged.shp "$f" -nln Merged
else
@mhkeller
mhkeller / gist:9500635
Last active August 29, 2015 13:57
Ubuntu prep
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo apt-get install python-pip
sudo apt-get install tmux
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install mailutils # okay to all
sudo apt-get install git-core
@mhkeller
mhkeller / Node.sublime-build
Last active August 29, 2015 14:01
Node build system for Sublime Text 2.
{
"cmd": ["/usr/local/bin/node", "$file", "$file"],
"working_dir": "${project_path:${folder}}",
"selector": "*.js"
}
@mhkeller
mhkeller / abbreviation-to-full-name-fips.json
Last active August 29, 2015 14:02
State abbreviation and fips codes
{
"AK": {
"fips": "02",
"name": "Alaska"
},
"AL": {
"fips": "01",
"name": "Alabama"
},
"AR": {
@mhkeller
mhkeller / README.md
Created June 5, 2014 22:09
Great arcs in CartoDB PostGIS
@mhkeller
mhkeller / README.md
Last active August 29, 2015 14:02
Regular expressions to capture candidate tweets in the 2014 election.

Keywords for Al Jazeera America's 2014 Election Twitter bots

This is the list of words that will trigger a retweet of candidate in the 2014 midterm elections in our three twitter bots @ajamEnergyBot, @ajamImmgratnBot and @ajamPotBot. If you have any additions/deletions/suggestions, please leave a comment below.

More info:

(sustainability|solar|Solyndra|#agw|biodiesel|biodiversity|bioenergy|biomass|biopower|clean air|cleaner air|cleanair|cleanenergy|natural gas|hydropower|hydroelectric|nuclear|foreign oil| emissions |energy innovation|geothermal|fuel efficiency|clean energy|natural resources| coal |climate change|global warming|eco-friendly|ecofriendly|ethanol|fracking|globalwarming|#green|#greenjobs|green jobs| methane |#smartgrid|smart grid|#tcktcktck |wind energy|wind power|windenergy|windpower|#recycle|energy subsidies|energy policy|energy

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="//d3js.org/d3.v3.min.js"></script>
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront