Skip to content

Instantly share code, notes, and snippets.

View spara's full-sized avatar

Sophia Parafina spara

View GitHub Profile
@spara
spara / lamp_w_postgis.sh
Created September 21, 2011 14:31
LAMP stack with Postgres/PostGIS
#!/bin/bash
# update and add user
apt-get update
useradd -G users <username>
passwd <username>
visudo #add sparafina to shudders
# install apache
@spara
spara / qgis_script_template.py
Created September 29, 2011 15:35
QGIS standalone python script template for OSX
# To run the script you must set PYTHONPATH and path to QGIS binaries
#
# on Linux: export PYTHONPATH=/qgispath/share/qgis/python
# on Windows: set PYTHONPATH=c:\qgispath\python
# on OSX: export PYTHONPATH=/Applications/QGIS.app/Contents/Resources/python
# export PATH="/Applications/QGIS.app/Contents/MacOS/bin:$PATH"
from qgis.core import *
import sys
import os
@spara
spara / WKT_examples
Created November 11, 2011 15:45
Examples of Well Known Text for simple feature types
Point: Point (10 10)
LineString: LineString ( 10 10, 20 20, 30 40)
Polygon: Polygon ((10 10, 10 20, 20 20, 20 15, 10 10))
Multipoint: MultiPoint ((10 10), (20 20))
MultiLineString: MultiLineString ((10 10, 20 20), (15 15, 30 15))
@spara
spara / 2012_Conferences.txt
Created November 28, 2011 18:42
2012 Conferences
possible Shmoocon January 27-29 - no tickets
flight/hotel booked Strata February 28-March 1st - done
longshot SXSW Interactive March 9-13 - nope
flight/hotel booked WhereConf April 2-4 - presentation accepted
AR Standards Meeting March 19-20, Austing - purchased
flight/hotel booked FOSS4G North America April 10-12 - presentation accepte/moderating panel
definite ARE2012 May 8-9 - Ignite talk accepted
definite Google I/O June 27-29
flight/hotel booked HOPE Number Nine July 13-15
longshot FOSS4G Beijing??? August/Sept
@spara
spara / geo_header_to_postgres.sql
Created January 10, 2012 20:22
Import 2010 Census geo_header file into Postgresql
INSERT INTO geo_header_sf1 (fileid, stusab, sumlev, geocomp, chariter, cifsn, logrecno, region, division, state, county, countycc, countysc, cousub, cousubcc, cousubsc, place, placecc, placesc, tract, blkgrp, block, iuc, concit, concitcc, concitsc, aianhh, aianhhfp, aianhhcc, aihhtli, aitsce, aits, aitscc, ttract, tblkgrp, anrc, anrccc, cbsa, cbsasc, metdiv, csa, necta, nectasc, nectadiv, cnecta, cbsapci, nectapci, ua, uasc, uatype, ur, cd, sldu, sldl, vtd, vtdi, reserve2, zcta5, submcd, submcdcc, sdelem, sdsec, sduni, arealand, areawatr, name, funcstat, gcuni, pop100, hu100, intptlat, intptlon, lsadc, partflag, reserve3, uga, statens, countyns, cousubns, placens, concitns, aianhhns, aitsns, anrcns, submcdns, cd113, cd114, cd115, sldu2, sldu3, sldu4, sldl2, sldl3, sldl4, aianhhsc, csasc, cnectasc, memi, nmemi, puma, reserved)
SELECT
trim(substring(data,1,6)) AS fileid,
trim(substring(data,7,2)) AS stusab,
trim(substring(data,9,3)) AS sumlev,
trim(substring(data,12,2)) AS geocomp,
trim(substring(data,14,3)) AS
@spara
spara / create_SF1_tables.sql
Created January 10, 2012 20:25
Create 2010 Census SF1 tables
-- drop table data_field_descriptors;
create table data_field_descriptors
(
sort id integer,
segment varchar(4),
table number varchar(12),
field name varchar(510),
field code varchar(20),
decimal integer
);
@spara
spara / create_geo_header_staging_table.sql
Created January 10, 2012 20:27
Create staging table for geo_header data
CREATE TABLE geo_header_staging(data text);
copy geo_header_staging FROM '/path/to/dcgeo2010.sf1' DELIMITER AS '|';
@spara
spara / cut_paste_columns
Created January 11, 2012 02:28
cut and paste two columns from different files
paste <(awk '{print $1;}' gtemp) <(cut -f1 gfields)
@spara
spara / add_list_of_numbers.sh
Created January 18, 2012 01:41
add a list of numbers in a file
awk '{total+=$0}END{print total}' file
@spara
spara / add_list_of_numbers.sh
Created January 18, 2012 01:49
add a list of numbers in a file
awk '{total+=$0}END{print total}' file