This file contains 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
alias psg="ps aux|head -n1; ps aux | egrep -v 'egrep --color' | egrep --color=auto -i --color" |
This file contains 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
# https://github.com/kennethreitz/requests/issues/30#issuecomment-3631717 | |
def with_cert(session, key, cert=None): | |
"Monkeypatch session pool manager with client cert stuff" | |
session.poolmanager = session.poolmanager.__class__( | |
key_file = key, | |
cert_file = cert or key, | |
**session.poolmanager.connection_pool_kw) |
This file contains 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
-- https://gist.github.com/1967358 | |
import XMonad | |
import XMonad.Config.Xfce | |
import XMonad.Util.CustomKeys | |
import qualified Data.Map as M | |
main = xmonad xfceConfig { | |
modMask = mod4Mask, |
This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Happstack.Server | |
import Control.Monad.Reader | |
import qualified Data.ByteString.Char8 as C | |
myApp :: AppMonad Response | |
myApp = do | |
-- access app config. look mom, no lift! |
This file contains 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
main :: IO () | |
main = scotty 3000 app | |
app :: ScottyM () | |
app = do | |
rcon <- liftIO $ R.connect R.defaultConnectInfo {R.connectPort = R.UnixSocket "redis.sock"} | |
get "/favicon.ico" $ html "ಠ_ಠ" | |
get "/:method" $ do |
This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
module Focus.Auth where | |
import qualified Database.Redis as R | |
import Crypto.BCrypt (validatePassword, hashPasswordUsingPolicy, fastBcryptHashingPolicy) | |
import Data.ByteString.Char8 (ByteString) | |
import qualified Data.ByteString.Char8 as BS | |
import Control.Monad.Trans (liftIO) |
This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
import Prelude hiding (concat) | |
import Data.ByteString.Char8 hiding (putStrLn) | |
import qualified Data.List as L | |
import Data.List.Split (chunk, splitOn) | |
import qualified Database.Redis as R | |
import System.IO (withFile, hFlush, Handle, IOMode(ReadWriteMode)) | |
import System.Environment (getArgs) |
This file contains 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
grep '"model": "' dump.json | sort | uniq -c | sort -nr |
This file contains 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
# http://en.wikibooks.org/wiki/Algorithm_Implementation/Checksums/Verhoeff_Algorithm#Python | |
verhoeff_table_d = ( | |
(0,1,2,3,4,5,6,7,8,9), | |
(1,2,3,4,0,6,7,8,9,5), | |
(2,3,4,0,1,7,8,9,5,6), | |
(3,4,0,1,2,8,9,5,6,7), | |
(4,0,1,2,3,9,5,6,7,8), | |
(5,9,8,7,6,0,4,3,2,1), | |
(6,5,9,8,7,1,0,4,3,2), |