Skip to content

Instantly share code, notes, and snippets.

View lmullen's full-sized avatar

Lincoln Mullen lmullen

View GitHub Profile
@lmullen
lmullen / Rakefile
Last active August 29, 2015 13:57
Reproject geotiffs and upload them to a server
tifs_to_project = FileList["*.tif"].exclude(/epsg3857/).ext(".epsg3857.tif")
desc "Reproject all geotiffs into EPSG:3857"
multitask :default => tifs_to_project
rule( /\.epsg3857\.tif$/ => [
proc {|task_name| task_name.sub(/\.epsg3857\.tif$/, '.tif') }
]) do |t|
system "gdalwarp -t_srs EPSG:3857 -s_srs EPSG:4326 #{t.source} #{t.name}"
end
@lmullen
lmullen / Rakefile
Last active August 29, 2015 13:57
Download the WPA Slave Narratives from the Library of Congress
desc "Download the WPA Slave Narratives using wget"
task :wget_wpa do
system %{wget --wait 1 --limit-rate=200k -A .jpg,.png,.gif,.txt,.tif,.pdf --no-parent --background --mirror http://memory.loc.gov/mss/mesn/}
end
@lmullen
lmullen / Rakefile
Last active August 29, 2015 13:57
Convert geotiffs and rsync them to the server
tifs_to_project = FileList["*.tif"].exclude(/epsg3857/).ext(".epsg3857.tif")
desc "Reproject all geotiffs into EPSG:3857"
multitask :default => tifs_to_project
rule( /\.epsg3857\.tif$/ => [
proc {|task_name| task_name.sub(/\.epsg3857\.tif$/, '.tif') }
]) do |t|
system "gdalwarp -t_srs EPSG:3857 -s_srs EPSG:4326 #{t.source} #{t.name}"
end
@lmullen
lmullen / gitit-startup.sh
Last active August 29, 2015 13:56
An Ubuntu startup entry for Gitit; belongs in ~/.config/autostart/
#!/bin/sh
cd /home/lmullen/acad/research/wiki && /home/lmullen/.cabal/bin/gitit -f my.conf > /dev/null 2>&1 &
@lmullen
lmullen / configure-ubuntu.txt
Last active August 29, 2015 13:56
Configuring a new Ubuntu installation
# apt-get installs
sudo apt-get install synaptic
sudo apt-get install mercurial
sudo apt-get install libssl-dev
sudo apt-get install dconf-editor
sudo apt-get install pdftk
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install gm-notify
sudo apt-get install unity-tweak-tool
@lmullen
lmullen / shapefile.r
Last active January 26, 2022 22:07
How I use shapefiles in R with ggplot2 and RGDAL
library(rgdal) # R wrapper around GDAL/OGR
library(ggplot2) # for general plotting
library(ggmaps) # for fortifying shapefiles
# First read in the shapefile, using the path to the shapefile and the shapefile name minus the
# extension as arguments
shapefile <- readOGR("path/to/shapefile/", "name_of_shapefile")
# Next the shapefile has to be converted to a dataframe for use in ggplot2
shapefile_df <- fortify(shapefile)
@lmullen
lmullen / blink.py
Created December 28, 2013 17:34
Blink an LED connected to a Raspberry Pi, and interrupt it with the keyboard
@lmullen
lmullen / add-proxy.js
Created September 13, 2013 00:49
Bookmarklet to add your library proxy to a journal's URL
javascript:(function() {window.location=window.location.toString().replace(/(.org|.com)/,"$1.resources.library.brandeis.edu");})()
@lmullen
lmullen / post-commit
Created July 27, 2013 17:41
A script to log commits from a Git hook
#!/usr/bin/env ruby
# Write git commit messages to a log file
#
# Lincoln A. Mullen | [email protected] | http://lincolnmullen.com
# MIT License <http://lmullen.mit-license.org/>
#
# You will have to install the git gem for this to work:
# gem install git
#
@lmullen
lmullen / contributors.sql
Created May 11, 2013 20:07
Find how many contributions contributors have made to an Omeka database
SELECT `text`, COUNT(`text`)
FROM `omeka_element_texts`
WHERE `element_id` = 37
GROUP BY `text`