Skip to content

Instantly share code, notes, and snippets.

import System.Directory
main = do
let dirPath = "/home/exarkun/"
setCurrentDirectory dirPath
getCurrentDirectory >>= putStrLn
files <- getDirectoryContents dirPath
putStrLn $ show files
forM_
[ "CNAME"
, "favicon.ico"
, "robots.txt"
, "_config.yml"
, "images/*"
, "js/*"
, "fonts/*"
]
$ \f -> match f $ do
distinctTTY = name:
let
# Does this systemd service have a TTY?
hasTTY = service: (service.serviceConfig.TTYPath or null) != null;
# Get only the systemd services that have a TTY.
ttyServices = self: services: lib.filterAttrs (name: value: name == self || hasTTY value) services;
# Get the names of some systemd services with a stable ordering.
serviceNames = services: builtins.sort (a: b: a < b) (
module Main where
import System.Environment (getArgs)
data A = A deriving Show
data B = B deriving Show
parseA :: String -> Maybe A
parseA "A" = Just A
parseA _ = Nothing
from ..listeners import Listener
def _get_listeners() -> dict[str, Listener]:
return {
"tor": tor_provider,
"i2p": i2p_provider,
"foo": 123,
}
_LISTENERS: str = _get_listeners()
└───x86_64-linux
├───default: package 'python3.8-tahoe-lafs-1.18.0.post1'
├───python310-tahoe-lafs: package 'python3.10-tahoe-lafs-1.18.0.post1'
├───python311-tahoe-lafs: package 'python3.11-tahoe-lafs-1.18.0.post1'
├───python38-tahoe-lafs: package 'python3.8-tahoe-lafs-1.18.0.post1'
├───python39-tahoe-lafs: package 'python3.9-tahoe-lafs-1.18.0.post1'
└───python73-tahoe-lafs: package 'pypy3.9-tahoe-lafs-1.18.0.post1'
def canPlaceItems(templateBox: tuple[T], items: tuple[T], box: tuple[T]):
return templateBox[len(box):len(box)+len(items)] == items
def placeItem(items: tuple[T], boxes: tuple[tuple[T]]) -> tuple[tuple[T]]:
for n, box in enumerate(boxes):
if canPlaceItem(items, box):
# It fits here, place it.
return boxes[:n] + (box + items,) + boxes[n + 1:]
# It fits nowhere, create a new box.
📦 Including license file "/build/pycddl-0.4.0/LICENSE"
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
💥 maturin failed
Caused by: Invalid python interpreter version
collatz :: Integer -> Maybe Integer
collatz n
| n < 1 = Nothing
| n == 1 = Just 0
| even n = fmap (+ 1) $ collatz (n `div` 2)
| odd n = fmap (+ 1) $ collatz (3 * n + 1)
[mypy]
ignore_missing_imports = True
no_implicit_optional = True
plugins = mypy_zope:plugin
pretty = True
show_column_numbers = True
show_error_codes = True
strict_equality = True
warn_redundant_casts = True
warn_unused_configs = True