Skip to content

Instantly share code, notes, and snippets.

View lmullen's full-sized avatar

Lincoln Mullen lmullen

View GitHub Profile
@lmullen
lmullen / convert-file-encoding-line-breaks.zsh
Created March 12, 2014 20:46
Convert text files in cp1252 with dos line endings to files in UTF-8 with Unix line endings
# Convert text files in cp1252 with dos line endings to files in UTF-8 with
# Unix line endings
for file (*.txt) {iconv -f cp1252 -t utf-8 $file -o $file}
dos2unix *.txt
#!/usr/bin/env bash
set -e
VER=$1
ZIP="wordpress-$VER.zip"
URL="https://wordpress.org/$ZIP"
echo "Trying to upgrade to WordPress $VER"
echo "Downloading $URL"
@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 / 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 / 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 / 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 / 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 / Rakefile
Last active December 15, 2015 08:19
A Rakefile to install my Omeka development server
desc "There is no default task"
task :default do
puts "There is no default task. Try one of these:"
sh "rake --tasks"
end
desc "Setup Omeka"
task :setup_omeka => [:omeka_download, "omeka-dev", :omeka_copy_files, :omeka_install_official_plugins, :omeka_link_dev_theme, :omeka_link_dev_plugins] do
puts "Omeka is setup."
end
@lmullen
lmullen / 10print.rb
Last active December 15, 2015 01:08
10print in Ruby, just because. http://10print.org/
#!/usr/bin/env ruby
print (9585+rand(0..1)).chr(Encoding::UTF_8) while true