Skip to content

Instantly share code, notes, and snippets.

View ManDeJan's full-sized avatar
blep blop

Jan Halsema ManDeJan

blep blop
View GitHub Profile
@ManDeJan
ManDeJan / koekjes.md
Created April 25, 2024 18:11
Koekjes 🍪
  • Boter: 115 gram gezouten boter, verzacht
  • Kristalsuiker: 100 gram
  • Lichtbruine Basterdsuiker: 106.5 gram
  • Pure Vanille-extract: 1 theelepel = 4.2 gram
  • Eieren: 1 groot
  • Bloem: 180 gram
  • Baking Soda: ½ theelepel = 2,4 gram
  • Bakpoeder: ¼ theelepel = 1,25 gram
  • Zeezout: ½ theelepel = 2,6 gram
  • Chocoladedruppels: 200 gram
from bs4 import BeautifulSoup, Tag
import requests
from pathlib import Path
from itertools import chain, combinations
from collections import Counter
file_path = Path('page.html')
if not file_path.is_file():
url = 'https://www.serebii.net/heartgoldsoulsilver/pokewalker-area.shtml'
@ManDeJan
ManDeJan / decompress.asm
Last active April 4, 2023 03:38
decompress.asm
.cpu cortex-m3
.syntax unified @ this is important, you won't get most of thumb-2 otherwise
.text
@ this file contains a assembly version of a lz decoder for cpse1 at the hogeschool utrecht
@ it's done in 15 instructions / 40 bytes, 20% less then what the best compiler did :)
@ compiler benchmarks
@ clang (trunk)
@ -O0 124 bytes
@ManDeJan
ManDeJan / coalitie_bouwer.py
Last active March 22, 2021 11:07
Tooltje om mogelijke coalities te checken
from itertools import combinations, chain
from compatibility import Voorkeur, Voorkeuren
partijen = {
'VVD': 35,
'D66': 23,
'PVV': 17,
'CDA': 15,
'SP': 9,
'PvdA': 9,
@ManDeJan
ManDeJan / pop.hs
Created October 4, 2020 09:51
Haskell version with less features and same performance
{-# LANGUAGE TupleSections #-}
pop =
[ ("Hard Labor", [1, 2, 3, 4])
, ("Lasting Consequences", [1, 2, 3])
, ("Convenience Fee", [1, 2])
, ("Jury Summons", [1, 2, 3])
, ("Extreme Measures", [1, 3, 6, 10])
, ("Calisthenics Program", [1, 2])
, ("Benefits Package", [2, 5])
@ManDeJan
ManDeJan / pop.py
Created October 3, 2020 18:27
Random Pact of Punishment generator for the Hades game
# Hi! This script is a slow way to generate a random pact of punishment
# for the Hades game, if you want a more complete version, check out my
# friends work at https://github.com/Druyv/hades_randomizer
from random import choice
from itertools import product
pop = {
'Hard Labor' : [1, 2, 3, 4],
'Lasting Consequences' : [1, 2, 3],
const std = @import("std");
const os = std.os;
pub fn main() void {
const filename = std.mem.span(os.argv[1]);
const open_result = os.open(filename, os.O_RDONLY, 0) catch unreachable;
const fstat_result = os.fstat(open_result) catch unreachable;
const data = os.mmap(null, @intCast(u64, fstat_result.size), os.PROT_READ, os.MAP_PRIVATE, open_result, 0) catch unreachable;
@ManDeJan
ManDeJan / better_python3
Created June 24, 2020 20:00 — forked from cjsmeele/better_python3
better_python3
#!/usr/bin/env perl
# This adds the post-inc, post-dec, pre-inc and pre-dec operators to python!
# Additionally, it supports the -O3 optimization feature.
# Test! :)
my $optimized = 0;
if (@ARGV and $ARGV[0] eq '-O3') {
shift;
@ManDeJan
ManDeJan / python-why.py
Created March 7, 2019 22:56
CAR & CDR in 1 line of Python
for _ in map(exec, map(lambda s: f'''{"""""".join(map(chr, range(100, 103)))} c{s}r(l): h,*t=l; return {"c" + s[:-1] + "r(" + ("h)" if s[-1] == "a" else "t)") if s[:-1] else "h" if s[-1] == "a" else "t"}''', [f'{bin(i)[2:].zfill(x)}'.translate({48: 97, 49: 100}) for x in range(10) for i in range(2**10)])): pass

Keybase proof

I hereby claim:

  • I am ManDeJan on github.
  • I am j21 (https://keybase.io/j21) on keybase.
  • I have a public key whose fingerprint is 6FE3 09B8 7B16 D7B4 6F5A 2476 3D28 050C 38FE 3FB8

To claim this, I am signing this object: