Skip to content

Instantly share code, notes, and snippets.

View spara's full-sized avatar

Sophia Parafina spara

View GitHub Profile
@spara
spara / opengeo-suite-install.sh
Created March 22, 2011 20:07
OpenGeo Suite installer for Ubuntu with Apache proxy configured
#!/bin/bash
# setup repository
sudo wget -qO- http://apt.opengeo.org/gpg.key | apt-key add -
sudo chmod 655 /etc/apt/sources.list
sudo echo "deb http://apt.opengeo.org/ubuntu lucid main" >> /etc/apt/sources.list
sudo chmod 644 /etc/apt/sources.list
sudo apt-get update
# install opengeo suite
@spara
spara / geoserver-ubuntu-ec2-install.sh
Created March 23, 2011 02:50
Installs GeoServer on Canonical ubuntu EC2 AMI, GeoServer is proxied through apache
#
# install Geoserver on Ubuntu Maverick 10.10
# note: Geoserver is proxied through apache so port 8080 is not used
#
# @spara 11/15/10
#
# setup sources
sudo sh -c "echo ' ' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb http://us.archive.ubuntu.com/ubuntu/ maverick multiverse' >> /etc/apt/sources.list"
@spara
spara / postgres-ubuntu-ec2-install.sh
Created March 23, 2011 02:54
Install script for PostgreSQL/PostGIS on Canonical Ubuntu EC2 AMI with tables EBS RAID 10
#!/usr/bin/env bash
################################################################
#
# Amazon EC2 PostGIS 1.5 on RAID10,f2 EBS Array Build Script
#
# Complete Rip off of:
# http://github.com/tokumine/ebs_raid_postgis/blob/master/build.sh
# http://alestic.com/2009/06/ec2-ebs-raid
# http://biodivertido.blogspot.com/2009/10/install-postgresql-84-and-postgis-140.html
#
@spara
spara / install_locker.sh
Created May 28, 2011 10:51
Install locker from The Locker Project on Ubuntu
#!/bin/bash
#install node.js
sudo apt-get upgrade
sudo apt-get -y install git
sudo apt-get -y install gcc g++
git clone --depth 1 https://github.com/joyent/node.git
cd node/
export JOBS=2
mkdir ~/local
@spara
spara / counties_by_state.rb
Created July 22, 2011 23:14
ruby snippet that iterates through counties by state
states = ["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]
states.each do |state|
case state
when "AL"
counties = ["Autauga"," Baldwin"," Barbour"," Bibb"," Blount"," Bullock"," Butler"," Calhoun"," Chambers"," Cherokee"," Chilton"," Choctaw"," Clarke"," Clay"," Cleburne"," Coffee"," Colbert"," Conecuh"," Coosa"," Covington"," Crenshaw"," Cullman"," Dale"," Dallas"," DeKalb"," Elmore"," Escambia"," Etowah"," Fayette"," Franklin"," Geneva"," Greene"," Hale"," Henry"," Houston"," Jackson"," Jefferson"," Lamar"," Lauderdale"," Lawrence"," Lee"," Limestone"," Lowndes"," Macon"," Madison"," Marengo"," Marion"," Marshall"," Mobile"," Monroe"," Montgomery"," Morgan"," Perry"," Pickens"," Pike"," Randolph"," Russell"," Shelby"," St. Clair"," Sumter"," Talladega"," Tallapoosa"," Tuscaloosa"," Walker"," Washingt
{
"place" : {
"properties" : {
"geometry": {
"properties": {
"coordinates": {
"type": "geo_point"
}
}
}
@spara
spara / gist:1117013
Created July 31, 2011 17:48
Elasticsearch, register multiple geo_point types to single index
# first geo_point mapping: map1.json
"place" : {
"properties" : {
"geometry": {
"properties": {
"coordinates": {
"type": "geo_point"
}
@spara
spara / shapefile2elasticsearch.rb
Created July 31, 2011 18:01
Convert shapefile to elasticsearch bulk load format
#
# converts a shapefile to an elasticsearch geo_point type with this mapping:
#
# {
# "zipcode" : {
# "properties" : {
# "geometry": {
# "properties": {
# "coordinates": {
# "type": "geo_point"
[
{
"category":"Administrative",
"category_id":"10100100",
"type":"Region",
"subcategory":"Consolidated City"
},
{
"category":"Administrative",
"category_id":"10100101",
@spara
spara / mysql2sqlite.sh
Created August 22, 2011 21:16 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite