Skip to content

Instantly share code, notes, and snippets.

View fritz0705's full-sized avatar
🎂

Fritz fritz0705

🎂
View GitHub Profile
#!/bin/bash
inventarnummer="$1"
beschreibung="$2"
if [ -z "$inventarnummer" ]
then
read -p "Inventarnummer: " inventarnummer
fi
from __future__ import annotations
from typing import *
@no_type_check
def forward(f):
resolved = None
def c(*args, **kwargs):
if not resolved:
resolved = f()
return resolved(*args, **kwargs)
@fritz0705
fritz0705 / STL.hs
Last active October 3, 2017 11:45
something something homology groups
module STL
where
import qualified Data.List as L
data K3 f = K3 f f f
deriving (Show, Eq)
data Void
#!/usr/bin/python3
import sys
zk_code = sys.argv[-1].rjust(20, "0")
print("ZK Code: {}".format(zk_code))
result = ""
# Iterate though bytes
for i in range(0, 20, 4):
nibble1 = bin(int(zk_code[i:i+2]))[2:].rjust(4, "0")
newtype Vector2 a = Vector2 (a, a)
instance Eq a => Eq (Vector2 a) where
Vector2 x == Vector2 y = x == y
instance Functor Vector2 where
fmap f (Vector2 (a, b)) = Vector2 (f a, f b)
instance Applicative Vector2 where
pure x = Vector2 (x, x)
import Data.Foldable (fold)
import Data.Monoid (Endo(Endo, appEndo))
-- | @replicateEndo n f@ replicates n times an endomorphism f and folds them using
-- function composition to an endomorphism @a -> a@.
--
-- Propositions:
-- > replicateEndo _ id == id
-- > replicateEndo _ (const x) == const x
-- > replicateEndo 0 _ == id
@fritz0705
fritz0705 / gist:3391a8e11a84392455a6
Created May 18, 2015 18:40
Schlimme Programmiersprachen
* Pascal
* PHP
* Algol 60
* Fortran
* Alles andere von Niklaus Wirth
* WEB
* CWEB
* C++
* C#
* F#
# License: CC0
class Digraph(object):
""" Digraph is a simple and more or less efficient implementation of a
directed graph. It aims to provide all necessary methods for digraphs and to
be simple to understand. Therefore, Digraph isn't efficient in any way. When
you are looking for an efficient digraph implementation, look at FastDigraph.
"""
def __init__(self, data=None):
self.arcs = set()
import Control.Applicative
import Control.Monad
import Data.Monoid
data List a = Nil | (:::) a (List a) deriving (Show, Read)
infixr 5 :::
instance Functor List where
fmap f (x ::: xs) = (f x) ::: (fmap f xs)
fmap _ Nil = Nil
var (
// Zustand des endlichen Automatens
state int
// Ergebnis™
resistorsPerContainer = 0
containerCount = 0
)
for _, arg := range os.Args {