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 ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE DefaultSignatures #-} | |
{-# LANGUAGE DeriveAnyClass #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE DerivingVia #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} |
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
#!/bin/zsh | |
# first argument: number of files to join into new one, default 5 | |
num=${1:-5} | |
tmpdir=$(mktemp --directory) | |
outdir=$(date +"%Y-%m-%d_%H-%M") | |
mkdir $outdir | |
ls > $tmpdir/files |
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
-- A simple whireshark dissector for GfxTablet's UDP packages, see | |
-- https://github.com/rfc2822/GfxTablet and | |
-- https://github.com/rfc2822/GfxTablet/blob/master/doc/protocol.txt | |
gfxtablet_proto = Proto("gfxtab", "GfxTablet protocol") | |
function gfxtablet_proto.dissector(buf, pinfo, tree) | |
pinfo.cols.protocol = "GFXTAB" | |
local t = tree:add(gfxtablet_proto, buf(), "GfxTablet Protocol Data") | |
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
\documentclass[11pt,a4paper,ngerman]{scrartcl} | |
\usepackage[utf8]{inputenc} | |
\usepackage[T1]{fontenc} | |
\usepackage{babel} | |
\usepackage{scoretable} | |
\newcommand{\task}[1]{\section*{Aufgabe #1}\addscoretableentry{#1}} | |
\newcommand{\ctask}[2]{\section*{#1}\addscoretableentry{#2}} | |
\newcommand{\notask}{\addscoretableentrycrossed} |
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
(****************************************) | |
(* datatypes and functional programming *) | |
(****************************************) | |
(* We can define (inductive) datatypes like in Haskell | |
(where 'Set' corresponds to Haskell's '*') | |
*) | |
Inductive mynat : Set | |
:= zero : mynat | plus1 : mynat -> mynat. |
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
Require Import List. | |
Import ListNotations. | |
Definition head := hd_error. | |
Definition tail := tl. | |
Definition len := length. | |
(* make the type parameter "invisible" to the user, | |
e.g. the type of 'len' is | |
list ?1 -> nat |
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
fibs :: (Integral a) => [a] | |
fibs = 1 : 1 : zipWith (+) fibs (tail fibs) | |
--https://projecteuler.net/problem=2 | |
problem2 :: (Integral a, Integral b) => a -> b | |
problem2 n | |
| n <= 1 = 0 | |
| otherwise = sum (filter even (takeWhile (<= (fromIntegral n)) fibs)) | |
answer = problem2 (4*10^6) |
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 ruby | |
require 'yaml' | |
f = ARGV.shift || exit(1) | |
y = YAML.load_file(f) | |
def make_cmd(article_file, article_name, editor_name) | |
fields = [ "#{article_file}.tex".ljust(33), |
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 System.Environment (getArgs) | |
data Dir = U | R deriving(Show) | |
type Link = [Dir] | |
shuf :: Link -> Int -> Int -> [Link] | |
shuf ds 0 0 = [ds] | |
shuf ds 0 q = shuf (R:ds) 0 (q-1) | |
shuf ds p 0 = shuf (U:ds) (p-1) 0 | |
shuf ds p q = |
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 ruby | |
# encoding: utf-8 | |
f = ARGV[0] || exit(1) | |
# get page count | |
n = `pdfinfo #{f} | grep Pages | cut -d":" -f2`.strip.to_i | |
# create empty page | |
`cd /tmp && convert -page A4 xc:white __blankpage.pdf` |
NewerOlder