Skip to content

Instantly share code, notes, and snippets.

View peterhellberg's full-sized avatar
💙
Coding Go and Zig

Peter Hellberg peterhellberg

💙
Coding Go and Zig
View GitHub Profile
@peterhellberg
peterhellberg / ffmpeg-example.go
Created April 23, 2017 15:44
FFmpeg from Go usage example
package main
import (
"os/exec"
)
func newCmd(imageFile, audioFile, outFile string) *exec.Cmd {
return exec.Command("ffmpeg",
"-r", "1",
"-loop", "1",
@peterhellberg
peterhellberg / jelly.json
Created September 15, 2026 11:31
~/.claude/themes/jelly.json
{
"name": "jelly",
"base": "dark-ansi",
"overrides": {
"text": "#DDDDC5",
"inverseText": "#131313",
"inactive": "#8C8F80",
"inactiveShimmer": "#A8AB9C",
"subtle": "#605958",
@peterhellberg
peterhellberg / mattermost-theme-jelly.json
Created September 8, 2026 16:50
Jelly theme for Mattermost
{
"awayIndicator": "#F9CF75",
"buttonBg": "#44677F",
"buttonColor": "#FEFEFE",
"centerChannelBg": "#1A1A1A",
"centerChannelColor": "#F9F9F4",
"codeTheme": "monokai",
"errorTextColor": "#FF2600",
"linkColor": "#7492CF",
"mentionBg": "#44677F",
@peterhellberg
peterhellberg / gh-prs-alias.sh
Last active September 8, 2026 09:54
A gh prs alias
#!/usr/bin/env bash
# gh prs — list open PRs with their review status, which github.com/<owner>/<repo>/pulls
# no longer shows (the "Approved" checkmark was removed from the list view in late 2025).
#
# Status is derived from the review lists, not reviewDecision: GitHub leaves reviewDecision
# null in repos whose branch has no rule requiring an approval, even when approvals exist.
#
# "changes" and "commented" come from latestReviews, but "approved" comes from the full
# reviews history: latestReviews holds only the single most recent review per author, so a
# review comment left after an approval hides that approval. A later COMMENTED review does
@peterhellberg
peterhellberg / blank.sh
Created August 24, 2026 07:35
Blank terminal, reset on single keypress
#!/usr/bin/env bash
# Restore terminal on exit, interrupt, or termination
trap 'tput cnorm' EXIT INT TERM
# Clear the screen and hide the cursor
clear
tput civis
# Wait for a single keypress
@peterhellberg
peterhellberg / install-zig.sh
Created February 20, 2026 08:10
Basic install script for Zig tarballs, that symlinks ~/.local/bin/zig-<version> to the downloaded and extracted zig binary.
#!/usr/bin/env bash
set -euo pipefail
# ----------------------------
# Check arguments
# ----------------------------
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <zig-version>"
echo "Example: $0 0.15.2"
package main
import (
"flag"
"image"
"image/color"
"time"
"github.com/peterhellberg/gfx"
)
@peterhellberg
peterhellberg / jetpack-level-parser.go
Last active July 14, 2026 08:34
Level parser for Jetpack levels
package main
import (
"encoding/binary"
"flag"
"image"
"strings"
"github.com/peterhellberg/gfx"
)
@peterhellberg
peterhellberg / gt_draw_colors.c
Created May 27, 2026 18:45
Small example of drawing colors using the C SDK for GameTank
#include "gt/gfx/draw_queue.h"
char bx = 30, by = 20;
char dx = 1, dy = 1;
const int cw = 6, ch = 5;
const int sx = 8, sy = 6;
void update() {
bx += dx;
@peterhellberg
peterhellberg / mmmm-logo.zig
Last active May 13, 2026 19:32
NES MMMM logo display with shimmer palette animation using https://github.com/kassane/zig-mos-bootstrap
//! NES MMMM logo display with shimmer palette animation.
const neslib = @import("neslib");
/// Nametable address for tile at column `col`, row `row` on nametable A ($2000).
fn ntadr(col: u8, row: u8) u16 {
return 0x2000 | (@as(u16, row) << 5) | col;
}
/// 16×16 tile map for the mark, anchored at (logo_col, logo_row).
/// Generated from mmmm-mark.chr (CHR plane 0 only).