Skip to content

Instantly share code, notes, and snippets.

FLamparski /
Created Feb 13, 2014
For those who don't want to or can't use dynamic DNS but need to be able to access their network from anywhere
#!/usr/bin/env python3
from time import sleep
from urllib.parse import urlencode
import subprocess as sp
import httplib2
import json
import sys
import re
FLamparski /
Created Jun 14, 2014
Prepare a bunch of text for being read out loud by Festival TTS.
#!/usr/bin/env python3
import sys, re, os
from itertools import chain
# Maps various currency signs to their names.
# TODO: collect keys from this to build the currency regex.
CURRENCY_MAP = {'$': 'dollars', '£': 'pounds', '€': 'euro'}
# Maps certain suffixes with to full word equivalents
EXPONENT_MAP = {'b': 'billion', 'm': 'million', 'k': 'thousand', 't': 'trillion'}
FLamparski / drawer.js
Created Aug 2, 2014
A simple to use jQuery plugin for sliding drawers.
View drawer.js
// Declare the class
function Drawer($el, edge){
console.log('Drawer(%s)', edge);
this.$el = $el;
this.edge = edge;
this._edgeType = (function(edge){
if(edge === 'top' || edge === 'bottom'){
return 'h';
} else {
FLamparski /
Created Aug 10, 2014
Using SciPy, generate a Delaunay-triangulated mesh between randomly distributed points, and display it using pyglet.
#!/usr/bin/env python
# vim: et:ts=4:sw=4
import random, pyglet
from import *
from numpy import array
from scipy.spatial import Delaunay
N_POINTS = 200;
SCALE = 2;
FLamparski /
Created Jan 1, 2015
Get swatches from Adobe Color CC
from urllib.parse import parse_qs
from itertools import islice
def get_colors_from_kuler(kuler_url, count=5):
"""Get colors from a Adobe Kuler/Color CC URL.
You can't easily export these colour schemes, since the only
save feature Adobe implemented uses the Adobe account. However,
raw color values are stored in the URL in a somewhat unwieldy
but still straightforward format. Basically,
FLamparski / COPYING
Last active Aug 29, 2015
A CSS3 spinnin' loader.
The MIT License (MIT)
Copyright (c) 2015 Filip Wieland
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
FLamparski / gist:072f43cab3bab669c016
Created Apr 16, 2015
A function to serialise an object to JSON which also tries to pull in non-enumerable properties. Example usage: turning exceptions to JSON.
View gist:072f43cab3bab669c016
function serialiseAll(object) {
var properties = Object.getOwnPropertyNames(object);
var plainObject = _.reduce(properties, function(obj, prop) {
obj[prop] = object[prop];
return obj;
}, {});
return JSON.stringify(plainObject);
FLamparski / index.es6.html
Created Apr 16, 2015
Dynamically changing prototypes in Js
View index.es6.html
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Brian Blessed demo</title>
<style type="text/css">
.out {
font-weight: bold;
body {
FLamparski / first_class_fns.php
Created Sep 16, 2015
In PHP, functions "are" "first" "class" "objects"
View first_class_fns.php
// Psy Shell v0.4.4 (PHP 5.6.4-4ubuntu6.2 — cli) by Justin Hileman
>>> function foo($x) { return $x * 2; }
=> null
>>> foo(5)
=> 10
>>> is_callable(foo)
PHP error: Use of undefined constant foo - assumed 'foo' on line 1
>>> is_callable('foo')
=> true
>>> 'foo'(5)
FLamparski /
Created Sep 19, 2015
"Partial classes" in Java
public class Main {
#include ""
public static void main(String[] args) {
You can’t perform that action at this time.