Skip to content

Instantly share code, notes, and snippets.

@ssokolow
ssokolow / StyleSheet.css
Created July 27, 2011 23:49
Print CSS enhancements for TiddlyWiki
/* Blockquote margins are too fat */
.viewer blockquote { margin-left: 1em; }
.viewer blockquote blockquote { margin-left: 0.5ex; }
/* I think in-tiddler bordered elements (tables and pre blocks)
* should line up */
.viewer table, .viewer table.twtable { margin-left: 0.5em; }
/* Bullet my checklists with the checkboxes so they look nicer both
* on screen and in print */
@withakay
withakay / bjorklund.js
Created October 14, 2011 10:10
Bjorklund algorithm in JavaScript
/*
An implementation of the Bjorklund algorithm in JavaScript
Inspired by the paper 'The Euclidean Algorithm Generates Traditional Musical Rhythms'
by Godfried Toussaint

This is a port of the original algorithm by E. Bjorklund which I
found in the paper 'The Theory of Rep-Rate Pattern Generation in the SNS Timing Systems' by
E. Bjorklund.
@morehawes
morehawes / example-usage.html
Created December 2, 2011 12:46
HTML5 Markup Identify Bookmarklet
<a href="javascript:(function(){var f=document.getElementsByTagName("body")[0],b="article,aside,bdi,command,details,summary,figure,figcaption,footer,header,hgroup,mark,meter,nav,progress,ruby,rt,rp,section,time,wbr,audio,video,source,embed,track,canvas".split(",");for($x in b){var c=f.getElementsByTagName(b[$x]);if(c)for($y=0;$y<c.length;$y++){var a=c[$y];a.setAttribute("style","-moz-box-shadow:inset 0 0 2px red;-webkit-box-shadow:inset 0 0 2px red;box-shadow:inset 0 0 1px red;");var d=0,e=0;if(a.offsetParent){do d+= a.offsetLeft,e+=a.offsetTop;while(a=a.offsetParent)}var a=document.createElement("a"),g=document.createTextNode(b[$x]);a.appendChild(g);a.setAttribute("href","http://dev.w3.org/html5/markup/"+b[$x]+".html");a.setAttribute("target","_blank");a.setAttribute("style","position:absolute;left:"+d+"px;top:"+e+"px;padding:2px;color:white;z-index:1000000;background:red;");f.appendChild(a)}}})();">Run Bookmarklet</a>
@shiawuen
shiawuen / index.html
Created December 29, 2011 15:05
Sample to upload file by chunk
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>test upload by chunk</title>
</head>
<body>
<input type="file" id="f" />
<script src="script.js"></script>
@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@jordanorelli
jordanorelli / receive.ck
Created January 18, 2013 22:21
polyphonic theremin for LEAP with Python and ChucK
class Voice {
int id; // id of the finger on the leapmotion
OscRecv in; // inbound communication
ADSR env => Pan2 pan => dac; // setup an ADSR envelope
Osc @ osc; // reference to the current oscillator
float x;
float y;
float z;
0 => int state;
@creaktive
creaktive / tinyp2p-annotated.py
Last active February 13, 2019 11:18
tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)
# tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html)
# (C) 2004, E.W. Felten
# license: http://creativecommons.org/licenses/by-nc-sa/2.0
# Annotated by Kochin Chang, Jan. 2005
# Usage:
# Server - python tinyp2p.py password server hostname portnum [otherurl]
@willurd
willurd / web-servers.md
Last active April 28, 2024 21:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@Uberi
Uberi / Speech Recognition.ahk
Created August 18, 2013 20:29
Speech recognition with Microsoft's SAPI. A simple SpeechRecognizer class provides a quick and easy way to use speech recognition in your scripts. Inspired by some [prototype code](http://www.autohotkey.com/board/topic/24490-voice-recognition-com/) made a long time ago.
#NoEnv
#Warn All
#Warn LocalSameAsGlobal, Off
#Persistent
/*
Speech Recognition
==================
A class providing access to Microsoft's SAPI. Requires the SAPI SDK.
@kastnerkyle
kastnerkyle / dhmm.py
Last active September 4, 2019 18:59
Discrete hmm implementation - for learning purposes only!
# (C) Kyle Kastner, June 2014
# License: BSD 3 clause
import numpy as np
class dhmm:
def __init__(self, n_states, initial_prob=None,
n_iter=100, random_seed=1999):
# Initial state probabilities p(s_0)=pi[s_0].