Skip to content

Instantly share code, notes, and snippets.

Martin Sutherland sunpig

Block or report user

Report or block sunpig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View plate6.html
<!doctype html>
<html>
<body>
<h1>Plate 6</h1>
<canvas id="plate6" style="border:1px solid black"></canvas>
<script>
(function(){
function setNewGrey (ctx) {
grey = Math.floor(150 + (Math.random() * 75));
ctx.strokeStyle = `rgba(${grey}, ${grey}, ${grey}, 1)`;
View spoof_wifi.sh
#!/bin/bash
IF=en0
MAC=`python << EOF
import random
print ":".join("%02X"%x for x in (random.randint(0, 255) for _ in range(6)))
EOF
`
echo "resetting wifi on $IF, rotating mac $MAC"
scselect -n
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
View REPL setup for sqlalchemy
from sqlalchemy import MetaData, create_engine, orm
from sqlalchemy.sql import select
engine = create_engine('postgresql+psycopg2://username:password@localhost:5432/dbname')
Session = orm.sessionmaker(bind=engine)
session = Session()
metadata = MetaData(bind=engine)
metadata.reflect()
table_1 = metadata.tables['table_1']
table_1_column_1 = table_1.columns['column_1']
@sunpig
sunpig / pg-eu-2012.md
Created Sep 18, 2012
Notes from the PhoneGap EU Day 2012
View pg-eu-2012.md

PhoneGap EU Day 2012

Friday 14 Sep 2012, Compagnietheater Amsterdam


09:30 Opening remarks by Andre Charland (Adobe) @andrecharland

In the year since 1.0 was released, there have been 10,000,000+ visits to phonegap.com, and 1,000,000+ downloads of the phonegap software. build.phonegap.com, the automated build service (so you don't have to compile all the different targets yourself) has 100,000 users, and is due for a formal release "soon."

Regarding naming confusion, "Cordova" is the Open Source project, owned by the Apache foundation, and "PhoneGap" is Adobe's distribution. (Just like "Linux" is the core Open Source project, and "Ubuntu" is a distribution of it.)

View gist:3240789

"There is this, about being the sparring partner of the best swordsman in Caribastos. I always lost. But if I ever meet the third best swordsman in Caribastos, he's going to be in very deep trouble." -Lois McMaster Bujold, Paladin of Souls

@sunpig
sunpig / gist:3236740
Created Aug 2, 2012
JS implementation of [DOMElement].dataset property
View gist:3236740
/**
* Not all browsers support the .dataset property
* for DOM elements. This function performs the same
* function: it gathers all the data-* attributes of a
* DOM element, and returns them as a hash.
* Example: <p id="testP" data-monkey="fez" data-turtle="mine"></p>
* getDataset(p); // {'monkey':'fez', 'turtle':'mine'}
*/
function getDataset(el) {
var dataset = {};
@sunpig
sunpig / aleona-device-library.md
Last active Oct 7, 2015
Aleona Device Library
View aleona-device-library.md

Aleona device library

IOS6

  • iPad (3rd gen/retina)
  • iPhone 4

IOS5

  • iPod Touch
  • iPad (1st gen)
@sunpig
sunpig / HTML language
Created Nov 22, 2011 — forked from nimbupani/HTML language
TextMate HTML language tweaked to support unquoted attributes
View HTML language
{ scopeName = 'text.html.basic';
firstLineMatch = '<!DOCTYPE|doctype<(?i:html)|<\?(?i:php)';
fileTypes = ( 'html', 'htm', 'shtml', 'xhtml', 'phtml', 'php', 'inc', 'tmpl', 'tpl', 'ctp' );
foldingStartMarker = '(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl|section|article|header|footer|nav|aside)\b.*?>
|<!--(?!.*--\s*>)
|^<!--\ \#tminclude\ (?>.*?-->)$
|<\?(?:php)?.*\b(if|for(each)?|while)\b.+:
|\{\{?(if|foreach|capture|literal|foreach|php|section|strip)
|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
You can’t perform that action at this time.