Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@boooeee
boooeee / team_ranking_example.R
Last active March 3, 2024 18:00
This code derives a schedule/home field adjusted team ranking for a randomly generated set of games. The randomly generated games can be replaced with actual teams and outcomes from the sport of our choice.
library(tidyverse)
n_games <- 100
# Define the teams
teams <- c("rock", "paper", "scissors")
# simulated home advantage #
home_adv<-2
# Generate the data frame
@rcrowley
rcrowley / example.tf
Created February 15, 2024 17:56
The simplest custom internal tool, protected by the Substrate Intranet, BYO functionality
data "archive_file" "example" {
output_file_mode = "0666" # before umask
output_path = "${path.module}/example.zip"
source_file = "${path.module}/example/index.js"
type = "zip"
}
data "aws_apigatewayv2_apis" "substrate" {
name = "Substrate"
protocol_type = "HTTP"
@surma
surma / .gitignore
Created February 1, 2023 15:48
Wasm GC
*.wasm
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2
@tgross
tgross / vmctl
Created July 27, 2021 19:27
Fircracker virtual machine control script
#!/usr/bin/env bash
set -euo pipefail
help() {
cat <<EOF
vmctl [COMMAND] [ARGS]
Launch firecracker VMs from configuration templates with networks
managed by CNI. VM configuration is stored in $VM_CONFIG_DIR
and network configuration is stored in $NET_CONFIG_DIR
@gabrielsson
gabrielsson / minecraft-on-raspberry-pi.md
Last active April 12, 2024 15:49
Minecraft on Raspberry Pi cluster with metrics

alt

Minecraft on Raspberry Pi cluster with metrics

Ever wanted to put your Rapsberry Pi cluster to great use? Our team is working remotely, so we started to play Minecraft. I decided I would host the Minecraft server on my Raspberry Pi cluster. This gist will guide you through the steps I took to get a k3s cluster up with k3sup and later installed Minecraft as well as metrics exporter and Prometheus Operator

Why?

Quoniam Possumus - Because we can

You'll need

3 Ways to design the lightmap API

The purpose of the module is to create and update path-traced 2D lightmaps. For example, to create interesting dynamic top-down lighting in a 2D game.

Option 1: Trace on lightmap

lm := lightmap.New(image.Rect(0, 0, 100, 100))
light := lightmap.Light{
/*
Code to perform L1, L2 cache locality experiments
https://kaushikghose.wordpress.com/2020/01/27/profiling-and-improving-cache-performance/
*/
#include <iostream>
#include <vector>
const size_t N = 1200;
class Matrix {
@futpib
futpib / ext2scan.c
Last active September 6, 2022 12:09 — forked from countingpine/ext2scan.c
ext2scan: scan for ext2/ext3/ext4 partitions
/* ext2scan:
* Scans an input stream, sector by sector, for something that looks like an ext{2,3,4} partition.
* It does this by looking for a magic WORD, 0xEF53, at a known offset into the sector.
* For random data, this will occur by chance around once per 32MB of data, so we also
* check whether the first two sectors are all zeros, which is commonly true for ext partitions.
*
* Compile with:
* gcc ./ext2scan.c -o ./ext2scan
*
* Example usage: