Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Rochester erochest

View GitHub Profile
@erochest
erochest / update-branches
Last active Aug 29, 2015
Transfer all the branches to another repo.
View update-branches
#!/bin/bash
SOURCE=origin
DEST=bitbucket
for b in $(git branch -r | grep $SOURCE | grep -v -- '->' | sed 's/origin\///' | tr -d ' '); do
echo $b
git checkout $b
git pull
git push $DEST $b
@erochest
erochest / neatline.yml
Created Apr 7, 2014
An Ansible playbook to set up a [Neatline](http://neatline.org/) development environment in `/var/www/omeka/plugins/Neatline`. Plus `ag`. It builds on https://github.com/erochest/ansible-omeka.
View neatline.yml
---
- hosts: all
tasks:
- name: install software-properties-common
apt: pkg={{ item }} state=latest
sudo: true
with_items:
- python-apt
- python-pycurl
- software-properties-common
@erochest
erochest / dedup.sql
Last active Aug 29, 2015
Deduping markings in Prism
View dedup.sql
-- Duplicate the word_markings schema.
CREATE TABLE `tmp_word_markings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`index` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`user_id` int(11) DEFAULT NULL,
`facet_id` int(11) DEFAULT NULL,
`prism_id` varchar(36) DEFAULT NULL,
@erochest
erochest / libraries.csv
Created May 8, 2014
A CSV file listing the UVa libraries
View libraries.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
title,description
Alderman Library,"Alderman Library houses collections in the humanities and social sciences. In addition, Government Information Resources (government publications) and the Scholars’ Lab are located in Alderman, as are the University Library administration and several Library departments. Alderman also has Greenberry’s Cafe for coffee and refreshments. Mailing Address: P.O. Box 400113, Charlottesville, Va 22904-4113."
Astronomy Library,"General astronomy materials are in Brown Library and Clemons, while the Astronomy Library holds a more specialized research collection covering such topics as astrometry and high energy astrophysics. The library is in the Astronomy building, Room 264. It is open by key access only, arranged through the Department of Astronomy. If you are unable to reach us at the number below, please call 924-3628 during business hours."
Chemistry Library,"General and undergraduate-level chemistry materials, including chemical engineering, are located in Brown and Clemons l
@erochest
erochest / buildBaseBox.hs
Created Jun 13, 2014
Haskell script to automate creating (and re-creating) vagrant base boxes with veewee.
View buildBaseBox.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Monoid
import qualified Data.Text.Lazy as LT
import Prelude hiding (FilePath)
import Shelly
import System.Environment (getArgs)
View scratch.py
(r, g, b, _) = (13.1, 42.7, 123.456, 'a')
print('<div style="background-color: rgb({0:.0f}, {1:.0f}, {2:.0f});">'.format(r, g, b))
View Rakefile
multitask :all => ['a', 'b', 'c', 'd', 'e']
task :a do
connect(:a)
use_worksheet(:a)
end
task :b do
connect(:b)
View jasmine.out
Running "jasmine:neatline" (jasmine) task
Testing jasmine specs via PhantomJS
Events | Event Broker
highlight
- should do nothing when no records are highlighted......✓
- should unhighlight currently-highlighted record......X
Expected spy trigger to have been called with [ 'unhighlight', { model : { cid : 'c10', attributes : { id : 1, presenter : 'StaticBubble', fill_color : '#00aeff', fill_color_select : '#00aeff', stroke_color : '#000000', stroke_color_select : '#000000', fill_opacity : 0.3, fill_opacity_select : 0.4, stroke_opacity : 0.9, stroke_opacity_select : 1, stroke_width : 2, point_radius : 10, exhibit_id : '49', item_id : null, zindex : null, weight : null, min_zoom : null, max_zoom : null, map_zoom : null }, _changing : false, _previousAttributes : { id : 1, presenter : 'StaticBubble', fill_color : '#00aeff', fill_color_select : '#00aeff', stroke_color : '#000000', stroke_color_select : '#000000', fill_opacity : '0.3', fill_opacity_select : '0.4', stroke_opacity : '0
@erochest
erochest / insert_user.sql
Created Aug 6, 2014
Insert an Omeka user into the database from the mysql console.
View insert_user.sql
SET @salt := SUBSTR(SHA1('salt'), 1, 16);
INSERT INTO omeka_users (username, name, email, password, salt, active, role)
VALUES ('err8n', 'Eric', 'err8n@virginia.edu', SHA1(CONCAT(@salt, 'err8n')), @salt, 1, 'super');
View FizzBuzz.hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module FizzBuzz where
import Control.Applicative