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 python3 | |
from functools import reduce | |
from operator import mul | |
# the probability that it will rain in the next hour | |
rain_probs = { | |
1200: 0.05, | |
1300: 0.05, | |
1400: 0.05, |
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
package errmonad | |
type ErrMonad[T any] struct { | |
Val T | |
Err error | |
} | |
type LiftFunc[T any] func(T) ErrMonad[T] | |
func Lift[T any](x T) ErrMonad[T] { |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strings" | |
"time" | |
) | |
var ( |
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
program p() { | |
while (halts(p) { | |
p(); | |
} | |
} |
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
package main | |
import "fmt" | |
type Numeric interface { | |
~int | ~float32 | ~float64 | |
} | |
type Predicate[T any] func(T) bool | |
type Transform[T any] func(T) T |
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 python3 | |
from datetime import datetime | |
import re | |
import requests | |
import sys | |
def get_forum_text(forum_id): | |
url = f'https://debianforum.de/forum/viewforum.php?f={forum_id}' |
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
package main | |
import "fmt" | |
type Numeric interface { | |
~int | ~float32 | ~float64 | |
} | |
type Predicate[T any] func(T) bool | |
type Transform[T any] func(T) T |
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
:- use_module(library(clpr)). | |
alice(apple, 1). | |
alice(banana, 2). | |
alice(orange, 3). | |
alice(kiwi, 4). | |
bob(apple, 1). | |
bob(orange, 2). | |
bob(banana, 3). |
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 python3 | |
# Object-Oriented Programming: | |
# - verbose | |
# - mutable state | |
class Rounding: | |
def __init__(self, granularity): | |
self._granularity = granularity |
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
# sample usage: | |
# $ cd /home/paedu/c | |
# $ virgp stdio | |
function virgp { | |
files="$(rg -l $1 | tr '\n' ' ')" | |
if [ -z "$files" ] | |
then | |
echo "pattern $1 did not match any files" | |
else | |
#echo "vim -p ${files}" |