Skip to content

Instantly share code, notes, and snippets.


Peter Sefton ptsefton

View GitHub Profile
ptsefton / gist:628d4a1678d0214fe25d
Last active Aug 29, 2015
Quick macro to do markdown formatting in word
View gist:628d4a1678d0214fe25d
Rem Incomplete, work in progresss, mucking around with markdown via Word
'For use on OS X with Word 2011
' Requires pandoc - installed in /usr/local/bin
' Need to have styles Indent1 Indent2 etc with hanging indent at some standard increment (say 1cm), with tab-stops 1 for Indent1, 2 for Indent2
' To install, paste into a module, maybe in your Normal template
' Bind SaveIt to, say Ctrl-s and MarkIt to Ctrl-q
Sub saveAsDoc(name)
ptsefton /
Created Aug 12, 2014
Quick incomplete sample code for extracting CSV and CKAN-flavoured metadata from a TOA5 file
import csv
import StringIO
filestem = "WTC12_Table2_20140831"
in_file = "/Users/pt/Downloads/%s.dat" % filestem
out_file = "/Users/pt/Downloads/%s.csv" % filestem
def TOA52csv(in_file, out_file):
data = csv.reader(open(in_file))
writer = csv.writer(open(out_file, "w"))
ptsefton / gist:ef0d0098876283005344
Last active Oct 23, 2015
SImple file uploader (with hard-coded paths) for CKAN
View gist:ef0d0098876283005344
#!/usr/bin/env python
import urllib2
import urllib
import json
import pprint
import requests
import random
import string
base_url = ""

Keybase proof

I hereby claim:

  • I am ptsefton on github.
  • I am ptsefton ( on keybase.
  • I have a public key ASC4tD4OhLPv55oYWLyTpAjkOcP3SaOuVLCLWL4xB-daUAo

To claim this, I am signing this object:

ptsefton /
Created Oct 24, 2018
Quick hack to generate plantuml from a DataCrate file showing how instruments and agents relate to create agents
import argparse
import json
import os
def as_array(val):
if not isinstance(val, list):
return [val]
return val
ptsefton / katana-midi-controller.html
Created Jun 4, 2019
Quick and dirty BOSS Katana Midi Controller
View katana-midi-controller.html
<script src=""></script>
body {
background-color: #000000;
button {
ptsefton / gist:1ce30879e9cfef289356
Created May 26, 2015
Generate JSON mapping table from Windows Symbol and wingdings fonts to HTML entities via Python
View gist:1ce30879e9cfef289356
Generates a lookup table in JSON format to map characters from Wingdings and Symbol font to unicode.
Eg, this fragment of HTML <font face="Symbol"></font>Laughs<font face="Symbol"></font>.
Which should render like this: [Laughs]
Uses the data in this mapping table found here: