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 / HPMoR Downloader
Created August 6, 2014 19:58
Little Script to download all Harry Potter and the methods of rationality episodes.
#!/bin/bash
mkdir -p HPMoR
cd HPMoR
for episode in `wget -q -O - http://www.hpmorpodcast.com/?page_id=56 | sed -n -e "s/.*http\(.*\)\\.mp3.*/http\1.mp3/p" | uniq`
do
file="`echo "$episode" | sed -n -e 's/.*\/\([^/].*\)\.mp3.*/\1.mp3/p'`"
if [[ -f "$file" ]]; then
echo "$file exists. Skipping."
else
@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)
}
@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 / 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
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 / 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
@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 / 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 / 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 / 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)