Skip to content

Instantly share code, notes, and snippets.

View yamatt's full-sized avatar
💭
Arguing with AI

Matt Copperwaite yamatt

💭
Arguing with AI
View GitHub Profile
@yamatt
yamatt / keybase.md
Created September 30, 2014 08:28
keybase.md

Keybase proof

I hereby claim:

  • I am yaMatt on github.
  • I am mattcopp (https://keybase.io/mattcopp) on keybase.
  • I have a public key whose fingerprint is C9E9 4F43 3DBD 175E 0D8E B63C 9689 9D4A 56E8 D4BD

To claim this, I am signing this object:

@yamatt
yamatt / README.md
Created March 4, 2014 17:00
A quick app in Node that verifies md5 hashed and salted IDs over UDP

Server

This server is an example framework to test against and is not the final product. It is designed so that the id lookup is replaceable.

Usage

Run the server by using

node server.js 
@yamatt
yamatt / app.js
Created December 23, 2013 18:40
Simplification of an issue I had with Swig where you could not replace blocks conditionally when doing template inheritance.
var app = require("express")();
var swig = require('swig');
app.engine('swig.html', swig.renderFile);
app.set('view engine', 'swig.html');
app.set('views', __dirname);
app.get("/loggedin", function (req, res) {
res.render("default", {loggedin: true});
});
# -*- coding: UTF-8 -*-
a = u"£"
print a
@yamatt
yamatt / ihatebash.sh
Created April 8, 2013 14:39
Sometimes (quite often) I hate bash. This is mostly an issue if you want spaces in your directory path.
mkdir gubbins
touch gubbin{0..9}.file
ls gubbins/ # responds as you would expect
ls gubbins/* # responds as you would expect
ls gubbins/*.file # responds as you would expect
ls "gubbins/*.file" # no such file or directory
ls 'gubbins/*.file' # no such file or directory
ls "gubbins/"*".file" # works! damnit.
@yamatt
yamatt / SimpleWebSocketServer.py
Created March 19, 2013 13:59
Reference WebSocket server in Python. Works with WebSocket revision 13.
#!/usr/bin/env python
import time
import struct
import socket
import hashlib
import base64
import sys
from select import select
import re
@yamatt
yamatt / messaging.html
Created March 12, 2013 21:15
A starting point for a HTML5 messaging page using WebRTC
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Message Tests</title>
</head>
<body>
<h1>Set a name and type a message</h1>
<form id="name">
<label>Enter your name:
#!/usr/bin/env python
import pyglet
mp3 = "test.mp3"
source = pyglet.media.load(mp3)
player = pyglet.media.Player()
player.queue(source)
player.play()
@yamatt
yamatt / client.py
Created May 24, 2012 19:38
Definitive guide for creating ssl based server and client in Python 2.6 and higher
import socket
import sys
import ssl
class Client(object):
recv_length=1024
def __init__(self, server="localhost", port=5054):
self.server = server
self.port = port
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@yamatt
yamatt / qrbookmarklet.js
Created April 24, 2012 11:04
Turn this page in to a QR code bookmarklet
javascript:(function(){var qr_url="http://chart.apis.google.com/chart?cht=qr&chs=300x300&chld=H|0&chl=";window.open(qr_url+encodeURIComponent(location.href));})();