Skip to content

Instantly share code, notes, and snippets.

View pietersp's full-sized avatar

Pieter Prinsloo pietersp

View GitHub Profile
@pietersp
pietersp / InstantTest.sc
Created October 10, 2024 10:08
Play around with instant json
//> using scala 2.13.15
//> using dep "com.typesafe.play::play-json:2.10.6"
import play.api.libs.json.JsValue
import java.time.{Instant, ZoneId, ZoneOffset}
import play.api.libs.json.{Json, OFormat}
val actualInstant = Instant.parse("2022-01-01T00:00:00Z")
val timestamps = """
@pietersp
pietersp / ProtoValidator.sc
Created September 27, 2024 14:44
Validate json messages against protobuf schema
//> using scala 2.13.15
//> using dep "com.google.protobuf:protobuf-java:4.28.2"
//> using dep "com.google.protobuf:protobuf-java-util:4.28.2"
//> using dep "io.circe::circe-parser:0.14.10"
import com.google.protobuf.DescriptorProtos.FileDescriptorSet
import com.google.protobuf.Descriptors.{Descriptor, FileDescriptor}
import com.google.protobuf.DynamicMessage
import com.google.protobuf.util.JsonFormat
@pietersp
pietersp / playbook.sh
Created October 29, 2023 21:44
Fills in env vars in template and runs it on remote postgres
#!/bin/bash
# commands used in this script
required_commands=("gum" "envsubst")
# Ensure the required commands are installed
for cmd in "${required_commands[@]}"; do
if ! type "$cmd" &> /dev/null; then
echo "Error: $cmd not found in PATH. Please install it first:"
exit 1
fi
@pietersp
pietersp / hybrid_gpu_archcraft_laptop_setup.md
Last active March 6, 2025 20:51
Archcraft linux setup on Intel/Nvidia hybrid laptop

Setting up my Hybrid graphics Laptop with Archcraft Linux

Setting up hybrid graphics linux is generally painful with the current state of Nvidia support. If you can avoid getting an Nvidia GPU based laptop if you plan to use Linux. I use a distro called Archcraft and had some issues specific to my setup (distro/hardware)

The hardware I am installing this on is a TongFang GM6TG7W (aka Wootbook Extreme IV). It has an Intel iGPU and an Nvidia 3070 Max-Q dGPU.