Skip to content

Instantly share code, notes, and snippets.

View pavelzw's full-sized avatar
🤪

Pavel Zwerschke pavelzw

🤪
View GitHub Profile
@pavelzw
pavelzw / improve_sklearn_tree_pickling.py
Last active June 23, 2022 18:24
Optimize pickling disk space for deploying scikit-learn trees to production
# This file explains how to improve the pickling algorithm of sklearn trees to achieve significantly smaller file sizes.
# See https://tech.quantco.com/2022/06/23/dtype-reduction-sklearn.html for the corresponding blog post.
import pickle
import copyreg
from typing import Any, BinaryIO
import numpy as np
from sklearn.tree._tree import Tree
@pavelzw
pavelzw / display.sh
Last active September 23, 2021 11:34 — forked from amanusk/display.sh
Easily change between laptop and external displays in i3 + dmenu
#!/bin/bash
# This script is intended to make switching between laptop and external displays easier when using i3+dmenu.
# To run this script, map it to some shortcut in your i3 config, e.g.:
# bindsym $mod+p exec --no-startup-id $config/display.sh
# IMPORTANT: run chmod +x on the script to make it executable
# The result is 4 options appearing in dmenu from which you can choose
# This is your default laptop screen, detect by running `xrandr`
INTERNAL_OUTPUT="eDP-1"
@pavelzw
pavelzw / wolves_and_chicks.pl
Created August 20, 2021 21:37
The solution to Puzzle 007 “Wolves and Chicks” in Professor Layton and the Curious Village written in Prolog
% X1 chick, X2 wolf
valid(X1,X2) :- X1 >= X2, 3 - X1 >= 3 - X2, X1 > 0, X2 >= 0, X1 < 3, X2 =< 3.
valid(3,X2) :- X2 >= 0, X2 =< 3.
valid(0,X2) :- X2 >= 0, X2 =< 3.
move(0,1).
move(1,0).
move(0,2).
move(2,0).
move(1,1).
@pavelzw
pavelzw / RaceConditionDensity.ipynb
Last active January 20, 2021 16:53
Probability density of a race condition
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.