Skip to content

Instantly share code, notes, and snippets.

View kaar's full-sized avatar

Caspar Nettelbladt kaar

  • Tibber
  • Sweden
View GitHub Profile

Rob Pike's 5 Rules of Programming

  1. You can't tell where a program is going to spend its time.

    • Bottlenecks occur in surprising places, so don't try to second guess and put in a speed hack until you've proven that's where the bottleneck is.
  2. Measure.

    • Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.
  3. Fancy algorithms are slow when n is small, and n is usually small.

  • Fancy algorithms have big constants. Until you know that n is frequently going to be big, don't get fancy. (Even if n does get big, use Rule 2 first.)

Informational (1xx)

100 Continue 101 Switching Protocols 102 Processing

Success (2××)

200 OK 201 Created 202 Accepted 203 Non-authoritative Information

@kaar
kaar / pyversion.sh
Last active October 3, 2023 09:12
Bump pyproject.toml version, create release by pushing git tag
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
PROJECT_FILE=pyproject.toml
# Usage:
# ./pyversion.sh # Show current version
echo | set /p="hGffy8ax5n6U" | clip
explorer steam://rungameid/892970
#!/usr/bin/env bash
ACCESS_TOKEN=$(<access-token)
HEADER_AUTH="Authorization: token ${ACCESS_TOKEN}"
[[ ! -z "$1" ]] \
&& curl --silent -H "$HEADER_AUTH" https://raw.githubusercontent.com/$1/master/README.md &> /dev/stdout \
|| echo "Missing repository $1"
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
ACCESS_TOKEN=$(<access-token)
HEADER_ACCEPT="Accept: application/vnd.github.v3+json"
HEADER_AUTH="Authorization: token ${ACCESS_TOKEN}"
ORG=$1
@kaar
kaar / The Nightmare That Is a Reality - Arthur Koestler
Created January 18, 2021 08:49
New York Times, January 9, 1944 Arthur Koestler writes about his attempt to inform the world about the ongoing atrocities in Polen during WW2. Arthur Koestler, a native of Hungary, is a newspaper man and author. He was imprisoned and sentenced to death in Spain during the civil war. Reprieved, he went to France and was imprisoned there early in …
# The Nightmare That Is a Reality - Arthur Koestler
[Source](https://www.nytimes.com/1944/01/09/archives/the-nightmare-that-is-a-reality-the-grim-stories-of-nazi-atrocities.html)
**There** is a dream which keeps coming back to me at almost regular
intervals; it is dark and I am being murdered in some kind of thicket
or brushwood; there is a busy road at no more than ten yards distance;
I scream for help but nobody hears me, the crowd walks past laughing
and chatting.
I know that a great many people share, with individual variations,