Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Headd mheadd

View GitHub Profile
@mheadd
mheadd / get-app-guid.sh
Last active May 3, 2020
Get usage stats for a cloud.gov application
View get-app-guid.sh
#!/bin/bash
#
# A simple script to get a GUID for an applications. Note - assumes you have jq installed.
#
# The GUID for the app you want to check
APP_NAME=$1
if [[ ! $(which jq) ]]; then
echo "Error: You must have the jq utility installed to run this script. https://stedolan.github.io/jq/" >&2
@mheadd
mheadd / instructions.md
Last active Jul 21, 2020
Accessing PostGIS on a cloud.gov-brokered Postgres database
View instructions.md
View cg-ssh-tunneling.md

Using an SSH tunnel to remotely administer a cloud.gov RDS

Cloud.gov let's you interact with your apps and bound services via SSH.

The cf-service-connect plugin lets you connect to your bound services, and is often your beset choice for interacting with services in cloud.gov. But what if cf-service-connect doesn't work for you (e.g., if you are using a newer version of the cf CLI?

SSH tunneling to the rescue!

Usage

@mheadd
mheadd / 1-Dockerfile
Last active Feb 11, 2020
A set of files that can be used to set up a MS SQL Server instance and populate a table with test data
View 1-Dockerfile
# Install base image
FROM microsoft/mssql-server-linux
# Copy over the SQL file to set up the database
COPY setup.sql /
# Copy over the file with sample data.
# This data is from https://people.sc.fsu.edu/~jburkardt/data/csv/csv.html
COPY data.csv /
@mheadd
mheadd / get-issues.sh
Last active Nov 27, 2019
Fetch closed issues from a Github repo
View get-issues.sh
##!/bin/bash
## The name of the Github account user or org
OWNER=$1
## The name of the repo
REPO=$2
## Append the file with listd of issues
curl -s "https://api.github.com/repos/$OWNER/$REPO/issues?page=1&per_page=100&state=closed" \
View keybase.md

Keybase proof

I hereby claim:

  • I am mheadd on github.
  • I am mheadd (https://keybase.io/mheadd) on keybase.
  • I have a public key ASDf5v_IBXcBfsgDRP1fwqY16evvJMtC_SLI6H_bMN1VpAo

To claim this, I am signing this object:

@mheadd
mheadd / find-biz-by-license.sh
Last active Jul 21, 2017
A simple script to pull down businesses by license type and display in a searchable HTML table.
View find-biz-by-license.sh
##!/bin/bash
# License number (e.g., 3381).
LICENSE_TYPE=$1
# The name of the file to populate with records.
FILE_NAME=$2
echo "pri_contact_last_name, pri_contact_first_name, pri_contact_company_name, pri_contact_address1, pri_contact_city, pri_contact_state, pri_contact_zip, license_number, license_type_name, license_type_code" > $FILE_NAME
@mheadd
mheadd / philly311-sqlite.md
Last active Aug 23, 2016
Steps to import Philly311 data into an SQLite DB to enable SQL queries
View philly311-sqlite.md

Here are some steps to bring the bulk Philly311 CSV file into a local SQLite database to enable SQL queries.

Tools you'll use

  • sqlite3 (installed by default on OS X - try typing in ~$ which sqlite3 at a command prompt).
  • csvsql (follow installation instructions here if not already installed).
  • SQLite Manager for Firefox.

Steps

@mheadd
mheadd / philly-311-stats.csv
Last active Aug 23, 2016
Counts for service name and service code from Philly 311 data
View philly-311-stats.csv
Service Code Service Name # of Requests
SR-IR01 Information Request 674869
SR-LI21 Maintenance Residential or Commercial 40001
SR-ST03 Rubbish/Recyclable Material Collection 31159
Directory Assistance 25545
SR-ST02 Illegal Dumping 24401
SR-PD01 Abandoned Vehicle 22109
SR-ST01 Street Defect 22005
SR-CL01 Graffiti Removal 17160
SR-ST18 Salting 14282
@mheadd
mheadd / trip-1.md
Last active Aug 8, 2016
Calculating commuter routes with & without 81 N through Downtown Syracuse
View trip-1.md

From Town of Tully (Town Hall) to Syracuse Coworks

Standard Route

  • Start out going west on Meetinghouse Rd toward State Route 281/NY-281.
  • Turn right onto State Route 281/NY-281.
  • State Route 281/NY-281 becomes US Route 11/US-11 N.
  • Merge onto I-81 N via the ramp on the left.
  • Take the Adams St exit, EXIT 18, toward Harrison St.
  • Stay straight to go onto Almond St.
  • Turn left onto E Genesee St/NY-92.
You can’t perform that action at this time.