Skip to content

Instantly share code, notes, and snippets.

View appositum's full-sized avatar
💭
🐝

ezra ramon appositum

💭
🐝
View GitHub Profile
@appositum
appositum / regex.py
Last active April 1, 2024 23:45
regex.py
import re
class Crossword:
def __init__(self, rows, columns, answer):
self.rows = rows
self.columns = columns
self.answer = answer
self.input_matrix = [
[' ', *self.columns]
@appositum
appositum / radix_sort.py
Last active March 7, 2023 19:46
Radix Sort
def sort_counting(lst, exp):
length = len(lst)
# data ranges from 0 to 9
occ = [0 for i in range(10)]
# occurrence of each element
for el in lst:
index = el // exp
@appositum
appositum / counting_sort.py
Created September 3, 2021 23:47
Counting Sort
import random
lst = [1, 4, 1, 2, 7, 5, 2]
def sort_count(lst):
# data ranges from 0 to 9
occ = [0 for i in range(10)]
# occurrences of each element
for _i, el in enumerate(lst):
zfill :: Int -> String -> String
zfill n str = do
if length str >= n
then str
else replicate (n - length str) '0' ++ str
import Data.Bifunctor
import Data.Char
(😈) = (\x -> chr <$> id x) =<< zipWith ($) [unpack <$> id, unpack <$> first (succ :: Int -> Int), unpack <$> first (subtract 5), pure . fst] (replicate 8 (115,97)) where unpack (a,b) = [a,b]
(🙏) s = (s ++ " " ++ fmap chr [101,115,116,97,32,110,111,32,99,111,109,97,110,100,111])
main = print $ (🙏) (😈)
#!/usr/bin/env python3
import os
import argparse
parser = argparse.ArgumentParser(description='Compile ReasonML using the OCaml Compiler preprocessor.')
parser.add_argument('-f', '--files', nargs='+', metavar='<input files>', dest='files',
type=str, help='specify the Reason filename to be compiled', required=True)
parser.add_argument('-o', metavar='<output file>',
dest='output',

Keybase proof

I hereby claim:

  • I am appositum on github.
  • I am appositum (https://keybase.io/appositum) on keybase.
  • I have a public key ASB6oxaL5ixW_0p1NlE2e2oi1qkNDm-eID6QKkJXcnUPZwo

To claim this, I am signing this object:

open import Data.Nat
open import Data.Char
data Σ : (a : Set) → (P : a → Set) → Set where
Sigma : {a : Set} → {P : a → Set} → (x : a) → P x → Σ a P
data Vect : ℕ → Set → Set where
Nil : {a : Set} → Vect zero a
_∷_ : {a : Set} → {n : ℕ} → a → Vect n a → Vect (suc n) a
infixr 5 _∷_
infixr 5 <>
interface VerifiedMonoid (a : Type) where
mempty : a
(<>) : a -> a -> a
leftId : (x : a) -> mempty <> x = x
rightId : (x : a) -> x <> mempty = x
assoc : (x : a) -> (y : a) -> (z : a) -> x <> (y <> z) = (x <> y) <> z
[MonoidSum] VerifiedMonoid Nat where
mempty = 0
infixr 5 :>
data Vect : Nat -> Type -> Type where
Empty : Vect Z a
(:>) : a -> Vect n a -> Vect (S n) a
data Sigma : (a : Type) -> (P : a -> Type) -> Type where
MkSigma : {P : a -> Type} -> (x : a) -> P x -> Sigma a P
vec : Sigma Nat (\n => Vect n Int)
vec = MkSigma 2 (3:>4:>Empty)