Skip to content

Instantly share code, notes, and snippets.

View ptsefton's full-sized avatar

Peter Sefton ptsefton

View GitHub Profile
@ptsefton
ptsefton / katana-midi-controller.html
Created June 4, 2019 06:47
Quick and dirty BOSS Katana Midi Controller
<script src="https://cdn.jsdelivr.net/npm/webmidi"></script>
<body>
<style>
body {
background-color: #000000;
}
button {
@ptsefton
ptsefton / datacrate_to_plantuml_provenance_viz.py
Created October 24, 2018 06:02
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]
else:
return val

Keybase proof

I hereby claim:

  • I am ptsefton on github.
  • I am ptsefton (https://keybase.io/ptsefton) on keybase.
  • I have a public key ASC4tD4OhLPv55oYWLyTpAjkOcP3SaOuVLCLWL4xB-daUAo

To claim this, I am signing this object:

@ptsefton
ptsefton / gist:1ce30879e9cfef289356
Created May 26, 2015 08:10
Generate JSON mapping table from Windows Symbol and wingdings fonts to HTML entities via Python
"""
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: https://github.com/juanmf/sfPlugins/blob/master/reportPlugin/doc/Word2XSLTRenderingFO.xsl
@ptsefton
ptsefton / gist:ef0d0098876283005344
Last active October 23, 2015 18:40
SImple file uploader (with hard-coded paths) for CKAN
#!/usr/bin/env python
import urllib2
import urllib
import json
import pprint
import requests
import random
import string
base_url = "http://w0414.uws.edu.au/"
@ptsefton
ptsefton / TOA52csv.py
Created August 12, 2014 21:55
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
ptsefton / gist:628d4a1678d0214fe25d
Last active August 29, 2015 14:03
Quick macro to do markdown formatting in word
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)