Skip to content

Instantly share code, notes, and snippets.

View stiles's full-sized avatar

Matt Stiles stiles

View GitHub Profile
@stiles
stiles / post
Created September 18, 2012 20:47
Jekyll post
---
layout: post
title: "Hello world: Nerd blogging with Jekyll"
description: "We're a new team, and we're trying something new (at least for us) as a blog publishing platform: Jekyll, a generator that creates simple, static websites. <br><br>
We're not breaking any ground with this choice, of course, but we liked the idea of launching a blog that's open source — both its code and also its content.<br><br>
This initial post is an introduction to Jekyll for the members of our team -- and anyone else who wants to get started with the tool and/or steal our simple code for their own site."
author: Matt Stiles
---
@stiles
stiles / post.html
Created September 20, 2012 18:37
Jekyll post template
---
layout: default
---
<article>
<header>
<h1>{{ page.title }}</h1>
<p class="byline"> By {{ page.author }} | {{ page.date | date: "%B %d, %Y" }}</p>
</header>
@stiles
stiles / gist:5066197
Created March 1, 2013 17:17
Fusion Tables Demo
<html>
<head>
</head>
<body>
<!-- Paste fusion tables code below -->
@stiles
stiles / gist:5082637
Last active December 14, 2015 11:58
NPR Generation Listen Tweets
query = '#NPRGL'
# Edit this to save results to a different SQLite DB
db_path = 'nprgl.db'
import sys
import json
import urllib
import urllib2
import dateutil.parser
@stiles
stiles / gist:5093356
Last active December 14, 2015 13:28
Baby names
#set working directory
setwd("~/Dropbox/code-data")
# Set up
library(plyr)
library(ggplot2)
# load data
## Make sure data sets are in your working directory
options(stringsAsFactors = FALSE)
@stiles
stiles / gist:5950269
Last active December 19, 2015 11:49
DC crime
#tell R where you're working
setwd("~/YourDataFolder")
#load libraries
library(ggplot2)
library(gdata)
#load data
crime <- read.csv("crime2012.csv")
@stiles
stiles / un-country-codes
Last active August 29, 2015 14:16
Countries by region/continent with United Nations IDs
id,country,subregion,region,uniso,unisolow
108,Burundi,Eastern Africa,Africa,BDI,bdi
174,Comoros,Eastern Africa,Africa,COM,com
262,Djibouti,Eastern Africa,Africa,DJI,dji
232,Eritrea,Eastern Africa,Africa,ERI,eri
231,Ethiopia,Eastern Africa,Africa,ETH,eth
404,Kenya,Eastern Africa,Africa,KEN,ken
450,Madagascar,Eastern Africa,Africa,MDG,mdg
454,Malawi,Eastern Africa,Africa,MWI,mwi
480,Mauritius,Eastern Africa,Africa,MUS,mus
@stiles
stiles / tweet_image_dumper.py
Created August 30, 2016 08:35 — forked from freimanas/tweet_image_dumper.py
Get twitter user's photo url's from tweets - download all images from twitter user
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
import sys
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
@stiles
stiles / tweet_dumper.py
Created August 30, 2016 08:35 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@stiles
stiles / merge.sh
Created December 6, 2016 12:01
Merge multiple shapefiles (year to year, for example) and append attribute table to include original file name (for categorization)
for f in *.shp
do
base=${f%.shp}
ogrinfo $f -sql "ALTER TABLE $base ADD COLUMN filename character(15)"
ogrinfo $f -dialect SQLite -sql "UPDATE $base SET filename = '$base'"
ogr2ogr -update -append merged.shp $f
done