Skip to content

Instantly share code, notes, and snippets.

View pbsds's full-sized avatar
🐢
move slow and fix things

Peder Bergebakken Sundt pbsds

🐢
move slow and fix things
View GitHub Profile
@Mic92
Mic92 / scrape-prs.py
Created October 22, 2023 05:57
Scrape all nixpkgs pull requests
#!/usr/bin/env python3
import http.client
import json
import os
import time
import urllib.parse
import urllib.request
from pathlib import Path
from typing import Any
@lorenzleutgeb
lorenzleutgeb / committer-progress.sh
Last active May 1, 2024 07:09
Nixpkgs Committer Progress
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash gh
set -eu
# See <https://gist.github.com/lorenzleutgeb/239214f1d60b1cf8c79e7b0dc0483deb>.
# Will exit non-zero if not logged in.
gh auth status
if [ $# == 1 ]
@bitingsock
bitingsock / cycle-adevice.lua
Last active January 29, 2024 03:10
Cycle through available audio devices with key binds(shift+a,ctrl+a). Change "wasapi" on line 1 to your relevant audio api.
local api = "wasapi"
local deviceList = mp.get_property_native("audio-device-list")
local aid = 1
local function cycle_adevice(s, e, d)
mp.enable_messages("error")
while s ~= e + d do -- until the loop would cycle back to the number we started on
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then
while true do
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far
s = #deviceList + 1 --so lets restart at the last device

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)