Skip to content

Instantly share code, notes, and snippets.

View suspectpart's full-sized avatar
🐍
Python for Dummies - Out now!

Horst Schneider suspectpart

🐍
Python for Dummies - Out now!
  • Universität Heidelberg, Germany
  • Mannheim
View GitHub Profile
@suspectpart
suspectpart / istream.js
Last active February 6, 2019 23:29
ES6 Generators
class Stream {
constructor(iterable, chain) {
this._iterable = iterable;
this._chain = chain || "";
}
static from(iterable) {
return new Stream(iterable);
}
@suspectpart
suspectpart / beer.lisp
Last active September 20, 2019 19:18
A beer name generator, written in LISP.
;; Helpers
(defun last-letter (str)
(char str (- (length str) 1))
)
(defun ends-with (str letter)
(char= (last-letter str) letter)
)
(defun random-choice (coll)
@suspectpart
suspectpart / crystal_ball.py
Last active September 29, 2019 13:48
Crystal Ball
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.'
@suspectpart
suspectpart / secgrid.es6
Last active February 6, 2020 12:51
SectionGrid Spike
/**
* 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) {
@suspectpart
suspectpart / fefe.py
Last active February 6, 2021 21:00
Decipher Fefe Timestamps
"""
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.
<!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;