Skip to content

Instantly share code, notes, and snippets.

View cfstras's full-sized avatar

Claus F. Strasburger cfstras

  • Düsseldorf, Germany
  • 21:46 (UTC +02:00)
View GitHub Profile
Note:
I wrote this in 2018 as part of a Hackathon for https://github.com/anuejn/muzikilo.js.
Upon reviewing just now, there seems to be a bug in the Decay-logic which makes every note work only once.
It's up to the reader to find and fix this bug ;)
If you do, please e-mail me the fix!
@cfstras
cfstras / 0 Ultimate Go build tool.md
Last active January 30, 2024 14:44
Ultimate Golang Build Tool, v2

Note (2024): This was written before Go had modules and workspaces, and even before tools like go dep and go vendor were mainstream. Nowadays, I don't think there's a good reason to use this, but it's still interesting to read for history purposes (IMO).


Intro

I like Go, especially the build system. But what I don't like is the build system:

/**
* I used to have this code configured in Eclipse (and later IntelliJ) as a custom display function for ByteBuffers.
* It's fairly useful for debugging binary protocol decoders that make heavy use of ByteBuffers.
*/
ByteBuffer d = this;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < d.limit; i++) {
sb.append(String.format(" %02x", d.array()[i]));
}
sb.append("\n");

Summary: This is a short how-to in German on using Google Compute Engine to host a Windows machine for Cloud Gaming with Parsec. I wrote it in April 2021, so it might be outdated and broken by now.


Hallo zusammen! Da ich sehr erfreut darüber bin, möchte ich dieses howto teilen, wie ich in einer Google-Cloud-Maschine zocken kann.

  1. GCP account erstellen: console.cloud.google.com
  2. Quota increase request für Compute Engine GPU (All Regions) auf 1 machen. nur 1! alles andere wird abgelehnt! Der Request sollte innerhalb von 5min per mail approved werden.

The script below is a rough outline to start using bpf tools on a WSL installation.

Sadly, WSL kernels don't ship with kernel headers, and there are also no pre-built perf packages available in the standard debian&ubuntu package repositories. They also do not seem to be built with bpf support enabled. So, in order to run both perf and any bpf tools from the great BPF Compiler Collection (bcc), we have to build all these things ourselves.

Hopefully you have a reasonably fast computer. This takes about half an hour total on a 32-core threadripper.

@cfstras
cfstras / 1_Using_Go_from_Rust.md
Last active December 3, 2023 22:01
Building & Calling go code from rust.

Using Go code from within Rust

This example, mostly stolen adapted from arranfrance.com, shows how to easily call into some go code from Rust.

Disclaimer: I have not used this in production, and would advise cautiosly reviewing ABI guarantees and threading considerations before doing so. For toy programs, and fun stuff such as solving half of an Advent-of-Code day in a second language, it seems to work without issues.

Main actors:

  1. main.go: Your Go code, with at least one exported CGo function. You can also import other go library as you wish.
@cfstras
cfstras / status.html
Last active February 6, 2023 03:24
Simple Minecraft Server status box using http://api.syfaro.net/
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<script>
var rq = '//api.syfaro.net/server/status';
var error = 'unknown';
var classes = {
error: "fa-question",
false: "fa-times",
true: "fa-check",
};
@cfstras
cfstras / mumble-build-m1.sh
Last active February 25, 2022 03:22
Script to compile mumble natively on an M1 Mac (using my branch cfstras/mumble:arm-m1-mac)
#!/bin/bash
# Notes on building Mumble on an M1 mac
set -euo pipefail
ARM=(arch -arm64)
BREW=(
/opt/homebrew/bin/brew
)
@cfstras
cfstras / _Notes for M1 Mac.md
Last active January 19, 2022 15:25
Notes for ARM

Notes for OSX on ARM M1 Macs

Here are some notes I am keeping on how I set up a development environment on my M1 mac.

Note: All of these should not be necessary anymore!

Rosetta

softwareupdate --install-rosetta
@cfstras
cfstras / setup_vpn_pi.md
Last active June 16, 2021 21:12
Setting up an OpenVPN Raspberry Pi for client devices