Skip to content

Instantly share code, notes, and snippets.

View gsingh93's full-sized avatar

Gulshan Singh gsingh93

View GitHub Profile
import Graphics.Input.Field as Field
import Graphics.Input as Input
import Http
import String
import Text
import Window
main : Signal Element
main = merge ui <| asText <~ getLogin redirect
@gsingh93
gsingh93 / hw1.hs
Last active August 29, 2015 14:02
CIS194 HW 1
-- Problem set: http://www.seas.upenn.edu/~cis194/hw/01-intro.pdf
-- I wonder how I'd define this without toDigitsRev...
toDigits :: Integer -> [Integer]
toDigits x = reverse $ toDigitsRev x
toDigitsRev :: Integer -> [Integer]
toDigitsRev x | x <= 0 = []
toDigitsRev x = x `mod` 10 : toDigitsRev (x `div` 10)
@gsingh93
gsingh93 / segment_tree.rs
Last active October 27, 2016 13:38
Segment tree implementation in Rust
use std::fmt::Show;
use std::default::Default;
use std::ops::Add;
struct SegmentTree<T> {
size: uint,
root: Node<T>
}
struct Node<T> {
@gsingh93
gsingh93 / keybase.md
Last active August 29, 2015 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am gsingh93 on github.
  • I am gsingh93 (https://keybase.io/gsingh93) on keybase.
  • I have a public key whose fingerprint is B879 539A 0D22 4163 A943 346C 98BE 0440 7ADF 94FB

To claim this, I am signing this object:

@gsingh93
gsingh93 / heartbleed.py
Last active August 29, 2015 13:58
OpenSSL Heartbleed Exploit
#!/usr/bin/python2
import sys
import select
import socket
import struct
port = 443
TLS_ALERT = 21
@gsingh93
gsingh93 / comptime
Created August 29, 2013 23:28
Compare the running times of two programs
#!/bin/bash
prog1=$1
prog2=$2
num_times=${3:-10}
calculate_mean() {
sum=0
for n in $@; do
sum=$(($sum+$n))