Skip to content

Instantly share code, notes, and snippets.

View matthewberryman's full-sized avatar
💭
work work work

Matthew Berryman matthewberryman

💭
work work work
View GitHub Profile
@matthewberryman
matthewberryman / osm_import.md
Last active October 20, 2015 03:27
Import OpenStreeMap data
@matthewberryman
matthewberryman / remove_FME.sh
Last active August 29, 2015 14:01
Remove stale FME config
#!/bin/bash
cd ~/Library/Application\ Support
rm -r FME
rm -r FME\ Desktop\ Help
cd ~/Library/Preferences
rm com.safe-software-inc.*
cd ~/Library/Caches
rm -r Safe\ Software/FME
@matthewberryman
matthewberryman / setup_rds_postgis.sql
Last active January 2, 2021 11:53
Setup postgis in Amazon RDS
-- taken from http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS
create extension postgis;
create extension fuzzystrmatch;
create extension postgis_tiger_geocoder;
create extension postgis_topology;
alter schema tiger owner to rds_superuser;
alter schema tiger_data owner to rds_superuser;
alter schema topology owner to rds_superuser;
@matthewberryman
matthewberryman / osx-shellshock-patch.sh
Last active August 29, 2015 14:06
Patch OS X for shellshock
# I'm leaving this here for as a reference, but note the official patches are now out at
# http://support.apple.com/kb/DL1767?viewlocale=en_US&locale=en_US (Lion)
# http://support.apple.com/kb/DL1768?viewlocale=en_US&locale=en_US (Mountain Lion)
# http://support.apple.com/kb/DL1769?viewlocale=en_US&locale=en_US (Mavericks)
# Note they only seem to cover up to patch 53, following will get you to patch 54.
# Important: don't just download and run this. Read to the end first.
# Taken from http://apple.stackexchange.com/questions/146849/how-do-i-recompile-bash-to-avoid-shellshock-the-remote-exploit-cve-2014-6271-an
# but avoids symlinking to homebrew (as that may break things) and also added verification of patch file for good measure.
@matthewberryman
matthewberryman / submodules_to_subtrees.sh
Last active June 14, 2018 00:54
Convert git repo from submodules to subtrees
cat .gitmodules |while read i
do
if [[ $i == \[submodule* ]]; then
mpath=$(echo $i | cut -d\" -f2)
read i; read i;
murl=$(echo $i|cut -d\ -f3)
mcommit=`eval "git submodule status ${mpath} |cut -d\ -f2"`
mname=$(basename $mpath)
echo -e "$name\t$mpath\t$murl\t$mcommit"
git submodule deinit $mpath
@matthewberryman
matthewberryman / zipem.sh
Created January 5, 2015 01:46
For crawling directories and zipping up all of the associated shape files
#!/bin/bash
while read shp
do
echo Processing $shp
base=`echo $shp | sed "s/\.shp$//"`
zip=${base}.zip
rm -f $zip
zip "$zip" "${base}.shp" "${base}.shx" "${base}.prj" "${base}.dbf"
@matthewberryman
matthewberryman / ghost.c
Created January 28, 2015 03:29
GHOST checker
/* See http://yinette.github.io/blog/2015/01/28/ghost-in-the-library/ for more info */
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
@matthewberryman
matthewberryman / pg_postgis_restore.sh
Last active August 29, 2015 14:22
Wrapper around postgis_restore.pl on Ubuntu
# Please see https://github.com/smart-facility/postgis-upgrade for the latest version
@matthewberryman
matthewberryman / date.sh
Created June 30, 2015 20:35
print the date second by second
#!/usr/bin/env bash
while true;
do
echo `date`
sleep 1
done
@matthewberryman
matthewberryman / backup-github.sh
Last active October 15, 2015 04:26 — forked from bjtitus/backup-github.sh
A shell script to backup your Github organization's repos.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"smart-facility"} # the GitHub organization whose repos will be backed up
GHBU_API=${GHBU_API-"https://api.github.com"} # base URI for the GitHub API
GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see comments)
# I recommend using an API token so it is easily trackable and removable.
# Note that you MUST have SSH keys for a user with the access to all repos set up