Skip to content

Instantly share code, notes, and snippets.

require 'formula'
class Dblatex < Formula
url 'http://downloads.sourceforge.net/project/dblatex/dblatex/dblatex-0.3/dblatex-0.3.tar.bz2'
homepage 'http://dblatex.sourceforge.net'
md5 '7de6bf72b8b2934169ce0ec911e966ed'
def install
system "python", "setup.py", "install", "--prefix=#{prefix}", "--install-scripts=#{bin}"
end
@gavinheavyside
gavinheavyside / core.clj
Created May 27, 2011 12:15
Pallet Experiment
(ns pallet_experiments.core
(:require
[pallet.core :as core]
[pallet.resource :as resource]
[pallet.crate.automated-admin-user :as automated-admin-user]))
(core/defnode mynode
"Test node for messing around"
{:os-family :amzn-linux
:location-id "eu-west-1"
@gavinheavyside
gavinheavyside / mapreduce_conway.rb
Created September 19, 2010 20:02
A MapReduce algorithm for Conway's Game of Life
#!/usr/bin/env ruby
require 'rubygems'
require 'wukong'
# Given a file with the coordinate pair of a live cell on each line,
# generate the next iteration of Game of Life, using MapReduce
#
# The map phase takes each live cell, and outputs 9 key value pairs, 1 for
# each of the adjacent cells and itself. The reduce phase dedupes, detects
@gavinheavyside
gavinheavyside / edash_notifier.rb
Created May 26, 2010 20:47
A cruisecontrol.rb notifier for edash
# A cruisecontrol.rb plugin to send notifications to edash (http://github.com/edendevelopment/edash)
# - put it in $CRUISE_DATA_ROOT/builder_plugins and restart cruisecontrol.rb
#
# notify building status to edash
#
# You might need to change the host and port in the post line
require 'builder_error'
require 'rest_client'
class EdashNotifier < BuilderPlugin
(defproject geotools-quickstart "1.0.0-SNAPSHOT"
:description "FIXME: write"
:repositories {"osgeo-geotools" "http://download.osgeo.org/webdav/geotools"}
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]
[org.geotools/gt-main "2.6.4"]
[org.geotools/gt-shapefile "2.6.4"]
[org.geotools/gt-epsg-hsql "2.6.4"]
[org.geotools/gt-swing "2.6.4"]]
:dev-dependencies [[swank-clojure "1.2.1"]])
(ns geotools.shape-viewer
(:import [org.geotools.data CachingFeatureSource FeatureSource FileDataStore FileDataStoreFinder])
(:import [org.geotools.map DefaultMapContext MapContext])
(:import [org.geotools.swing JMapFrame])
(:import [org.geotools.swing.data JFileDataStoreChooser]))
(defn show-shapefile
"Prompts the user for a shapefile and displays its content"
[]
(if-let [shapefile (JFileDataStoreChooser/showOpenFile "shp" nil)]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.heavyside.redis</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/redis-server</string>
<string>/usr/local/etc/redis.conf</string>
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@gavinheavyside
gavinheavyside / Create PostGIS template
Last active October 30, 2018 10:36
Create a POSTGIS template database
-- From http://geospatial.nomad-labs.com/2006/12/24/postgis-template-database/
-- $ sudo su postgres
-- $ psql template1
\c template1
CREATE DATABASE template_postgis WITH template = template1;
-- set the 'datistemplate' record in the 'pg_database' table for
-- 'template_postgis' to TRUE indicating its a template
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';
@gavinheavyside
gavinheavyside / trivial_file_upload_service.rb
Created November 3, 2009 20:09
Trivial file upload service using Sinatra
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
post '/:name/:filename' do
userdir = File.join("files", params[:name])