Skip to content

Instantly share code, notes, and snippets.

View gist:50a40cb955cb1b208bff161296d1dbb8
└───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'
View gist:9cca423d82de14f5409420f9753aafe9
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.
View gist:92533a9ec4073eabb896fdf8342a2c76
📦 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
View package.yaml
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)
View mypy.ini
[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
View gist:76ae15b90c3aec2c3a61e1412c1eaf7e
ev <- performEvent $ ffor pb $ \_ -> liftIO $ do
p <- getFilesDir
case p of
Nothing -> pure Nothing
Just p' -> do
writeFile (p' <> "/" <> "somedata.txt") "Hello, world!"
content <- deepseq <$> readFile (p' <> "/" <> "somedata.txt")
pure (Just (p', content))
View gist:5c6fef64cabdcd2c68e04b0452882118
{nix-thunk}: self: super: let
# Customize the Botan2 build to be minimal and to compile successfully when
# the host platform is Android.
extraConfigureFlags = { stdenv, botan2 }:
(botan2.extraConfigureFlags or "") + (
builtins.concatStringsSep " " ([
# enable debug symbols and disables optimizations.
"--debug-mode"
View gist:46698cba9fe0b9344af2727e8ec21cc8
src/Tahoe/CHK/URIExtension.hs:11:1: error:
Could not find module ‘Control.Applicative.Combinators’
There are files missing in the ‘parser-combinators-1.3.0’ package,
try running 'ghc-pkg check'.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
11 | import Control.Applicative.Combinators (count)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Tahoe/CHK/URIExtension.hs:12:1: error:
Could not find module ‘Control.Applicative.Permutations’
View frontend.cabal
cabal-version: 3.0
name: frontend
version: 0.1
build-type: Simple
library
default-language: Haskell2010
default-extensions: OverloadedStrings
hs-source-dirs: src
-- XXX This requires a newer version of cabal than we have.
View gist:11fdedc5a3854a5f598c07696a0b906e
extensionFromFields :: [(B.ByteString, B.ByteString)] -> Either String URIExtension
extensionFromFields fields = do
let
fieldMap = M.fromList fields
lookup' :: B.ByteString -> Either String B.ByteString
lookup' k = maybe (Left $ "URI extension field missing: " <> k) pure (M.lookup k fieldMap)
uriExtCodecName <- lookup' "codec_name"
uriExtCodecParams <- lookup' "codec_params" >>= parse "codec_params"
uriExtTailCodecParams <- lookup' "tail_codec_params" >>= parse "tail_codec_params"