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 / README.md
Created September 29, 2011 15:52
Prints the binomial expansion of any power.

Binomial Expansion Script

Run this file on the command line using the python command with the sole argument being the power of (x+y) you wish to expand.

Example:

python binomialexpansion.py 3

Will output:

@siddMahen
siddMahen / makefile
Created October 11, 2011 21:32
Printing Bits
CC = gcc
CFLAGS = -I.
test: main.o
$(CC) -o $@ $(CFLAGS) main.o
main.o: main.c
$(CC) -c main.c $(CFLAGS)
@siddMahen
siddMahen / coverage.js
Created December 14, 2011 21:15
Code Coverage in Javascript
/*
* Copyright (c) 2011, Chris Dickinson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@siddMahen
siddMahen / example.js
Created December 16, 2011 13:33
Renders htmlparser2 data into HTML
var render = require("./renderer");
// The output of parser.js
var t = [
{
data: 'Xyz ', type: 'text'
},
{
type: 'script',
@siddMahen
siddMahen / child-filters.js
Created December 26, 2011 16:30
Child Filters Impl
// Child filters - TBD
var filters = {
"nth-child": function(ctx, val){
var found = [],
val = val-1;
for(var j = 0; j < ctx.length; j++){
if(ctx[j][val])
found.push(ctx[j][val]);
@siddMahen
siddMahen / README.md
Created December 29, 2011 17:30
Looking for un-encrypted POST data

Proxy-hackz

This little script basically looks at it's traffic and prints the guts out of any passing POST bodies. Useful to help find out if your site (or a site you use) is leaking private data.

Setup

To set this up on Mac OSX, perform the following.

  1. Download the gist and run it using
@siddMahen
siddMahen / README.md
Created December 30, 2011 16:12
Quadratic equation solver

Quadratic Equation Solver

Run this on the command line using python, takes the a, b and c values of the quadratic as arguments:

python quad.py 1 1 0

The above would solve for:

x^2 + x = 0
@siddMahen
siddMahen / 6prime.py
Created December 30, 2011 20:20
Prints primes using 6x ± 1
# coding=UTF-8
import math
inv = 1
pc = 0
lmt = 1000000
while(inv < lmt):
pp = (6*inv) - 1
@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 ]
@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