Skip to content

Instantly share code, notes, and snippets.

Avatar

Paulo Köch pkoch

View GitHub Profile
View gpg_all_the_things.sh
#!/usr/bin/env bash
set -ueo pipefail
if [ -z "${1:-}" ]
then
echo "Please provide the recepient as the argument" >&2
exit 1
fi
View boring.rs
// 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 {
View gist:ea6b760854a1777bafafe3c4570d6f93
diff --git a/devenv/scripts/rebuild_docker_image.sh b/devenv/scripts/rebuild_docker_image.sh
index c798d4240e..6a7b788b51 100755
--- a/devenv/scripts/rebuild_docker_image.sh
+++ b/devenv/scripts/rebuild_docker_image.sh
@@ -17,6 +17,11 @@ USER_ID="$(id -u)"
USE_CACHE="true"
EXTRA_BUILD_ARGS=()
+if [[ -n "${OVERRIVE_USER_ID:-}" ]]
+then
View gist:9235ac4636e94e772bb793b8cbdefd03
diff --git a/devenv/scripts/rebuild_docker_image.sh b/devenv/scripts/rebuild_docker_image.sh
index c798d4240e..c1e7472289 100755
--- a/devenv/scripts/rebuild_docker_image.sh
+++ b/devenv/scripts/rebuild_docker_image.sh
@@ -17,6 +17,11 @@ USER_ID="$(id -u)"
USE_CACHE="true"
EXTRA_BUILD_ARGS=()
+if [[ -n "$OVERRIVE_USER_ID" ]]
+then
View gist:47581f9e310ca52ad3407e67c77742d1
# handbook-server
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index 51a0aef..ff22ce0 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -1,20 +1,21 @@
name: Run tests
on: [push]
View git-prune-squash-branches.sh
#!/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
View Errors: Faults, Failures, and Inconsistencies.md

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

View subs.json
{
"kind": "youtube#SubscriptionListResponse",
"etag": "z9iGJjS0K1-Eu7vB_kduMOCUjaU",
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 166,
"resultsPerPage": 5
},
"items": [
{
View game.lua
-- From https://nerdyteachers.com/Explain/Platformer/#full_code
--variables
function _init()
player={
sp=1,
x=59,
y=59,
w=8,
h=8,
View cabula.md

Listas

Criar vazia

l = []

Criar com elementos

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

Aceder a um index

l[0]

Contar elementos

len(l)

Adicionar um elemento