Skip to content

Instantly share code, notes, and snippets.

View CTimmerman's full-sized avatar

Cees Timmerman CTimmerman

View GitHub Profile
CTimmerman /
Last active July 9, 2024 15:34
Tech fails

If you don't learn from the past you're doomed to repeat it.


  • Dell Latitude 5501 sounds even worse than my MSI MS-16P7 due to ratting its plastic case. Interviews sound like a poor phone connection. Iron Maiden - Can I Play With Madness on the other hand is tolerable and even has some bass, almost enough for Robbie Williams - Angels, which sounds like a not-quite-tuned FM radio for the vocals (too little power), particularly noticable on U2 - Discotheque. Without "audio enhancements" disabled, its audio jack adds a rumble to videos like this. Worst audio hardware I've ever used, especially playing this. Then again, using my Logi
CTimmerman / bookmarklets.js
Last active July 5, 2024 20:29
Bookmarklets / Favelets - Drag to bookmarks bar and rename, then click on page to affect.
// Speed up / slow down HTML5 videos! Just set as URLs of bookmark bar items:
javascript:(function(){v = []; for(x of document.querySelectorAll("audio, video")) v.push(x); try{v.push(window.frames[0].document.querySelector("audio, video"))}catch(ex){}; for(i of v) i.playbackRate += .4}())
javascript:(function(){v = []; for(x of document.querySelectorAll("audio, video")) v.push(x); try{v.push(window.frames[0].document.querySelector("audio, video"))}catch(ex){}; for(i of v) i.playbackRate -= .4}())
// Highlight new Facebook notifications.
javascript:(function(){var s = document.createElement('style'); s.appendChild(document.createTextNode(".jewelItemNew ._33e{background-color:lightgreen!important;}")); document.head.appendChild(s)}())
// Show videos from messy framework HTML, can't show toolbar in popup due to Chrome bug 82522.
javascript:(function(){var;var d=w.document;d.title='Videos';'0';for(var v of document.getElementsByTagName('video')){'';v.controls
CTimmerman / Tech
Last active July 4, 2024 19:36
Technology preferences / tech prefs.

My Technology Preferences


A PC laptop/notebook with 16+ GB RAM, Nvidia GPU for stability (hardware manufacturers seem notoriously bad at software, but Nvidia is relatively good if you ignore the Experience app that demands your data, and training AI needs 50 GB VRAM nowadays but 80 GB is 10x the price of 24 GB), Linux and Wine and/or Windows 10 > expensive, hard-to-customize MacBook with MacOS (needs Spectacle and HyperSwitch to almost be as good as Windows 10), flimsy adapter wire and too many proprietary connectors. Preferably a 14+" matte Full HD (UHD is only useful at 23+" or equivalent in VR) Super AMOLED (except that burns in) [display](http

CTimmerman / Windows_oneliners.bat
Last active June 15, 2024 22:21
Oneliners, single line scripts.
rem Show WiFi password
netsh wlan show profile name="MyNetwork" key=clear
rem Fix software BSOD as Administrator. Problems not already fixed by DISM SFC will log in %windir%\logs\cbs\cbs.log
dism /Online /Cleanup-Image /RestoreHealth
sfc /scannow
rem Fix hardware sectors as Administrator (takes hours so run overnight)
chkdsk C: /r
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 / .prospector.yaml
Last active May 16, 2024 04:45
Out Of Memory (OOM) Killer to save your SSD and other processes.
- line-too-long
- multiple-imports
- pointless-string-statement
- too-many-nested-blocks
CTimmerman /
Last active May 15, 2024 17:00
Simple git workflow
  1. Install Git distributed version control software.
  2. Set up your default credentials (or display without a value to set):
$ git config --global "John Doe"
$ git config --global

or if he's a GitHub user, so you see his icon:

For example on MacOS:

CTimmerman /
Last active May 4, 2024 08:37
Windows sucks, too.

Windows sucks, too!



CTimmerman /
Last active May 2, 2024 19:11
Resume HTTP download
"""Download with automatic resume.
2018-06-28 v1.0 by Cees Timmerman
2018-07-09 v1.1 Added If-Unmodified-Since header for consistency."""
import os, shutil, sys, time
import requests # python -m pip install requests
def download_file(url, local_filename=None):
if not local_filename:
local_filename = url.split('/')[-1]
CTimmerman /
Created September 13, 2017 12:06
Proving that simple for loops are faster for both man and machine.
""" SICP section 2.2.3, page 160.
We can rearrange the pieces and use them in computing the product of the squares of the odd integers in a sequence:
(define (product-of-squares-of-odd-elements sequence) (accumulate * 1 (map square (filter odd? sequence))))
(product-of-squares-of-odd-elements (list 1 2 3 4 5))
2017-09-13 v1.0 Translated & benchmarked by Cees Timmerman
from __future__ import print_function # For Python 2.