This file contains hidden or 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 __future__ import annotations | |
| from abc import ABC, abstractmethod | |
| from typing import Self, override | |
| from collections.abc import Callable | |
| import pydantic | |
| class FooV1(pydantic.BaseModel): | |
| a: int | |
| b: str |
This file contains hidden or 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
| #!/bin/bash | |
| DIR="/tmp/screenshots" | |
| mkdir -p "$DIR" | |
| TIMESTAMP=$(date +%Y-%m-%dT%H-%M-%S) | |
| FILE=$(mktemp -u -p "$DIR" -t "$TIMESTAMP-XXXXX.png") | |
| scrot -e 'xclip -selection clipboard -t image/png -i $f' "$@" "$FILE" && echo "$FILE" |
This file contains hidden or 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 vectorize import ( | |
| categorize_class, | |
| categorize_bool, | |
| categorize_num, | |
| make_vectorize, | |
| ) | |
| @categorize_class(["FIN", "MISC"], weight=10) | |
| def module_cat(d): |
This file contains hidden or 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 code | |
| import ctypes | |
| import inspect | |
| import logging | |
| def hook( | |
| banner_msg: str | None = None, |
This file contains hidden or 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
| class Lazy: | |
| def __init__(self, fun, *args, **kwargs): | |
| self.fun = fun | |
| self.args = args | |
| self.kwargs = kwargs | |
| self.executed = False | |
| self.value = None | |
| # Binary Operators | |
| def __binary__(self, binfun, other): |
This file contains hidden or 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
| package main; | |
| public interface Lazy<R> { | |
| public R force(); | |
| } |
This file contains hidden or 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
| -- Compile with -threaded | |
| import System.IO | |
| import Control.Concurrent | |
| import Control.Concurrent.STM | |
| -- (<Sum>, <Number of finished transactions>) | |
| type Result = TVar (Int, Int) | |
| -- Adds x to result and increments the number of finished transactions |
This file contains hidden or 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
| -- Compile with -threaded | |
| import System.IO | |
| import Control.Concurrent | |
| getGreeting :: IO String | |
| getGreeting = do | |
| -- Get id and convert to string | |
| tid <- myThreadId | |
| let greeting = "Hello from " ++ show tid |
This file contains hidden or 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
| -- Compile with the -XScopedTypeVariables flag. | |
| -- e.g. ghc -Wall -XScopedTypeVariables Main.hs | |
| import Control.Exception | |
| data MyError = Error deriving Show | |
| instance Exception MyError | |
| failing :: IO () |
This file contains hidden or 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
| Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | |
| Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis |
NewerOlder