Skip to content

Instantly share code, notes, and snippets.

@seri
seri / runner.sh
Created February 6, 2015 06:58
runner.sh Feb 06, 2005
# runner.sh mode /path/to/solver /path/to/input/dir /path/to/output/dir
# mode = quiet|verbose|file
mode="$1"
solver="$2"
data_d="$3"
output_d="$4"
ostream=/dev/null
command_exists () {
@seri
seri / BestApproximationDiv2.hs
Created June 28, 2011 04:06
Haskell solution to TopCoder's BestApproximationDiv2 problem
import Data.Char
import Data.List
import Data.Maybe
showResult :: (Int, Int, Int) -> String
showResult (a, b, x) = show a ++ "/" ++ show b ++ " has "
++ show x ++ " exact digits"
compareDigits :: [Int] -> [Int] -> Ordering
compareDigits xs [] = EQ
@seri
seri / LuckyRemainder.hs
Created June 28, 2011 03:52
Haskell solution to TopCoder's Lucky Remainder problem
import Data.Char
pow2mod9 :: Int -> Int
pow2mod9 0 = 1
pow2mod9 1 = 2
pow2mod9 2 = 4
pow2mod9 3 = 8
pow2mod9 4 = 7
pow2mod9 5 = 5
pow2mod9 n = pow2mod9 $ mod n 6
@seri
seri / facebook.css
Created April 29, 2011 08:57
Stylish rule for Facebook
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("facebook.com") {
body, .fsm, #pagelet_stream_header, .uiStream .uiStreamMessage, textArea, .inputtext, .inputpassword, .uiLinkButton input, .notesBlogText, .notesBlogText p, .uiHeaderTitle .fcg, .uiHeaderTop, td.data
{
font-size: 12px !important;
}
#pagelet_stream_header .uiHeaderActions, #pagelet_stream_header .uiButtonText
{
font-size: 15px !important;
@seri
seri / tor.pac
Created April 29, 2011 08:08
Proxy auto-config rule to access Facebook through Tor
function FindProxyForURL(url, host)
{
if (shExpMatch(host, "*.facebook.com") ||
shExpMatch(host, "facebook.com") ||
shExpMatch(host, "static.ak.fbcdn.net"))
return "SOCKS4 127.0.0.1:9050";
else
return "DIRECT";
}
@seri
seri / ultrasurf.pac
Created April 29, 2011 08:05
Proxy auto-config rule to access Facebook through Ultrasurf
function FindProxyForURL(url, host)
{
if (shExpMatch(host, "*.facebook.com") ||
shExpMatch(host, "facebook.com") ||
shExpMatch(host, "static.ak.fbcdn.net"))
return "PROXY 127.0.0.1:9666";
else
return "DIRECT";
}