Skip to content

Instantly share code, notes, and snippets.

View timjb's full-sized avatar

Tim Baumann timjb

View GitHub Profile
{
"@context": {
"@version": 1.1,
"@protected": true,
"summary": "https://w3id.org/2023/tractusx/credentials/summary/",
"id": "@id",
"type": "@type",
"SummaryCredential": {
"@context": [
"https://gist.githubusercontent.com/timjb/520915f8cb527443102aff793b481988/raw/9fa7f71462afdeed2b2aa2d8aef66480784466e0/credentials.json"
@timjb
timjb / example.lagda
Created May 25, 2013 16:52
Example Literate Agda file (from Pygments)
\documentclass{article}
% this is a LaTeX comment
\usepackage{agda}
\begin{document}
Here's how you can define \emph{RGB} colors in Agda:
\begin{code}
module example where
@timjb
timjb / GCurry.idr
Last active February 9, 2022 03:23
N-Ary zip functions in Idris
module GCurry
import Data.HVect
GCurry : (ts : Vect n Type) -> (HVect ts -> Type) -> Type
GCurry [] T = T []
GCurry (t :: ts) T = (v : t) -> GCurry ts (T . (v ::))
gCurry : {ts : Vect n Type}
-> {T : HVect ts -> Type}
@timjb
timjb / AVLTree.hs
Last active December 25, 2021 10:54
Haskell implementation of AVL trees
{-# LANGUAGE FlexibleInstances #-}
module AVLTree where
import Control.Applicative
import Test.QuickCheck
import Control.Arrow (second)
data Balance = MinusOne | Zero | PlusOne deriving (Eq, Show, Read)
@timjb
timjb / installing_pijul_on_macos.markdown
Last active July 6, 2021 14:03
Installing Pijul on macOS

Installing Pijul on macOS

Prerequisites

$ brew install openssl libssh
$ export LIBRARY_PATH=/usr/local/lib OPENSSL_LIB_DIR=/usr/local/opt/openssl/lib OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include

Installing from crates.io

@timjb
timjb / BigNats.ts
Last active March 3, 2020 20:19
Vortrag über Programmierung auf Typebene in TypeScript
namespace BigNats {
type RepeatHelper<N extends number, T extends any, CurrList extends T[], CurrSizes extends number[]> =
CurrSizes extends [1]
? (CurrList["length"] extends N ? ["found", CurrList] : ["not-found", Cons<T,CurrList>])
: {
"true": RepeatHelper<N, T, CurrList, Tail<CurrSizes>> extends ["not-found", infer NewCurrList]
? RepeatHelper<N, T, Cast<NewCurrList, T[]>, Tail<CurrSizes>>
: RepeatHelper<N, T, CurrList, Tail<CurrSizes>>
}[CurrSizes extends [-1] ? "not-going-to-happen" : "true"];
@timjb
timjb / Species.agda
Last active November 2, 2019 18:59
-- Combinatorial Species in Agda
module Species where
open import Data.List using (List; []; _∷_; [_]; concat; take) renaming (_++_ to _++l_)
open import Data.Vec using (Vec; []; _∷_; _++_; _∷ʳ_; reverse; zipWith; map; toList; drop; lookup; sum; allFin; tabulate; foldl; _>>=_)
open import Data.Vec.Properties
open import Data.Empty using (⊥)
open import Data.Unit using (⊤; tt)
open import Data.Sum using (_⊎_; inj₁; inj₂)
// adapted from https://stackoverflow.com/a/28345802
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
public class RepeatRule implements TestRule {
private static class RepeatStatement extends Statement {
private final Statement statement;
@timjb
timjb / GithubUser.hs
Created March 18, 2019 13:55
FTypes JSON example
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RecordWildCards #-}
module GithubUser where
import JSONFormat
/* angepasster CSS-Code von */
/* https://marketpress.de/2019/schriftarten-atomion/ */
body,
button,
select,
optgroup,
textarea {
font-family: mr-eaves-sans, sans-serif;
}