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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Malen!</title> | |
<style> | |
body { | |
margin: 0; |
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
""" | |
https://blog.fefe.de/?ts=bcb518f6 | |
Timestamp: bcb518f6 | |
Date: Thu Mar 31 2005 | |
""" | |
from datetime import datetime | |
def defefe(ts): | |
""" | |
Decrypt hex-encoded POSIX timestamps. |
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
/** | |
* Group a list of item by key. | |
* @param list | |
* @param keyGetter | |
* @returns {Map<any, any>} | |
*/ | |
function groupBy(list, keyGetter) { | |
const map = new Map(); | |
for (const item of list) { |
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 cmd import Cmd | |
import random | |
import string | |
import uuid | |
# noinspection PyMethodMayBeStatic,PyUnusedLocal | |
class CrystalBall(Cmd): | |
intro = 'Ask the crystal ball for some truly random things. \n\n' \ | |
'Type "help" to get some help.' |
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
;; Helpers | |
(defun last-letter (str) | |
(char str (- (length str) 1)) | |
) | |
(defun ends-with (str letter) | |
(char= (last-letter str) letter) | |
) | |
(defun random-choice (coll) |
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
class Stream { | |
constructor(iterable, chain) { | |
this._iterable = iterable; | |
this._chain = chain || ""; | |
} | |
static from(iterable) { | |
return new Stream(iterable); | |
} |
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
function* imap(iterable, func) { | |
for (item of iterable) { | |
yield func(item); | |
} | |
} | |
function* ifilter(iterable, predicate) { | |
for (item of iterable) { | |
if(predicate(item)) { | |
yield item; |
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
const assert = require('assert'); | |
describe('Parse', () => { | |
it('strict', function () { | |
// these are fine | |
assert.strictEqual(parseStrict(0), 0); | |
assert.strictEqual(parseStrict(-0), -0); | |
assert.strictEqual(parseStrict(1), 1); | |
assert.strictEqual(parseStrict(3.14159), 3.14159); | |
assert.strictEqual(parseStrict(-3.14159), -3.14159); |
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
const { performance } = require('perf_hooks'); | |
// LIZENZ: Gehört Horst Schneider | |
function Statistics(X) { | |
function Percentile(X, percent) { | |
this.value = function () { | |
const k = (X.length - 1) * percent; | |
const lower = Math.floor(k); |
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 unittest | |
from abc import ABC, abstractmethod | |
class DuplicateKeyException(Exception): | |
def __init__(self, key): | |
msg = f"Key {key} is already taken" | |
super(DuplicateKeyException, self).__init__(msg) | |
NewerOlder