Skip to content

Instantly share code, notes, and snippets.

View Drezil's full-sized avatar
🏳️‍⚧️
Busy with life. And work. And Partners 🥰

Drezil Drezil

🏳️‍⚧️
Busy with life. And work. And Partners 🥰
View GitHub Profile
@Drezil
Drezil / infrastructure_homepage.html
Created January 5, 2023 22:18
ChatGPT Homepage Generation
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css">
@Drezil
Drezil / ChatGPT_on_Fixpoints.txt
Last active January 5, 2023 20:32
ChatGPT on Fixpoints.
>>> Define least and greatest fixpoint over a generation functor for me and explain how they are isomorphic in Haskell. Provide the proof of that isomorphism in Haskell-Code as well.
---
In Haskell, the least fixpoint and the greatest fixpoint of a generation functor are defined as follows:
Least fixpoint:
f_least :: (a -> a) -> a
f_least f = f (f_least f)
@Drezil
Drezil / find_any_type.hs
Created July 20, 2020 14:06
Find all things of type a inside type b - dynamically at runtime.
import Data.Data
import Data.Functor.Const
import Data.Generics.Product.Types
-- This works on Data/Typeable, which is basically duck-typing from python
-- instead of GHC.Generics which work only at compile-time & have no runtime-cost.
extractAny :: (Data a, Typeable b) => a -> [b]
extractAny = getConst . gfoldl (\xs d -> case cast d of
Just a -> Const (a:getConst xs)
@Drezil
Drezil / first.fish
Last active January 15, 2020 08:46
Fish-functions
function first
for file in $argv
echo "$file"
dd if="$file" count=25 status=none | head -n1
echo ""
end
end
@Drezil
Drezil / first.fish
Created March 15, 2019 09:23
safe "head" for files which could potentially have no line-breaks (gives first line & at max 25*4096 bytes)
function first
for file in $argv
echo "$file"
dd if="$file" count=25 status=none | head -n1
echo ""
end
end
@Drezil
Drezil / groupby.fish
Created March 15, 2019 09:21
Groupby for key,value-csv-files
function groupby
for o in (cut -d ',' -f 1 $argv[1] | uniq)
echo -n "{\"$o\":["
grep "$o" $argv[1] | cut -d ',' -f 2 | sed 's/^\(.*\)$/"\1"/' | tr '\n' ','| sed 's/,$//'
echo "]}"
end
end
Hi Spiegel,
da ich eine Statische IP besitzte und diese zweifelsohne ein personenbezogenes Datum ist
(der BGH hat unlängst geurteilt, dass selbst DYNAMISCHE IPs personenbezogene Daten sind,
obschon die idR. nur 24hgültig sind) und es mir passiert ist, dass ich auf Websites ihrer
Gruppe gesurft bin, möchte ich gerne mein Recht auf Löschung aller Daten bezüglich meiner IP
xxx.xxx.xxx.xxx
aus sämtlichen ihrer Datenspeicher bestehen (Art 15 Abs. 1 e) EU-DSGVO).
@Drezil
Drezil / Makefile
Created May 5, 2018 10:30
Pandoc/LaTeX Makefile
all: ma.md bibma.bib template.tex settings/abkuerzungen.tex settings/commands.tex settings/environments.tex settings/hyphenation.tex settings/packages.tex files/titlepage.tex files/erklaerung.tex
pandoc -s -N --template=template.tex ma.md -o ma.tex
rm -f ma.pdf ma.aux ma.idx ma.lof ma.log ma.lot ma.out ma.tdo ma.toc ma.bbl ma.blg ma.loa
xelatex -interaction batchmode ma.tex || true
bibtexu ma
xelatex -interaction batchmode ma.tex || true
while test `cat ma.log | grep -e "Rerun to get \(citations correct\|cross-references right\)" | wc -l` -gt 0 ; do \
rm ma.log && (xelatex -interaction batchmode ma.tex || true) \
done
rm -f ma.aux ma.idx ma.lof ma.lot ma.out ma.tdo ma.toc ma.bbl ma.blg ma.loa
@Drezil
Drezil / haskell_typeclass_subtyping.hs
Created September 12, 2015 13:17
toying with subtyping
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Graph where
import Data.IntMap as IM
import Data.Maybe
-- unsere "oberste" Klasse
class HasGraph g n e where
@Drezil
Drezil / Parser.hs
Created April 3, 2015 19:20
Parsers.. easier than expected.
{-# LANGUAGE LambdaCase #-}
module Main where
import Control.Applicative
data Parser a =
Parser {
runParser :: String -> (Either String a, String)
}