Skip to content

Instantly share code, notes, and snippets.

View pkoch's full-sized avatar

Paulo Koch pkoch

View GitHub Profile
bolota
description: Desktop Computer
product: MS-7D78 (To be filled by O.E.M.)
vendor: Micro-Star International Co., Ltd.
version: 1.0
serial: To be filled by O.E.M.
width: 64 bits
capabilities: smbios-3.5.0 dmi-3.5.0 smp vsyscall32
configuration: boot=normal chassis=desktop family=To be filled by O.E.M. sku=To be filled by O.E.M. uuid=e78d7602-8562-b81b-a3cb-047c16570806
*-core
@pkoch
pkoch / openpgp.md
Last active January 21, 2023 20:22

openpgp4fpr:7cf89adcda4cb27d18a943e4f6b4b93498a0c85d

This file has been truncated, but you can view the full file.
"Using address: 0x57E578C7862E76be54a7DcF6D6338C8429e705F3"
"Current allowance: 1126399999999999999997550"
"Number of recipients: 8725"
"Total FCL: 1126399.99999999999999755"
{
"hash": "0x3bbc29315aab095e528bceea7d569b79ede3b96f2b2a3b17caa52faca79fcafb",
"blockHash": null,
"blockNumber": null,
"transactionIndex": null,
"confirmations": 0,
#!/usr/bin/env bash
set -ueo pipefail
if [ -z "${1:-}" ]
then
echo "Please provide the recepient as the argument" >&2
exit 1
fi
// I wish I could use creates. :(
use std::collections::HashSet;
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct DecodeError(String);
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u8)]
enum Rank {
#!/bin/bash
for BRANCH in `git branch | grep -v '^*'`; do
if [ "$(git cherry origin/main $BRANCH | grep -c '^+')" -eq '0' ]; then
git branch -D $BRANCH
fi
done

https://gist.github.com/pkoch/ed52f4635a92d1028d511363efee9758

There's a few codebases I've worked on that don't give errors enough consideration, and details about them are readily swept under a carpet. They return None left and right, regardless of what came in their way. This lack of consideration and communication of the nature of the problem makes dealing with it largely impossible.

I consider that, until the end of last decade, ergonomic error handling in programming languages (and respective standard libraries) has felt mostly like an afterthought. Some of them (/me looks menacingly to PHP and JavaScript) tried to pretend they didn't have to be a thing. Things are now feeling differently, especially so when I look at Rust and Swift.

I have a clear idea of how to "do errors right". This is me expressing my opinion.

Terminology

When talking about errors, I often see incoherent terminology, so I'll establish my own. These are all leaky buckets -- I can't really offer formal definitions -- but I ne

-- From https://nerdyteachers.com/Explain/Platformer/#full_code
--variables
function _init()
player={
sp=1,
x=59,
y=59,
w=8,
h=8,
@pkoch
pkoch / cabula.md
Last active October 24, 2020 21:40

Listas

Criar vazia

l = []

Criar com elementos

l = [1, 'popo', [], {}]

Aceder a um index

l[0]

Contar elementos

len(l)

Adicionar um elemento