Skip to content

Instantly share code, notes, and snippets.

@greencoder
greencoder / map.geojson
Created August 12, 2014 01:14
The DC Metro Rail Lines and Stations (WMATA)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@greencoder
greencoder / process.py
Created September 30, 2014 14:24
NOAA RIDGE Radar fringe remover
import numpy
import requests
import StringIO
# Use Pillow
from PIL import Image
# Get the latest radar image
request = requests.get('http://radar.weather.gov/ridge/Conus/RadarImg/latest_radaronly.gif')
@greencoder
greencoder / keybase.md
Created October 8, 2014 14:35
Keybase.io Verification

Keybase proof

I hereby claim:

  • I am greencoder on github.
  • I am snewman18 (https://keybase.io/snewman18) on keybase.
  • I have a public key whose fingerprint is 6D50 6B58 482B 8A3A 496B F4DB D33A 995D 548F C8CE

To claim this, I am signing this object:

@greencoder
greencoder / config.txt
Last active August 29, 2015 14:15
WX5280 Live Blog Notifier
[Pushover]
app_token: <your pushover app token>
user_key: <your pushover user key>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@greencoder
greencoder / fetch.py
Last active August 22, 2021 21:35
Create an extent for a NOAA radar image using the world file
import io
import PIL.Image
import urllib2
import sys
world_file_url = 'http://radar.weather.gov/ridge/Conus/RadarImg/northeast_radaronly.gfw'
radar_file_url = 'http://radar.weather.gov/ridge/Conus/RadarImg/northeast_radaronly.gif'
# Parse the radar image to find the height and width
@greencoder
greencoder / client.py
Last active May 7, 2016 19:37
Example Hyper Client and H2 Server
import hyper
import json
import sys
if len(sys.argv) != 4:
print('Usage: server.py /path/to/certificate.pem /path/to/key.pem certificate_password')
sys.exit(2)
cert = sys.argv[1]
key = sys.argv[2]
import hyper
import json
import sys
from apns2.errors import APNsException
from apns2.errors import ConnectionException
class APNsClient(object):
def __init__(self, cert_file, server='mock'):
@greencoder
greencoder / apns.sh
Created May 11, 2016 17:04
Curl the APNS http/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>
@greencoder
greencoder / AppDelegate.m
Created May 23, 2016 22:42
Campaign Fulfillment
- (void)campaignKit:(CKManager *)manager didFindCampaign:(CKCampaign *)campaign {
UIApplication *app = [UIApplication sharedApplication];
// If app is in background, show a local notification. If in foreground,
// show an alert view
if (app.applicationState != UIApplicationStateActive) {
UILocalNotification *notification = [campaign buildLocalNotification];
[app presentLocalNotificationNow:notification];