Skip to content

Instantly share code, notes, and snippets.

@jwheare
jwheare / slipways.py
Created December 13, 2025 13:39
OSM slipway analysis - takes overpass geojson as input
#!/usr/bin/env python3
import json
import sys
from colors import color # pip install ansicolors
def main(input_path):
with open(input_path, "r") as f:
geojson = json.load(f)
@jwheare
jwheare / ircUrlParts.js
Created February 5, 2017 10:33
IRC URL parsing in JavaScript
export function ircUrlParts (ircUrl) {
// http://tools.ietf.org/html/draft-butcher-irc-url-04
if (!ircUrl) {
return;
}
var urlParts = ircUrl.split('://');
if (!urlParts[1]) {
return;
}
var protocol = urlParts[0];

Header 1

Header 2

Header 3 ### (Hashes on right are optional)

Header 4

Header 5

Markdown plus h2 with a custom ID ## {#id-goes-here}

Link back to H2

This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one

<html>
<head>
<style>
body {
background: black;
color: white;
}
pre {
font: 14px/1.7 normal "FixedsysTTF";
}
Generating push certificates:
Go to iOS developer portal, go to "App IDs", open the production app ID and open
settings. Click "create certificate" and follow instructions to get
aps_production.cer and aps_development.cer. Make sure you use distinctive names
with date in the CSR so you can find the things later.
Import generated .cer files into keychain.
In keychain, select "my certificates" on the left, and expand the "apple
var request = require('request')
var COOKIE = 'session=2.blahblahblah' // copy your site cookie in here
var CID = 1234; // copy the connection id here
var BID = 1234; // copy the buffer id here
var SINCE = +process.env.since // optional: set an environment variable "since" to offset the log
get_lines(SINCE);
function get_lines(beforeid) {
var headers = { 'Cookie': COOKIE }
@jwheare
jwheare / tunewatch.py
Last active December 28, 2015 05:29
Sniff airport traffic and map MAC addresses to a last.fm username
#!/usr/bin/env python
import subprocess
import sys
import re
import urllib
# Mapping of local MAC addresses to last.fm usernames
MAC_ADDRESSES = {
'00:00:00:00:00:00': 'lastfm_username',
@jwheare
jwheare / dataAttr.js
Last active December 16, 2015 01:19
jQuery's dataAttr function for parsing data-attrs to js types
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
@jwheare
jwheare / SublimeLinter.sublime-settings
Last active December 15, 2015 19:18
Linter exceptions
{
"sublimelinter": "load-save",
"sublimelinter_popup_errors_on_save": true,
"sublimelinter_mark_style": "none",
"sublimelinter_gutter_marks": true,
"pep8_ignore": [
"E501", // line too long
"E302", // two blank lines before class
"E303", // too many blank lines between funcs
"E401", // multiple imports