Skip to content

Instantly share code, notes, and snippets.

View saml's full-sized avatar

Sam Lee saml

  • New York, NY
View GitHub Profile
{- ghc --make -O fib.hs
- ./fib <nth, such as 2607> <n-2 th fib> <n-1 th fib>
- example:
- ./fib 2583 180551925061996205582978676340396483148301922241771467739409810875233316279485917014169163475036188290260285027955156899207469403601685576648406557607174860852985399401107639843026289770321769850482975727659384712460509577795642089737397394352904471219631366377829901834818963919229137581230848941593109666718488092686220811682606140987563858018416173600757618522208289638064871472462821318933543944865008389403524910775693844630469532937155177666299240625507834460491424634356297396468525803122641719996486746805680623277512059420507512841 29213915148453382619770643454729323646182591326940549967552178533665648753001513803669379611171107451272838671563321495669318655152923317518222353213259480034523031276819224433781850604634057881145965902292368336120191757731114463832520739446393519012263120458900491697154020431596132425994354325644476612369308265226264772896718394945416546660262769912522615601585537137589644
@saml
saml / Server.hs
Created June 16, 2012 02:26
warp wai server echo request back
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai (
Middleware, Request,
httpVersion, rawPathInfo, pathInfo,
requestHeaders, requestMethod, Application, responseLBS
)
import Network.Wai.Handler.Warp (
import json
import csv
import sys
import codecs
import argparse
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
@saml
saml / start-jnpr-vpn.sh
Created August 3, 2012 11:10 — forked from oogali/start-jnpr-vpn.sh
Shell script to connect to Juniper SSL VPNs w/o need for a browser or Java
#!/bin/sh
##
## netscreen/jnpr ssl vpn connection magic
## [email protected] / @oogali
##
## i wrote this about a year ago (2009), when i had continuous access
## to a jnpr ssl vpn box and had to connect via it.
##
## if bits of this script are broken, i'll be glad to fix if someone
## gives me client access to a ssl vpn box to test against.
import sys
sys.setrecursionlimit(999999999)
class Solver(object):
def __init__(self, coins):
self.coins = coins
self.path = {}
self.memo = {}
def cost(self, cents):
if cents == 0:
@saml
saml / BlockAllButFelixFilter.java
Created August 21, 2012 20:37
cq5 block all but felix console servlet filter
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
<saml> hey i have an exciting idea to get rich
<saml> how can I do patent?
<saml> this will revolutionize food industry
<saml> and humanity
<centrinia> Let me guess: soylent greens.
<x[LGWs4x4i]uG2N0> is it disruptive
<saml> so microwaves will have barcode or qr code reader. frozen foods will have barcode for recipe. you put the food. press start. and food's ready
* desg_ ([email protected]) has joined ##proggit
<saml> soudns good right?
<sixthgear> yeah
ProxyPass / http://ec2-23-21-207-238.compute-1.amazonaws.com:4502/
ProxyPassReverse / http://ec2-23-21-207-238.compute-1.amazonaws.com:4502/
#!/bin/bash
pubkey_path="$1"
if (( $# < 1 ))
then
pubkey_path="$HOME/.ssh/id_rsa.pub"
fi
pubkey="$(cat "$pubkey_path")"
-module(tested).
-export([main/0]).
main() ->
io:get_line(""),
vfmul().
multiply(Line) ->
{X,[_|Ystr]} = string:to_integer(Line),
{Y,_} = string:to_integer(Ystr),