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 / 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 / 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 / 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
@matthewberryman
matthewberryman / osm_import.md
Last active October 20, 2015 03:27
Import OpenStreeMap data
@matthewberryman
matthewberryman / fresh-cognicity-database.sh
Last active December 6, 2015 22:56
fresh-cognicity-database
#!/usr/bin/env bash
# assumes https://github.com/smart-facility/cognicity-schema and https://github.com/smart-facility/cognicity-reports
# both checked out using default directory names (matching trailing part of url)
createdb -U postgres -h $DB_HOST -E utf8 cognicity
cd cognicity-schema
psql -U postgres -h $DB_HOST -d cognicity -f schema.sql
cd sample_data/infrastructure
find . -name '*.sql' -exec psql -U postgres -h $DB_HOST -d cognicity -f {} ';'
@matthewberryman
matthewberryman / wpa_supplicant.conf
Created March 16, 2016 02:51
University of Wollongong UoW wpa_supplicant.conf example
country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="UOW"
proto=RSN
key_mgmt=WPA-EAP
pairwise=CCMP
auth_alg=OPEN