Skip to content

Instantly share code, notes, and snippets.

View mheadd's full-sized avatar

Mark Headd (He/Him) mheadd

View GitHub Profile
@mheadd
mheadd / SNAP-Locations.csv
Created June 4, 2011 18:44
SNAP Locations in Philadelphia, PA
STORE_NAME longitude latitude ADDRESS CITY STATE ZIP5 zip4
Juliano's Deli Inc. #4 -74.973444952 40.0844016203 4015 Fairdale Rd Philadelphia PA 19154 3609
Juliano's Deli Inc #6 -75.0927498788 40.0522319612 6605 Rising Sun Ave Philadelphia PA 19111 4651
Juliano's Deli Inc. #2 -75.0310460907 40.1038646303 842 RED LION RD Philadelphia PA 19115
Misnik's Deli -75.1047648211 39.9862846768 2530 E Allegheny Ave Philadelphia PA 19134 5111
7 Days Food Market -75.1793963482 39.9934126624 2462 N 29th St Philadelphia PA 19132 3020
Has Has Market -75.1460796752 40.0315925206 5035 N Broad St Philadelphia PA 19141 2232
The New Wilson's Meats, Inc. -75.0977056526 39.9942456054 2325 E Venango St Philadelphia PA 19134 4622
Jo Jo Grocery Store -75.227895648 39.9260610669 2401 S 62nd St Philadelphia PA 19142 3216
Hojin Inc T/a Wiccaco Market -75.1499827328 39.9384947042 776 S 4th St Philadelphia PA 19147 3122
@mheadd
mheadd / dataset-management.md
Last active October 12, 2023 07:53
Sample API calls for creating, updating and deleting things in CKAN via the CKAN API.

Get package list

~$ curl http://www.civicdata.com/api/action/package_list

Get package details

~$ curl http://www.civicdata.com/api/action/package_show?id={package_id}

Upload a file to storage

~$ curl http://www.civicdata.com/api/storage/auth/form/testdata/test.csv -H "Authorization: <API-KEY>"
@mheadd
mheadd / monitor.sh
Created May 13, 2013 20:00
Simple bash script to check whether MySQL is running.
#!/bin/bash
UP=$(pgrep mysql | wc -l);
if [ "$UP" -ne 1 ];
then
echo "MySQL is down.";
sudo service mysql start
else
echo "All is well.";
fi
<?php
// The URL where the test-auth.php script resides.
define("POST_DATA_TO_URL", "http://someurl/my-script.php");
// Function to send value to my-script.php script via cURL with digest authentication.
function submitValue($myValue) {
$ch = curl_init(POST_DATA_TO_URL);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "admin:mypass");
{
"session": {
"accountId": "9178",
"callId": "4db51dcffa334accbd8012cf1634c146",
"from": {
"channel": "VOICE",
"id": "3026550235",
"name": "unknown",
"network": "SIP"
},
@mheadd
mheadd / import_school_data.sql
Last active November 11, 2022 11:45
A SQL script for importing School District Data into a MySQL database.
-- ------------------------------------------------------------------------------------
-- A SQL script for importing School District Data into a MySQL database.
-- Download "SDP School Information" ZIP file from the School District Open Data Page
-- http://webgui.phila.k12.pa.us/offices/a/accountability/open-data-initiative.
-- ------------------------------------------------------------------------------------
DROP DATABASE IF EXISTS schooldata;
CREATE DATABASE schooldata;
@mheadd
mheadd / inbound-sms.php
Created May 16, 2011 14:12
A simple PHP script that processes and saves inbound SMS messages from SMSified.
<?php
/*
* Convenience class that parses inbound SMSified JSON into a simple object.
*/
class InboundMessage {
// Class properties.
public $timeStamp;
public $destinationAddress;
const { batch } = require('frontmatter-file-batcher');
// The name of the file to modify.
const file_name = process.argv[2];
// The name of the new front matter property to add.
let fm_property = process.argv[3];
// The value of the new front matter property
let fm_value = process.argv[4];

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 / instructions.md
Last active April 9, 2021 12:26
Accessing PostGIS on a cloud.gov-brokered PostgreSQL database