Skip to content

Instantly share code, notes, and snippets.

@passcod
passcod / PKGBUILD
Last active December 17, 2015 03:38 — forked from anonymous/PKGBUILD
Fixed mongoose PKGBUILD (project moved to github)
# Contributor: Leslie P. Polzer <polzer@gnu.org>
# Contributor: bender02 at archlinux dot us
# Contributor: Felix Saparelli <me@passcod.name>
pkgname=mongoose
pkgver=3.7
pkgrel=1
pkgdesc="Small and quick-to-use web server; https/php/cgi support"
arch=('i686' 'x86_64')
license=('MIT')
@passcod
passcod / dynojs.md
Last active December 16, 2015 04:59
Notes on Dyno.js

Default at 3 workers. (Most processors today on both desktop and mobile are quad-core, => 1 main thread + 3 workers). Spawn them immediately.

An actor is a single function. Prototype additions are not taken into account (not straightforward to serialise). It behaves like a function, but async: arguments you give to the actor are passed through unaltered (but they must comply with the serialisation restrictions).

There's two ways to signify completion and both are bubbled up as events: return something; and this.done(something);. The something argument is

@passcod
passcod / attention
Last active December 15, 2015 23:58
Obfuscated
Google's Closure Compiler
throws up if you give it this.
Just sayin'
var require('request');
var processFoo = function(arg) {
// do something
};
request('http://example.com', function(error, body, response) {
processFoo(response);
});
@passcod
passcod / delegate.js
Last active December 15, 2015 11:19
Delegated commands for jsBot
// Requires npm packages:
// request and underscore
var _ = require('underscore');
var request = require('request');
module.exports = function Module(bot) {
var delegates = {};
var say = function(client, to, message) {
bot.emit('command_say', client, bot.details.nick, to, message.split(' '));
@passcod
passcod / gist:5202890
Last active December 15, 2015 04:39
Linode datacenters ping and data tests, from home (Rural / Whangarei, NZ) and current vps (AWS / Sydney).
Ping => (-c 10, avg ms, lower is better)
From home: tokyo:379, london:449, newark:349, atlanta:206, dallas:179, fremont:174
From sydn: tokyo:116, london:392, newark:247, atlanta:219, dallas:242, fremont:190
----
Data => (20s, avg KB/s, higher is better)
From home: tokyo:170, london:457, newark:350, atlanta:461, dallas:560, fremont:616
From sydn: tokyo:2196, london:628, newark:2308, atlanta:766, dallas:1097, fremont:1413
[22:56:38] <Milos> what'as new
[22:56:40] <Milos> how was camp
[22:56:42] <Milos> whatcha coding
[22:56:47] <Milos> how's uni
[22:56:49] <Milos> whatcha studying
[22:56:53] <passcod> camp was sunny
[22:56:56] <unixbrain> !quotes * /.*/
[22:56:58] <woot> 2012-02-26 18:17:28 | <akiwiguy> my ups kicked in this morning
[22:57:14] <unixbrain> !quotes * /.*/
[22:57:16] <woot> 2012-01-06 16:01:47 | <spectre0> !calc (-9.551 + 0.819152a = 0.087156b + 28.98)
seq = (a, b = a) ->
if typeof a == "number" and (a == b or typeof b == "number")
if a != b
"(#{a}..#{b})"
else
"(0..#{a})"
else if typeof a != "string" or !rgx.test a or a == ""
"(0..1)"
else
[ok, start, end] = a.match rgx
@passcod
passcod / 1000.js
Last active December 14, 2015 00:38
var N = 1000,
digits = "",
sums = [],
i,l,n,sum,sub;
for (n = 1; n <= N; ++n) {
digits += Math.floor(Math.random() * 10);
}
for (n = 0; n <= (N-6); ++n) {
N = 100
digits = ""
sums = []
for n in [1..N]
digits += Math.floor Math.random() * 10
for n in [0..(N-6)]
sub = digits.substr n, 5
sum = 0