Skip to content

Instantly share code, notes, and snippets.

@dontlaugh
dontlaugh / client.go
Created April 8, 2024 18:57
xmpp connect and join muc
package xmpp
import (
"context"
"encoding/xml"
"fmt"
"io"
"log"
"os"
"os/exec"
packer {
required_plugins {
lxd = {
version = ">=1.0.0"
source = "github.com/hashicorp/lxd"
}
}
}
variable "buildkite_token" {}
@dontlaugh
dontlaugh / explanations.md
Last active October 3, 2023 23:13
Annotated Raku example: wrapping SSH/LXD commands

Explanations

In Raku, Lists can be constructed several ways.

# A list of strings: "one", "two", "three"
my @x = <one two three>;
# Using << >> allows interpolating variables
my $num = "six";
my @y = << four five $six >>;
@dontlaugh
dontlaugh / heredoc-syntax.raku
Created January 20, 2023 15:25
Template small files with Raku
#!/usr/bin/env raku
use v6.d;
# mention:
# priorities
# resource-based lb
my @gat-ids = [
(Q |Overprovisioning factor|, "https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/overprovisioning"),
];
@dontlaugh
dontlaugh / raku-files.md
Created May 30, 2022 18:28
How to package a Raku application?

Build Environment Setup

The CI runs in an LXD container. That container technology is more VM-like than Docker/OCI containers. For instance, you can easily run Docker containers inside LXD. That's why I like using it for CI.

The LXD container is built from a Packer file and scripts. That Packer file is here on my git server:

@dontlaugh
dontlaugh / kakoune_cheatsheet.txt
Last active May 29, 2022 23:05 — forked from lambda-mike/kakoune_cheatsheet.md
Kakoune cheatsheet (forked from lambda-mike)
# Kakoune
set verbose mode (good for learning)
`:set -add global autoinfo normal`
## Movement
### Goto
`10g` - go to line 10
@dontlaugh
dontlaugh / alternative.md
Created March 2, 2022 19:13
Alternative to the term "cargo cult" for technologists

Background

I was searching for an alternative and landed on this Stack Exchange question. There are a few good suggestions there.

But I don't have enough reputation on that site to answer. 🤷

TL;DR, a possible alternative is "shibboleth".

Example Usage

@dontlaugh
dontlaugh / notes.md
Created October 30, 2021 01:25
Go support for Meson

mesonbuild/meson#123

Motivation

I like Go a lot, but I'm looking for a more powerful tool for organizing my projects. Here's some of the things I could hopefully do in Meson if we added support

  1. build multiple executables with a varied set of params
  • for instance cross compile some
@dontlaugh
dontlaugh / cue_language_basics.md
Last active June 4, 2022 19:20
CUE language basics

Download the cue cli tool and follow along

CUE Basics

When CUE is exported to JSON, every value in every (processed) file is unified into one giant object.

% echo 'name: "Vlad"' > /tmp/name.cue
% echo 'disposition: "cheerful"' > /tmp/disposition.cue
@dontlaugh
dontlaugh / data.txt
Last active October 18, 2021 23:13
Parse a markdown table in Raku
| Name | Type | Default | Example | Description |
| :--- | :--- | :--- | :--- | :--- |
| rules | array | n/a | | A list of rules to compare to the incoming request. Rules are checked in order of appearance in the list. |
| rules.key | string | n/a | "Authorization" | The key to check in the incoming request |
| rules.location | enum\[header, cookie, queryString, metadata\] | header | cookie | The location to check for the specified key/value pair |
| rules.location | enum\[header, cookie, queryString, metadata\] | header | cookie | The locati
on to check for the specified key/value pair |
| rules.metadataFilter | string | "" | "gm.oidc-authentication" | The name of the filter to read dynamic metadata from. Required if rules.location=metadata |
| rules.enforce | bool | false | true | Whether to completely reject the request if a rule doesn't match |
| rules.enforceResponseCode | string | 403 | 500 | The status code to send back if a rule does not match and `enforce` is true. |