Skip to content

Instantly share code, notes, and snippets.

View CTimmerman's full-sized avatar

Cees Timmerman CTimmerman

View GitHub Profile
@CTimmerman
CTimmerman / Tech prefs.md
Last active April 18, 2024 19:38
Technology preferences / tech prefs.

My Technology Preferences

Hardware

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
CTimmerman / fail.md
Last active April 17, 2024 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 Logi
@CTimmerman
CTimmerman / SVG_to_PNG.js
Last active April 5, 2024 12:26
Convert SVG to PNG / save SVG as PNG
// SVG2PNG
// By Cees Timmerman, 2024-04-05.
// Paste into console and adjust indices as needed.
let im = document.getElementsByTagName('img')
let fname = location.href
if (im.length < 1) {
let svg = document.getElementsByTagName('svg')[0]
let bb = svg.getBBox()
im = new Image(bb.width, bb.height)
im.src = 'data:image/svg+xml;charset=utf-8;base64,' + btoa(document.getElementsByTagName('svg')[0].outerHTML)
@CTimmerman
CTimmerman / Windows_oneliners.bat
Last active April 4, 2024 07:42
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
CTimmerman / rainbow.py
Last active March 27, 2024 02:43
Rainbow terminal console text and/or background
"""Rainbow print loop using ANSI escape sequences. Press Ctrl+C to stop.
By Cees Timmerman
2020-03-06 First version.
2024-03-27 Fixed on Windows 11."""
import time
CSI = "\x1b[" # Control Sequence Introducer.
# https://en.wikipedia.org/wiki/ANSI_escape_code#Fe_Escape_sequences
# On Windows 11, C1 control code 155 "\x9b" only works the same in VS Code.
# https://github.com/microsoft/terminal/issues/10310
@CTimmerman
CTimmerman / simple_git_workflow.md
Last active March 26, 2024 19:06
Simple git workflow
  1. Install Git distributed version control software.
  2. Set up your default credentials:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

or if he's a GitHub user, so you see his icon: johndoe@users.noreply.github.com

For example on MacOS:

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
CTimmerman / Windows_sucks.md
Last active March 24, 2024 21:03
Windows sucks, too.

Windows sucks, too!

Audio

Apps

@CTimmerman
CTimmerman / coal_vs_coal_ash_energy_content.md
Last active March 18, 2024 20:32
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
@CTimmerman
CTimmerman / bench.py
Last active March 6, 2024 14:57 — forked from marians/bench.py
Python serialization benchmark
"""
Python serialization benchmark
Based on https://gist.github.com/marians/f1314446b8bf4d34e782
2014-11-11 v1.0
2014-11-12 v1.1 Added compression and output size.
"""
try: import cPickle
except: import pickle as cPickle # don't break in Python 3
import json, marshal, pickle, random
from hashlib import md5