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 = do | |
evalContT $ do | |
a <- ContT $ withFile "a.txt" ReadMode | |
b <- ContT $ withFile "b.txt" ReadMode | |
aContents <- liftIO $ hGetContents a | |
bContents <- liftIO $ hGetContents b | |
liftIO . putStrLn $ "contents of a: " <> show aContents | |
liftIO . putStrLn $ "contents of b: " <> show bContents |
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
module Main (main) where | |
import Control.Exception (bracket, bracket_) | |
import Control.Monad (unless, when) | |
import Control.Monad.IO.Class () | |
import Control.Monad.Managed | |
import DearImGui | |
import DearImGui.OpenGL3 | |
import DearImGui.SDL | |
import DearImGui.SDL.Renderer |
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
import itertools | |
program = [2, 4, 1, 3, 7, 5, 0, 3, 1, 5, 4, 1, 5, 5, 3, 0] | |
rp = list(reversed(program)) | |
def calc(ta): | |
b = (ta & 0b111) ^ 0b011 # Look at the 3 rightmost bits of "ta" | |
c = ( |
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
type HashTable s k v = C.HashTable s k v | |
type Stone = Int | |
type Memo s = HashTable s (Stone, Int) Int | |
solvePart2 :: BS.ByteString -> Result | |
solvePart2 contents = | |
Result $ runST $ do | |
memo :: Memo s <- H.new |
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
module ModKeys where | |
import Data.Aeson | |
import Data.Text (Text) | |
import GHC.Generics (Generic) | |
import qualified Data.Aeson as Aeson | |
import qualified Data.ByteString.Lazy as LBS | |
import qualified Data.Text.Encoding as E | |
import qualified Data.Text.IO as TIO |
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
import Data.Sequence (Seq((:|>))) | |
import Data.Tree (Tree(..)) | |
import qualified Data.Sequence as Seq | |
foobar_test :: TestEnv () | |
foobar_test = do | |
tree :: Tree () <- liftIO . generate $ treeGen 50 `suchThat` ((>= 5) . length . flatten) | |
ugids <- createUserGroupTree tree | |
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
building the system configuration... | |
warning: Git tree '/home/jco/nixos-flake' is dirty | |
error: The ‘gnome.vte’ alias was removed on 2022-01-13. Please use ‘pkgs.vte’ directly. | |
… while evaluating the attribute 'vte' | |
at /nix/store/yjs0c0h8nwqjjsy4zdg0nmj611rpjypa-source/pkgs/desktops/gnome/default.nix:362:3: | |
361| libgnomekbd = throw "The ‘gnome.libgnomekbd’ alias was removed on 2022-01-13. Please use ‘pkgs.libgnomekbd’ directly."; # added 2019-02-08 | |
362| vte = throw "The ‘gnome.vte’ alias was removed on 2022-01-13. Please use ‘pkgs.vte’ directly."; # added 2019-02-08 |
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
from collections import deque | |
import fileinput | |
import itertools | |
nums = list(itertools.repeat(list(range(9, 0, -1)), 14)) | |
def main(): | |
i = 0 | |
for n in itertools.product(*nums): | |
num = ''.join(map(str, n)) |
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
from collections import deque | |
import fileinput | |
def main(): | |
x = y = z = w = 0 | |
for line in fileinput.input(): | |
inp = deque(line) | |
w = int(inp.popleft()) | |
x *= 0 |
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
inp w | |
mul x 0 | |
add x z | |
mod x 26 | |
div z 1 | |
add x 12 | |
eql x w | |
eql x 0 | |
mul y 0 | |
add y 25 |
NewerOlder