Skip to content

Instantly share code, notes, and snippets.

@mkscrg
mkscrg / .gitignore
Last active August 7, 2018 17:31
gcloud app deploy fails with google.golang.org dependencies
.sdk/

Slack logs to Postgres

Export the Slack team's public logs. You'll get a directory with a users.json file and a directory for each channel e.g. wheelhouse/.

Use jq to pull the JSON objects out of the root array:

cat users.json | jq -c '.[]'
{
"brightray": {
"devtools": {
"preferences": {
"hideNetworkMessages": "true"
}
}
}
}
wspq-repro.cabal
.stack-work/
import ClassyPrelude
import Data.Proxy (Proxy (..))
import GHC.Exts (Any, Constraint)
import GHC.TypeLits
import Unsafe.Coerce (unsafeCoerce)
newtype TMap (map :: TMap_) = TMap (HashMap Text Any) -- daaanger zone
@mkscrg
mkscrg / Main.hs
Last active March 11, 2016 03:49
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Concurrent
import Control.Monad
{-
ghc --make Main.hs
./Main
-}
.stack-work/
@mkscrg
mkscrg / newcabal.sh
Created December 26, 2013 22:56
Start a new Cabal project with minimal sane defaults.
#!/usr/bin/env bash
set -e
template='name: $$NAME$$
version: 0.0.0
build-type: Simple
cabal-version: >= 1.9.2
executable $$NAME$$
main-is: Main.hs
@mkscrg
mkscrg / serve.sh
Created December 23, 2013 03:21
Serve a directory on a port with Nginx, with access logs to STDOUT and error logs to STDERR.
#!/usr/bin/env bash
set -e
usage() {
echo "usage: serve PORT [DIR]"
exit 1
}
conf_template='
worker_processes 1;
module Main where
import Data.Char
import Data.List
main :: IO ()
main = print $ wordIndexes "Hello test World"
wordIndexes :: String -> [(Int, String)]