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
""" | |
Or should i use bass-ackwards definitions?.. http://pika.readthedocs.org/en/0.9.6/examples/comparing_publishing_sync_async.html | |
""" | |
import pika | |
pika_conn = 'amqp://guest:guest@localhost:5672/%2F' | |
def call(uri, service, method, **query): |
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
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, TypeSynonymInstances, FlexibleInstances, UndecidableInstances #-} | |
module PGSParseable where | |
import qualified Data.Attoparsec.Text as AP | |
import Data.Typeable (Typeable) | |
import qualified Data.Text as T | |
import Data.Text (Text) | |
import Data.Text.Encoding (decodeUtf8) |
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 logging | |
import pika | |
from myjson import json_dumps | |
LOGGING = { | |
'version': 1, | |
'handlers': { | |
'amqp': { | |
'()': 'utils.log.PikaHandler', |
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
module Main where | |
import System.Environment (getArgs) | |
import Control.Monad | |
import qualified Data.ByteString.Lazy.Char8 as BSL | |
import Network.AMQP | |
connect = do |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Web.Scotty | |
import Control.Monad | |
import Control.Monad.Trans | |
import qualified Control.Monad.Trans.Resource as RT | |
import Control.Concurrent (threadDelay) |
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
# 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), |
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
grep '"model": "' dump.json | sort | uniq -c | sort -nr |
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
{-# 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 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
{-# 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 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
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 |