Skip to content

Instantly share code, notes, and snippets.

View sajith's full-sized avatar
😼
Why would I want to set a status on GitHub?

Sajith Sasidharan sajith

😼
Why would I want to set a status on GitHub?
View GitHub Profile
@sajith
sajith / loadtimes.m
Created May 17, 2012 20:04
silly Matlab function to show load times of .mat files under a directory
function loadtimes ( dirname )
if isempty ( dirname ), return, end
cmd = sprintf ( 'find %s -iname "*.mat"', dirname );
[ ~, files ] = system ( cmd );
mfiles = regexp ( files, '\n', 'split');
for i = 1 : length ( mfiles ) - 1
s1 = sprintf ( '%s', mfiles{i} );
s = regexprep ( s1, ',$', '' );
sajith@wheezy:~$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1
sajith@wheezy:~$ ghc-pkg list
/var/lib/ghc/package.conf.d
Cabal-1.14.0
GLUT-2.1.2.2
HTTP-4000.2.3
HUnit-1.2.4.2
MonadCatchIO-mtl-0.3.0.4
OpenGL-2.2.3.1
@sajith
sajith / ciphers
Created October 27, 2014 09:28
openssl ciphers | sed 's/:/\n/g'
ECDHE-RSA-AES256-GCM-SHA384
ECDHE-ECDSA-AES256-GCM-SHA384
ECDHE-RSA-AES256-SHA384
ECDHE-ECDSA-AES256-SHA384
ECDHE-RSA-AES256-SHA
ECDHE-ECDSA-AES256-SHA
SRP-DSS-AES-256-CBC-SHA
SRP-RSA-AES-256-CBC-SHA
SRP-AES-256-CBC-SHA
DHE-DSS-AES256-GCM-SHA384
@sajith
sajith / keybase.md
Created April 22, 2015 23:47
keybase.io claim

Keybase proof

I hereby claim:

  • I am sajith on github.
  • I am sajith (https://keybase.io/sajith) on keybase.
  • I have a public key whose fingerprint is 22D9 BFBA 256B 7BFA 7B16 187C 0C6D A6A2 9D5F 02BA

To claim this, I am signing this object:

module Forever where
import Control.Concurrent (threadDelay)
import Control.Monad (forever)
loop :: Integer -> IO ()
loop i = forever (print i >> threadDelay (10^4) >> loop (i+1))
-- copied from Network.Mail.Mime
module RandomStr where
import Control.Arrow (first)
import Data.List (nub)
import System.Random
randomString :: RandomGen d => Int -> d -> (String, d)
{-# LANGUAGE PackageImports #-}
-- Fails with "*** Exception: NeedsInfiniteSeed"
module RandomStr2 where
import "crypto-api" Crypto.Random
import "crypto-api" Crypto.Types
import Data.ByteString.Char8 as B
import System.Entropy
module RandomStr3 where
-- uses mwc-random for making random strings
import Data.List (nub)
import Data.Text as T (Text, pack)
import qualified Data.Vector.Unboxed as V (Vector, map, toList)
import Data.Word (Word8)
import System.Random.MWC (asGenST, uniformVector, withSystemRandom)
module RandomStr4 where
-- uses `random` package
import Data.List as L
import Data.Text as T
import System.Random (RandomGen, newStdGen, randomRIO, randomRs)
------------------------------------------------------------------------
@sajith
sajith / randomstr5.hs
Last active February 25, 2016 19:26
make a random text token, using MonadRandom and friends
module RandomStr5 where
-- uses `MonadRandom` package
import Control.DeepSeq (force)
import Control.Monad (liftM)
import Control.Monad.Random (evalRandIO, getRandoms)
import Data.List (nub)
import Data.Text (Text, pack)