Skip to content

Instantly share code, notes, and snippets.

View erochest's full-sized avatar

Eric Rochester erochest

View GitHub Profile
@erochest
erochest / gist:5853420
Last active December 18, 2015 22:19
Ruby snippets
[1, 1, 2, 3, 5].each { |x| x * 2 }
@erochest
erochest / base.pp
Last active December 17, 2015 14:08
Some puppet files for setting up my personal config under a Vagrant-managed VM.
# A palate cleanser for apt.
exec { 'apt-get update':
path => ['/usr/bin'],
}
## These two use this module: https://github.com/erochest/puppet-omeka
## Use this to automate getting that set up: https://github.com/erochest/omeka-vm
class { 'omeka':
@erochest
erochest / lein.bat
Created February 19, 2013 16:32
A current Leiningen batch file script for Windows that downloads Leiningen 2.0.0.
@echo off
setLocal EnableExtensions EnableDelayedExpansion
set LEIN_VERSION=2.0.0
if "%LEIN_VERSION:~-9%" == "-SNAPSHOT" (
set SNAPSHOT=YES
) else (
set SNAPSHOT=NO
@erochest
erochest / start-rserve.sh
Created February 17, 2013 23:12
A simple shell script to start Rserve.
#!/bin/sh
R -e 'library(Rserve)' -e 'Rserve(args="--vanilla")'
(function(window, $, undefined) {
var $window = $(window);
/**
* Show or hide the button depending on the scroll position.
*/
function animateButton() {
var button = $('#back-to-top');
var scrollPosition = $window.scrollTop();
if (scrollPosition > 400) {
@erochest
erochest / change-geoserver-host.sql
Created December 19, 2012 20:55
More unholy SQL tricks. This time with Postgres.
CREATE EXTENSION xml2;
-- Credit where credit's due. Or blame:
-- http://dba.publicexchange.com/a/8188
create or replace function bytea_import(p_path text, p_result out bytea)
language plpgsql as $$
declare
l_oid oid;
r record;
begin
-- Geonetwork migration
CREATE TABLE CustomElementSet
(
xpath varchar(1000) not null
);
-- Fix languages table
ALTER TABLE Languages
ADD COLUMN isocode varchar(3),
@erochest
erochest / tc.bash
Created December 4, 2012 15:32
Script to copy from the tmux clipboard to the OS X system clipboard
#!/bin/sh
tmux saveb - | pbcopy
@erochest
erochest / jotto.rb
Created November 28, 2012 21:41
Jotto
# http://www.ruby-doc.org/stdlib-1.9.3/libdoc/set/rdoc/Set.html
require 'set'
class Dictionary
attr_reader :words
def initialize
@words = Set.new []
end
@erochest
erochest / spec.md
Created November 28, 2012 19:03
Specification for Jotto game

This will be a Jotto game for one player. See the Wikipedia article for details on the rules.

A typical interaction might look like this:

I'm thinking of a five-letter word. Guess what it is.
Guess 1 of 10: think
1 jot.
Guess 2 of 10: burnt

2 jots.