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.List (sort) | |
data Range = Range {start :: !Int, end :: !Int} | |
deriving (Show, Eq, Ord) | |
type Mapping = [(Range, Range)] -- ^ source -> dest, not like reqs | |
pipe :: [Mapping] -> Int -> Int | |
pipe [] val = val | |
pipe (mapping:maps) val = case filter (rangeElem val . fst) mapping of | |
[(source, dest)] -> pipe maps $! val - start source + start dest |
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 runhaskell | |
import Data.Foldable (foldl') | |
import Numeric (showHex) | |
import System.Environment (getArgs) | |
hex = flip showHex "" | |
m = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 :: Integer | |
sumMod m = foldl' (\a b -> (a + b) `mod` m) 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
[package] | |
name = "ffmpeg-benchmark" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
ffmpeg-next = { version = "6.0.0", default-features = false, features = ["codec", "format", "software-scaling", "software-resampling"] } |
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 QtQuick 2.12 | |
import QtQuick.Controls 2.12 | |
import QtQuick.Layouts 1.12 | |
import QtQuick.Window 2.12 | |
Window { | |
width: column.width | |
height: column.height * 1.5 | |
Column { |
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
fn main() { | |
let builder = Builder::new(); | |
let mut num = 1337; | |
let builder = builder.set_kek(&mut num); | |
builder.run() | |
} | |
trait Bar { | |
fn foo(&self); | |
} |
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
use rand_core::RngCore; | |
use unknown_order::BigNumber; | |
pub fn tonelli_shanks(n: &BigNumber, p: &BigNumber, z: &BigNumber) -> Option<BigNumber> { | |
let zero = BigNumber::zero(); | |
let one = BigNumber::one(); | |
let two = BigNumber::from(2); | |
// find q, s such that n = q * 2^s | |
let (q, s) = { | |
let mut s = BigNumber::zero(); |
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 LambdaCase #-} | |
module Main where | |
import Data.Ron.Deserialize (loadsLazy) | |
import Data.Ron.Serialize (dumps, rustStyle) | |
import System.Environment (getArgs, getProgName) | |
import qualified Data.ByteString.Lazy as BS | |
main = getArgs >>= \case | |
["--help"] -> usage |
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 stack | |
{- stack --resolver=lts-18.10 --package classy-prelude --package telegram-bot-simple --package text | |
-} | |
{- This was a proper project with package.yaml, but I don't want to export the whole structure -} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings, LambdaCase #-} | |
{-# LANGUAGE TupleSections #-} | |
{-# LANGUAGE MultiWayIf #-} | |
module Main where |
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
_note_complete() | |
{ | |
local IFS=$'\n' | |
mapfile -t COMPREPLY < <( grep --regexp="$2" "$HOME/.cache/note_completions" ) | |
case "$3" in | |
"--list"|"--refresh") | |
COMPREPLY=() | |
;; | |
"--remove") | |
;; |
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
diff --git a/TESTS.md b/TESTS.md | |
index 287e65a..3a23c15 100644 | |
--- a/TESTS.md | |
+++ b/TESTS.md | |
@@ -93,16 +93,8 @@ import qualified MegaModule as M ((>>>), MonadBaseControl, void, MaybeT(..), joi | |
```haskell expect | |
import qualified MegaModule as M | |
- ( Either | |
- , Maybe(Just, Nothing) |
NewerOlder