Skip to content

Instantly share code, notes, and snippets.

View bluesmoon's full-sized avatar

Philip Tellis bluesmoon

View GitHub Profile
@bluesmoon
bluesmoon / test-cipher.js
Created July 26, 2012 19:47
Test Node.js Cipher implementation.
crypto=require("crypto");
assert=require("assert");
data = [
// 0. Short key, short data, ascii data, hex output
{ k: "abcde", d: "foobar", enc_in: "ascii", enc_out: "hex" },
// 1. Long key, short data, ascii data, hex output
{ k: "abcdefabcdefabcdeabcdefabcdefabcdeabcdefabcdefabcdeabcdefabcdefabcdef", d: "foobar", enc_in: "ascii", enc_out: "hex" },
// 2. Long key, long data, ascii data, hex output
@bluesmoon
bluesmoon / stddev-fast
Created April 25, 2012 15:57
Fast calculation of stddev
Datum: x
Size: n
Mean: m
variance = sum((x-m)^2)/n
= (x0-m)^2 + (x1-m)^2 + (x2-m)^2 ...
----------------------------------
n
@bluesmoon
bluesmoon / LICENSE.txt
Created October 18, 2011 16:58 — forked from aemkei/LICENSE.txt
JS ASCII Logo - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@bluesmoon
bluesmoon / gist:774939
Created January 11, 2011 19:08
Measure page generation time using boomerang
<?php
$t_serverstart = microtime(true);
// rest of page generation goes in here
$t_serverend = microtime(true);
?>
<script type="text/javascript">
BOOMR.plugins.RT.setTimer("t_pagegen", <?php echo $t_serverend - $t_serverstart; ?>);
</script>
// Constructor
HTML.Template({
tmpl_str: tmpl,
OR
file_url: foo,
file_type: tmpl|js,
});
// Setting
HTML.Template.param({
@bluesmoon
bluesmoon / gist:69587
Created February 24, 2009 14:33
TMPL_VAR usage
<TMPL_VAR name="foo" default="bar" escape="html|url|js|none">