Skip to content

Instantly share code, notes, and snippets.

View CTimmerman's full-sized avatar
💭
Amazed at Microsoft's poor UX.

Cees Timmerman CTimmerman

💭
Amazed at Microsoft's poor UX.
View GitHub Profile
@CTimmerman
CTimmerman / MacOS_sucks.md
Last active September 18, 2025 12:27
MacOS sucks! Making MacOS less painful to use...

Fix horizontal scrolling in Chrome: defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE and restart Chrome. Fix autoscroll with AutoScroll.

  • Minimized windows don't even appear in Chrome's autocomplete!

Disable MacOS widget popover gesture via System Settings, "trackpad gestures", More Gestures, Notification Centre off.

Windows shortcut equivalents:

  • Alt+Enter or F11 = Cmd+Ctrl+F or Globe+F
  • Alt+Tab = Cmd+Tab (Switch app.) or Cmd+` (Switch app window.) No minimized windows. Witch is a bit slow but can cycle windows with Opt+Tab like Windows does, including the browser window you minimized to get to the one behind it, albeit without thumbnails. AltTab is better, also because it doesn't raise all w
@deeplook
deeplook / benchmark_fib.sh
Last active May 28, 2019 19:43
Benchmark using Fibonacci numbers with Python, Cython and PyPy.
#!/usr/bin/env bash
echo "Benchmark for Fibonacci numbers with Python3, Cython and PyPy"
echo '
def fib(n):
"Return the n-th Fibonacci number."
i = 0
a, b = 0, 1
if n < 2:
@CTimmerman
CTimmerman / SICP_Scheme_sucks.py
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))
225
2017-09-13 v1.0 Translated & benchmarked by Cees Timmerman
"""
from __future__ import print_function # For Python 2.
@brizandrew
brizandrew / server.py
Last active December 19, 2023 10:16
Simple Flask Webhook Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask, request
from urllib import unquote_plus
import json
import re
app = Flask(__name__)
@CTimmerman
CTimmerman / file_downloader.py
Last active September 8, 2024 08:40
Resume HTTP download proof of concept (POC) / minimum viable product (MVP). Let unstable internet be no problem working with pip on the road, please.
"""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
CTimmerman / index.html
Last active November 14, 2023 22:30
Hello world, React edition.
<html>
<!-- Thanks to https://medium.freecodecamp.org/learn-react-js-in-5-minutes-526472d292f4 -->
<head>
<script src="https://unpkg.com/react@15/dist/react.min.js">//React controllery stuff.</script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js">//More React controllery stuff.</script>
<script src="https://unpkg.com/[email protected]/babel.min.js">//Translates JSX to JS.</script>
</head>
<body>
<div id="root">Target node for our React code.</div>
<script type="text/babel">
@nhymxu
nhymxu / README-python-framework-benchmark.md
Last active September 25, 2025 18:23
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
CTimmerman / coal_vs_coal_ash_energy_content.md
Last active May 15, 2025 17:35
Coal ash contains more energy than was gained from burning the coal.

Coal ash contains more energy than was gained from burning the coal.

https://www.world-nuclear.org/information-library/facts-and-figures/heat-values-of-various-fuels.aspx

Natural uranium, in FNR                28,000,000 MJ/kg [so 28e9 J/g]
Hard black coal (IEA definition)            >23.9 MJ/kg
Hard black coal (Australia & Canada)        c. 25 MJ/kg [so 25e3 J/g and 207.25 g/mol according to https://pubchem.ncbi.nlm.nih.gov/compound/1-Anthrylmethanolate]
Sub-bituminous coal (IEA definition)    17.4-23.9 MJ/kg
Sub-bituminous coal (Australia & Canada)    c. 18 MJ/kg
Lignite/brown coal (IEA definition)         <17.4 MJ/kg
function _draw()
cls(8)
srand(5)
-- Iterate every 8 square pixels of the screen.
-- The `.5` is to make sure the points are at the center of each pixel.
-- We'll draw one wall of the maze in each square.
for y=.5,129,8 do
for x=.5,129,8 do
-- Progress in the rotation cycle. One rotation is [0..1]
@CTimmerman
CTimmerman / fail.md
Last active October 4, 2025 12:05
Tech fails

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

Audio

  • 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