Skip to content

Instantly share code, notes, and snippets.

View creationix's full-sized avatar
💚
<3

Tim Caswell creationix

💚
<3
View GitHub Profile
#define RSA_BITS 2048
#define RSA_BYTES (RSA_BITS/8)
#define DIGIT uint32_t
#define DIGIT_BITS (sizeof(DIGIT)*8)
#define DIGIT_MAX ((DIGIT)(-1))
#define NDIGITS (RSA_BITS/DIGIT_BITS)
static int b_add(DIGIT * restrict r, DIGIT * restrict x, DIGIT * restrict y)
{
------------------------------------
-- basic TLS/SSL3.1 implementation
-- $Id: ssl.lua,v 1.13 2006-12-02 21:25:58 kt Exp $
------------------------------------
require "clua"
require "util"
@wolfeidau
wolfeidau / systemtap.md
Last active October 29, 2018 15:43
Configuring system tap on ubuntu 13.04, yeah so it will work.. like at all..
  • Install a base server with open ssh server enabled.
  • Update the OS.
sudo apt-get update
sudo apt-get upgrade
  • Install developement tools.
@hnakamur
hnakamur / gist:3568370
Created September 1, 2012 09:37
how to build luvit on windows7 x64
# how to build luvit on windows7 x64
## setup msysgit
http://code.google.com/p/msysgit/
download and execute
Git-1.7.11-preview20120710.exe
installation target: C:\msysgit
local Path = require('path')
local FS = require('fs')
local function search(code, pattern)
local data = {}
for pos, k, v in code:gmatch(pattern) do
local sub = code:sub(1, pos)
local comment = sub:match("\n-- ([^\n]+)\n$")
if not comment then
local long = sub:match("\n--%[(%b[])%]\n$")
@creationix
creationix / twostep.js
Created December 27, 2011 17:56
Request for Comments on new API for Step
module.exports = TwoStep;
var slice = Array.prototype.slice;
function Group(callback) {
this.args = [null];
this.left = 0;
this.callback = callback;
this.isDone = false;
}
@creationix
creationix / route.js
Created December 5, 2011 19:12
Sanity check for async template idea
Creationix.route("GET", "/", function (req, res, params, next) {
render("frontindex", {
title: query("index", "title"),
links: query("index", "links"),
articles: loadArticles
}, function (err, html) {
if (err) return next(err);
res.writeHead(200, {
"Content-Length": Buffer.byteLength(html),
"Content-Type": "text/html; charset=utf-8"
@creationix
creationix / glmatrix.js
Created August 30, 2011 21:17
Spinning cube and pyramid in node webgl
// glMatrix v0.9.5
glMatrixArrayType=typeof Float32Array!="undefined"?Float32Array:typeof WebGLFloatArray!="undefined"?WebGLFloatArray:Array;vec3={};vec3.create=function(a){var b=new glMatrixArrayType(3);if(a){b[0]=a[0];b[1]=a[1];b[2]=a[2]}return b};vec3.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};vec3.add=function(a,b,c){if(!c||a==c){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2];return a}c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];return c};
vec3.subtract=function(a,b,c){if(!c||a==c){a[0]-=b[0];a[1]-=b[1];a[2]-=b[2];return a}c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];return c};vec3.negate=function(a,b){b||(b=a);b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];return b};vec3.scale=function(a,b,c){if(!c||a==c){a[0]*=b;a[1]*=b;a[2]*=b;return a}c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;return c};
vec3.normalize=function(a,b){b||(b=a);var c=a[0],d=a[1],e=a[2],g=Math.sqrt(c*c+d*d+e*e);if(g){if(g==1){b[0]=c;b[1]=d;b[2]=e;return b}}else{b[0]=0;b[1]=0;b[2]=0;return b}g=1/g;b[0]=c*g;b[1]=d*g;b[2]=e*g;return b};vec3.cross=function(a,b,c
@creationix
creationix / custommain.js
Created July 16, 2011 19:54
A proposed hook into node.js to make deploying node based applications easy and not require re-compiles.
startup.customRuntimeMain = function () {
var path = NativeModule.require('path');
var custom = path.resolve(process.cwd(), process.argv[0] + ".js");
if (!path.existsSync(custom)) return;
process.argv[1] = custom;
};