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
from random import randint | |
def sag(n): | |
digits = ['Nul', 'ein', 'zwei', 'drei', 'vier', 'fünf', 'sechs', 'sieben', 'acht', 'neun'] | |
zehns = ['zehn', 'elf', 'zwölf', 'dreizehn', 'vierzehn', 'fünfzehn', 'sechszehn', 'siebzehn', 'achtzehn', 'neunzehn'] | |
zigs = ['', 'zehn', 'zwanzig', 'dreißig', 'vierzig', 'fünfzig', 'sechzig', 'siebzig', 'achtzig', 'neunzig'] | |
if n < 0: | |
return 'minus {}'.format(sag(-n)) | |
if n < 10: | |
return digits[n] |
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/bash | |
wrk=$(mktemp) | |
CGROOT=/sys/fs/cgroup | |
SUBGROUP=subgroup | |
IFS=: | |
cp /proc/self/cgroup $wrk | |
while read id ctrl path ; do | |
[ "$path" = "/" ] && continue |
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
Public source: | |
https://raw.githubusercontent.com/Werkov/Werkov.github.io/874101fed2664468ef3b02c2486c1dc7069d5799/_posts/2019-01-09-predictions.md | |
Checksums: | |
8bc09fc868f1cc54253e865a092d15a59af0a6aa _posts/2019-01-09-predictions.md | |
3db759e1ec1f1a81a27889080eb7992b _posts/2019-01-09-predictions.md |
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
Public source: | |
https://raw.githubusercontent.com/Werkov/Werkov.github.io/72c52850c39a102499a048e59772a4d9147ba796/_posts/2018-01-13-predictions.md | |
Checksums: | |
a9f7d7e5ddf4def05310db2196185b67dda283f2 _posts/2018-01-13-predictions.md | |
e166a2a36a399a000fda91c7e71df1a8 _posts/2018-01-13-predictions.md |
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/python3 | |
# Estimates time spent on a project from commit timestamps | |
# | |
# If two commits are less than INERTIA time apart, the time | |
# between them is considered spent, otherwise SINGLE_COMMIT | |
# time is taken. | |
import os |
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/python3 | |
from collections import defaultdict | |
from math import log | |
def entropy(n, sequence): | |
""" | |
Estimates entropy of random sequence of elements | |
based on ngram distribution. |
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/python3 | |
_cache = {} | |
def sums(addends, sum): | |
"""Return list of tuples of @addends addends that sums up to @sum.""" | |
global _cache | |
if addends < 1 or sum < addends: | |
return [] | |
if (addends, sum) not in _cache: | |
result = [] if addends > 1 else [(sum,)] |
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 | |
# | |
# WEASEL | |
# Inspired by Richard Dawkins. | |
# | |
from random import random, choice | |
genoverse = 'ABCDEFGHIJKLKMNOPQRSTUVWXYZ ' |
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
def play(desk, who): | |
bestResult = -2 | |
for row in range(0, 3): | |
for col in range(0, 3): | |
if desk[row][col] != 0: | |
continue | |
desk[row][col] = who | |
if testLoser(desk, row, col, who): | |
bestResult = max(bestResult, -1) | |
else: |