Skip to content

Instantly share code, notes, and snippets.

Konrad kgadek

Block or report user

Report or block kgadek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bumpme
Wed Jan 16 16:30:53 UTC 2019
View core.hs
stuff :: Maybe Int
stuff = return (456 :: Int)
main :: IO ()
main = do
let Just x = stuff
print x
View harrop_ghc.hs
-- stack --resolver nightly-2017-02-08 ghc --package hashtables -- -O2 harrop_ghc.hs
import Control.Monad
import qualified Data.HashTable.IO as H
type HashTable k v = H.BasicHashTable k v
main = do
m <- H.new :: IO (HashTable Int Int)
forM_ [1..10000000] $ \n -> H.insert m n n
v <- H.lookup m 100
View stuff.hs
runWithMock :: MockDirectoryTree -> FSops r -> [String]
runWithMock mockTree = cata eval
where
eval :: TF.FreeF FSopsF r [String] -> [String]
eval (TF.Free x@ListDir{}) = msg : cont
where
msg = printf "LISTDIR: %s\n RESULT: %s\n" (x ^. dirName) (show dirListing)
dirListing = DirectoryListing immediateDirs immediateFiles
immediateDirs = mockTree ^.. unFix2 . mDirs . each . rootDirName
immediateFiles = mockTree ^. unFix2 . mFiles
View imad.sh
# Przygotowanie
xcode-select --install # akceptacja licencji Xcode
curl -sSL https://get.haskellstack.org/ | sh # alternatywnie: brew install haskell-stack
git clone https://github.com/kgadek/novelist.git
cd novelist
stack setup # instalacja kompilatora lokalnie, w ~/.stack
stack build --bench --no-run-benchmarks # kompilacja programu
# Uruchamianie testów
stack bench
@kgadek
kgadek / 0_reuse_code.js
Created Nov 21, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kgadek
kgadek / anaconda-ks.cfg
Last active May 28, 2016
Simple kickstart for VMs (insecure as hell)
View anaconda-ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use network installation
url --url="http://mirror.onet.pl/pub/mirrors/centos/7/os/x86_64"
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
View docker-compose.yml
pyserver:
restart: "always"
build: ./src
ports:
- 8042:8042
links:
- dbserver:dbserver
env_file: .env
command: python /usr/src/app/server.py
@kgadek
kgadek / docker.service.diff
Created Mar 6, 2016
Fix for docker.service SystemD unit file /etc/systemd/system/docker.service
View docker.service.diff
diff --git a/docker.service b/docker.service
index 3695d53..df0e3e9 100644
--- a/docker.service
+++ b/docker.service
@@ -1,5 +1,5 @@
[Service]
-ExecStart=/usr/bin/docker -d -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=azure
+ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=azure
MountFlags=slave
LimitNOFILE=1048576
View gist:c06def3accc207df94c8
server {
listen 443 ssl;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /path/to/signed_cert_plus_intermediates;
ssl_certificate_key /path/to/private_key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
You can’t perform that action at this time.