This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff -ru scrypt-0.5.3/src/scrypt2.c scrypt-mod/src/scrypt2.c | |
| --- scrypt-0.5.3/src/scrypt2.c 2011-02-19 06:56:07.000000000 -0800 | |
| +++ scrypt-mod/src/scrypt2.c 2012-05-12 01:19:06.933753937 -0700 | |
| @@ -27,6 +27,7 @@ | |
| #include <Python.h> | |
| #include "scryptenc/scryptenc.h" | |
| +#include "crypto/crypto_scrypt.h" | |
| static PyObject *ScryptError; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # (gdb) python execfile ("/home/kcantu/Desktop/gdbScripts/ff.py") | |
| # given address as string | |
| def contentOfStr (addy): | |
| return gdb.parse_and_eval ('({nsIContent} ' + addy + ')') | |
| # given content as gdb.Value | |
| def nameOfContent (content): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ramanujan's PI algorithm, per Think Python | |
| # | |
| # >>> execfile("C:/[snip]/Desktop/ramanujan.py") | |
| # >>> rpi() | |
| import math | |
| def rpi (): | |
| k = 0 | |
| estimate = 0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- snip | |
| updateStatus :: Token -> String -> IO () | |
| updateStatus token status = runOAuthM token $ do | |
| _ <- doRequest POST "statuses/update" [("status",status)] | |
| return () | |
| data StatusAttr = ReplyTo String | |
| | LatLon Double Double | |
| | PlaceID String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Test for a point within a polygon | |
| -- http://rosettacode.org/wiki/Ray-casting_algorithm#Haskell | |
| import Data.Ratio | |
| type Point = (Rational, Rational) | |
| type Polygon = [Point] | |
| data Line = Sloped {lineSlope, lineYIntercept :: Rational} | | |
| Vert {lineXIntercept :: Rational} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Kevin Cantu | |
| -- April 2012 | |
| import Control.Monad (when) | |
| import Data.Map (Map) | |
| import Data.List | |
| import Data.List.Split | |
| import qualified Data.Map as M | |
| import System.Environment | |
| import System.IO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sed -e 's/,/;/' $1 | awk '{FS=";"; count[$2]++} END {for (jj in count) print ""count[jj]";",jj }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Kevin Cantu | |
| -- April 2012 | |
| -- Count location | |
| -- | |
| -- runtime: 16s on one million lines of CSV | |
| -- infinity secs on 3 million lines (RAM blows up) | |
| -- (ip,lat.000,lon.000) | |
| import Control.DeepSeq | |
| import Control.Monad (when) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Text.CSV | |
| loadCSV = | |
| do | |
| eitherRecs <- parseCSVFromFile "sample.csv" | |
| let records = case eitherRecs | |
| of Left e -> error . show $ e | |
| Right recs -> recs | |
| return records |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Map (Map) | |
| import Data.List | |
| import qualified Data.Map as M | |
| newMap :: Map (Int, Int) (Int, [Int]) | |
| newMap = M.fromList [] | |
| updateMap key size = | |
| M.insertWith' ins key (fromSingleVal size) | |
| where |