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 GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE BangPatterns #-} | |
{-# LANGUAGE Rank2Types #-} | |
import Control.Concurrent (ThreadId, forkIO, myThreadId, killThread) | |
import Control.Exception (Exception, SomeException, throwIO, throwTo, catch, mask, uninterruptibleMask) | |
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 #-} -- only used in the example | |
import Control.Concurrent (forkIO, forkFinally, killThread) | |
import Control.Concurrent.MVar (newEmptyMVar, tryPutMVar, takeMVar) | |
import Control.Monad (void) | |
import Control.Exception (mask, uninterruptibleMask_, onException, finally) | |
import Network.HTTP.Types.Status (status200) -- only used in the example | |
import Network.Wai (Application, responseLBS) -- only used in the example | |
import Network.Wai.Handler.Warp (Settings, runSettings, defaultSettings, setHost, setInstallShutdownHandler, setGracefulShutdownTimeout) |
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 TemplateHaskell #-} | |
{-# LANGUAGE LambdaCase #-} | |
module ConstructorType (constructorType) where | |
import Control.Monad (replicateM) | |
import Data.Char (toLower) | |
import Data.List (unfoldr, foldl1') | |
import Language.Haskell.TH |
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
#!/usr/bin/env nix-shell | |
#!nix-shell --pure -i runhaskell -p "haskellPackages.ghcWithPackages (p: [p.wai p.warp p.http-types p.stm p.async])" | |
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Control.Concurrent.Async as Async | |
import qualified Control.Concurrent.STM as STM | |
import qualified Network.HTTP.Types as HTTP | |
import qualified Network.Wai as Wai |
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
#!/usr/bin/env nix-shell | |
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (p: [p.async p.stm p.dimensional p.asciichart p.foldl])" | |
{-# OPTIONS_GHC "-Wno-missing-signatures" #-} | |
{-# LANGUAGE NamedFieldPuns #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE NumericUnderscores #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE DataKinds #-} -- Only to write down some types. Not doing anything fancy here. |
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
#!/usr/bin/env python | |
import os | |
import sys | |
import argparse | |
import subprocess | |
desc = ''' | |
run a program in a modified environment | |
example: run a tiny python script that reads the value of the variable "FOO" |
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
#!/usr/bin/env nix-shell | |
#!nix-shell --pure -i runhaskell -p "haskellPackages.ghcWithPackages (p: [p.doctest p.parsec])" | |
{-# LANGUAGE CPP #-} | |
{-# OPTIONS_GHC "-Wall" #-} | |
import Test.DocTest (doctest) | |
import Text.Printf (printf) | |
import qualified Text.Parsec as P | |
import qualified Text.Parsec.Char as PC |
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
#!/usr/bin/env python3 | |
import sys | |
import csv,io | |
import argparse | |
import collections | |
class Wakeups: | |
status_prop = 'Status' | |
def __init__(self, path): |