Skip to content

Instantly share code, notes, and snippets.

View peterhellberg's full-sized avatar
💙
Coding Go

Peter Hellberg peterhellberg

💙
Coding Go
View GitHub Profile
@peterhellberg
peterhellberg / docs_step.zig
Created March 4, 2025 09:02
Zig build step for emitting docs by calling `zig build docs`
const docs_step = b.step("docs", "Emit docs");
const docs_install = b.addInstallDirectory(.{
.install_dir = .prefix,
.install_subdir = "docs",
.source_dir = exe.getEmittedDocs(),
});
docs_step.dependOn(&docs_install.step);
function dl(n) {
setTimeout(function(){
document.querySelector('span[class^="Notification-module_close__"]').click();
}, 500);
var more = document.querySelectorAll('div[class^="Dropdown-module_container__"]');
more[n].click();
more[n].querySelector('div[id^="DOWNLOAD_AND_TRANSFER_ACTION_"]').click();
more[n].querySelector('label[class^="RadioButton-module_radio_container__"] input').click();
@peterhellberg
peterhellberg / ff-emu.go
Last active February 6, 2025 10:57
Rudimentary emulator for Firefly Zero written in Go
package main
import (
"context"
"flag"
"fmt"
"image"
"image/color"
"image/draw"
"io"
@peterhellberg
peterhellberg / unzipzstd.go
Last active February 5, 2025 15:11
A quick and dirty decompressor for Firefly Zero carts (Which are Zip files compressed using ZSTD) - https://docs.fireflyzero.com/internal/formats/#rom
package main
import (
"archive/zip"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strings"
@peterhellberg
peterhellberg / imgur-assets-dl.go
Created February 5, 2025 11:19
Small script that downloads images I publish on Imgur to my own server
package main
import (
"errors"
"flag"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
@peterhellberg
peterhellberg / fishes.go
Last active January 27, 2025 21:23
Minimal parametric JSON file store in Go
package main
import (
"encoding/json"
"io"
"os"
"path/filepath"
"sync"
)
@peterhellberg
peterhellberg / .wezterm.lua
Created January 16, 2025 14:56
WSL:Debian version of my WezTerm configuration
local wezterm = require 'wezterm';
return {
default_domain = 'WSL:Debian',
prefer_egl = true,
max_fps = 165,
automatically_reload_config = true,
font = wezterm.font('Office Code Pro D', {
weight = 'Regular',
italic = false
@peterhellberg
peterhellberg / Qwixx.typ
Last active January 3, 2025 15:35
Qwixx Score Sheet implemented in Typst
#let red = red.desaturate(70%);
#let yellow = yellow.desaturate(70%);
#let blue = blue.desaturate(70%);
#let green = green.desaturate(70%);
#let gray = gray.lighten(20%);
#let black = black.lighten(10%);
#let lightgray = gray.lighten(70%);
#show table.cell: it => {
if it.x > 0 and it.y == 5 {
@peterhellberg
peterhellberg / build.zig
Created October 10, 2024 09:06
MicroW8 example https://github.com/exoticorn/microw8/tree/master/examples/zig updated to current versions of Zig ⚡
const std = @import("std");
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "cart",
.root_source_file = b.path("main.zig"),
.target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
}),
@peterhellberg
peterhellberg / .gitignore
Last active October 3, 2024 14:37
Variant of the Olive.c example flag_jp.c 🇯🇵 in Zig ⚡, this time generating the Swedish flag 🇸🇪
zig-out
.zig-cache