Skip to content

Instantly share code, notes, and snippets.

View siddMahen's full-sized avatar

Siddharth Mahendraker siddMahen

  • Toronto, Canada
View GitHub Profile
@siddMahen
siddMahen / msgpack-test.js
Created May 23, 2013 17:07
msgpack.js test
var msgpack = require("../"),
pack = msgpack.pack.pure,
unpack = msgpack.unpack.pure,
assert = require("assert");
function genObj(type, size){
var obj;
switch(type){
case "raw":
@siddMahen
siddMahen / msgpack.js
Last active December 17, 2015 15:19
msgpack.js rewrite, copyright Siddharth Mahendraker, MIT License
// make everything legible
var MSG_PACK_POS_FIXNUM = 0x00,
MSG_PACK_MAP_FIX = 0x80,
MSG_PACK_ARRAY_FIX = 0x90,
MSG_PACK_RAW_FIX = 0xa0,
MSG_PACK_NIL = 0xc0,
MSG_PACK_FALSE = 0xc2,
MSG_PACK_TRUE = 0xc3,
MSG_PACK_FLOAT = 0xca, /* Not supported */
@siddMahen
siddMahen / matroid.md
Last active December 17, 2015 05:49
matroid applications

Applications of Matroid Theory

Creating NP-hard Problems

Solving interesting Problems

Using matroids to solve subset sum.

The (Decision) Subset Sum Problem:
@siddMahen
siddMahen / ml-notes.md
Last active November 11, 2022 13:09
Machine Learning Notes

Machine Learning Notes

Arthur Samuel (1959): Field of study that gives computers the ability to learn without being explicitly programmed.

  • Checkers playing computer

Well-posed Learning problem: A computer program is said to learn from experience E with respect to some task T and some performance measure P, if its performance T, as measured by P, improves with experience E.

Intro

@siddMahen
siddMahen / algorithms-design-and-analysis-part-1.md
Created December 16, 2012 19:50
Notes for the Coursera class Algorithms: Design and Analysis, Part 1.

Algorithms: Design and Analysis Part 1 - Notes

These are my personal notes about the course of the same name on Coursera. Feel free to fork these and make your own notes. I'm open to suggestions.

The sub-titles of these notes correspond roughly to a various group of lectures for each week, however, I do occasionally stray for the sake of clarity.

@siddMahen
siddMahen / .vimrc
Created November 10, 2012 22:20
My .vimrc
set nocompatible
set backupdir=~/.vim/backups
set undofile
set undodir=~/.vim/undo " remember undos across sessions
set noswapfile
" ----------------------------------------------------------------------------
" Text Formatting
" ----------------------------------------------------------------------------
@siddMahen
siddMahen / breaker.js
Created April 4, 2012 17:11
Finds Letter Frequencies In Text And Outputs Likely Letters
var freq = require("freq"),
fs = require("fs"),
eng = {
'e': 13.11,
't': 10.47,
'a': 8.15,
'o': 8.00,
'n': 7.10,
'r': 6.83,
'i': 6.35,
@siddMahen
siddMahen / sbox.js
Created April 4, 2012 16:45
Find Linear Patterns in 16x16 bit S-Boxes
// Useful when performing linear cryptanalysis of block ciphers w/ S-Boxes
// Example S-Boxes used in the GHOST algorithm
var sb1 = [ 4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3 ],
sb2 = [ 14, 11, 4, 12, 6, 13, 15, 10, 2, 3, 8, 1, 0, 7, 5, 9 ],
sb3 = [ 5, 8, 1, 13, 10, 3, 4, 2, 14, 15, 12, 7, 6, 0, 9, 11 ],
sb4 = [ 7, 13, 10, 1, 0, 8, 9, 15, 14, 4, 6, 12, 11, 2, 5, 3 ],
sb5 = [ 6, 12, 7, 1, 5, 15, 13, 8, 4, 10, 9, 14, 0, 2, 11, 2 ],
sb6 = [ 4, 11, 10, 0, 7, 2, 1, 13, 3, 6, 8, 5, 9, 12, 15, 14 ],
sb7 = [ 13, 11, 4, 1, 3, 15, 5, 9, 0, 10, 14, 7, 6, 8, 2, 12 ],
sb8 = [ 1, 15, 13, 0, 5, 7, 10, 4, 9, 2, 3, 14, 6, 11, 8, 12 ];
@siddMahen
siddMahen / crypto.j
Created March 1, 2012 14:14
ECC primitives for Julia
# Eliptic Curve Cryptography w/ Julia!
abstract EC
## The point O found at every horizontal line
type ECInf <: EC
end
## Points on the curve
@siddMahen
siddMahen / update_node.sh
Created February 24, 2012 22:36
Gets the specified version of node.js and installs it
#!/bin/bash -e
# Installs the specified version of node.js
# Usage:
# node_update [v]0.0.0
base_dir=$HOME/GitProjects
restore=$PWD
if [ $# -ne 1 ]