Skip to content

Instantly share code, notes, and snippets.

View lmullen's full-sized avatar

Lincoln Mullen lmullen

View GitHub Profile
@lmullen
lmullen / contributors.sql
Created March 27, 2013 02:07
Find the number of contributions each contributor has made to an Omeka database
SELECT TEXT, COUNT( * )
FROM omeka_element_texts
WHERE element_id = '37'
GROUP BY TEXT
@lmullen
lmullen / ToggleFootnoteJumping.vim
Created April 3, 2013 13:47
Jump between footnote markers with Vim's * key
" Find related Pandoc footnote numbers
" -------------------------------------------------------------------
" Vim's * key searches for the next instance of the word under the
" cursor; Vim decides what counts as the boundary of a word with the
" iskeyword option. This function toggles the special characters of a
" Pandoc footnote in the form [^1] to allow you to jump between
" footnotes with the * key.
nnoremap _fn :call ToggleFootnoteJumping()<CR>
function! ToggleFootnoteJumping()
if exists("g:FootnoteJumping")
@lmullen
lmullen / ToggleBackground.vim
Created April 4, 2013 21:23
Toggle Vim's background between light and dark
nnoremap <leader>bg :call ToggleBackground()<cr>
function! ToggleBackground()
if &background == "dark"
set background=light
else
set background=dark
endif
endfunction
@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`
@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 | lincoln@lincolnmullen.com | 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 / 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 / blink.py
Created December 28, 2013 17:34
Blink an LED connected to a Raspberry Pi, and interrupt it with the keyboard
@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 / 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 / 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 &