Skip to content

Instantly share code, notes, and snippets.

View CTimmerman's full-sized avatar

Cees Timmerman CTimmerman

View GitHub Profile
CTimmerman / psd.ksy
Created June 9, 2024 10:20 — forked from ertaquo/psd.ksy
Photoshop format definition (incomplete) for Kaitai Struct
id: psd
file-extension: psd
endian: be
- id: file_header
type: file_header
- id: color_mode_data
type: color_mode_data
- id: image_resources
CTimmerman / FixRealtekPoppingSound.ps1
Created January 16, 2024 19:16 — forked from supermarsx/FixRealtekPoppingSound.ps1
Fix popping sound on some Realtek sound cards, realtek audio crackling patch
# Enable Realtek driver power management, this is the default value
REG ADD "HKCU\Software\Realtek\RAVCpl64\PowerMgnt" /v "Enabled" /t REG_DWORD /d 1 /f
# Disable Realtek driver power management, sometimes fixes realtek popping sound
REG ADD "HKCU\Software\Realtek\RAVCpl64\PowerMgnt" /v "Enabled" /t REG_DWORD /d 0 /f
# Replace XXXX with the corresponding key that has "Realtek" in the "DriverDesc", find using regedit
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\XXXX\PowerSettings" /v "IdlePowerState" /t REG_BINARY /d "ffffffff" /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4d36e96c-e325-11ce-bfc1-08002be10318}\XXXX\PowerSettings" /v "PerformanceIdleTime" /t REG_BINARY /d "ffffffff" /f
# Example if class is in 0000
CTimmerman / epi_sir_basic.ipynb
Last active January 21, 2022 15:13 — forked from jph00/epi_sir_basic.ipynb
Basic SIR epidemic model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
CTimmerman /
Last active September 19, 2021 03:22
YouTube Stream Downloader
"""YouTube Stream Downloader
2021-08-16 v1.0 by Cees Timmerman
2021-09-18 v1.1 Better error handling. Revert to XML captions as conversion to SRT is broken in pytube 11.0.1 for
import logging, os, re
import pytube
from pytube.cli import on_progress
CTimmerman /
Created July 31, 2021 10:15
Collatz conjecture
"""Collatz conjecture. Inspired by
2021-07-31 by Cees Timmerman
def collatz(n: int) -> int:
return 3*n+1 if n%2 else n//2
def collatz_count(start: int) -> int:
step = 0
while True:

Heat and power

I have district heating from a combined heat and power plant, which should be 80+% efficient. A solar air to water heat pump could be more efficient at 29% * usually 200% but sometimes 400% (For reference, traditional gas boilers only go up to 94%.) = 58% to 116%, the latter might require ground instead of air. CO2 is a relatively safe refrigerant.

According to ChatGPT: The efficiency of a typical modern steam turbine in a power plant is around 30-40%. Fuel cells can achieve efficiencies in the range of 40% to 60% or even higher for solid oxide fuel cells (SOFCs). Those and molten carbonate fuel cells (MCFCs) are used in combined hea

CTimmerman /
Last active March 25, 2021 21:02
Convert floats to any base and back.
"""Converts floats to/from any base.
2021-03-25 v1.1 by Cees Timmerman"""
import math
def numeral(i):
CTimmerman /
Created February 24, 2021 11:36 — forked from nhymxu/
Flask vs Falcon vs FastAPI benchmark
gunicorn run:app --workers=9
gunicorn run:app --workers=9 --worker-class=meinheld.gmeinheld.MeinheldWorker

Macbook Pro 2015 Python 3.7

Framework Server Req/s Max latency +/- Stdev
CTimmerman /
Last active May 4, 2024 08:37
Windows sucks, too.

Windows sucks, too!



echo -e '"$RANDOM returns a pseudorandom integer between 0 and 32767" - False.'
(( r = 1 ))
until ((r <= 0 || r >= 32767))
(( r = $RANDOM ))
echo -e "$r.\nSemicolons replace newlines:"
(( r = 5)); while ((r < 10)); do echo $r; (( r ++ )); done
echo "Ranges include end:"