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 / hellos.diff
Last active June 24, 2020 17:57
HellOS patched to compile using Zig 0.6.0 https://github.com/andrewrk/HellOS
diff --git a/hellos.zig b/hellos.zig
index 8563852..506f2c9 100644
--- a/hellos.zig
+++ b/hellos.zig
@@ -20,8 +20,9 @@ export var multiboot align(4) linksection(".multiboot") = MultiBoot{
export var stack_bytes: [16 * 1024]u8 align(16) linksection(".bss") = undefined;
const stack_bytes_slice = stack_bytes[0..];
-export nakedcc fn _start() noreturn {
- @newStackCall(stack_bytes_slice, kmain);
@peterhellberg
peterhellberg / ebiten-gfx-bookmark.go
Created June 6, 2020 20:53
Bookmark SDF rendered by Ebiten using gfx
package main
import (
"github.com/hajimehoshi/ebiten"
"github.com/peterhellberg/gfx"
)
type Game struct {
gfx.Vec
Image *gfx.Paletted
@peterhellberg
peterhellberg / build.zig
Last active June 30, 2020 09:50
sdl-zig-demo (https://github.com/andrewrk/sdl-zig-demo) made to work with zig 0.6.0
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("sdl-zig-demo", "src/main.zig");
exe.setBuildMode(mode);
exe.linkSystemLibrary("SDL2");
exe.linkSystemLibrary("c");
exe.install();
@peterhellberg
peterhellberg / Makefile
Created May 12, 2020 09:33
Example of c-shared libhello.so
.PHONY: all build compile clean
all: build compile
build:
go build -buildmode=c-shared -o libhello.so libhello.go
compile:
cc -o hello hello.c libhello.so
clean:
@peterhellberg
peterhellberg / nimgobus-example.go
Last active April 30, 2020 20:42
Nimgobus example without package global variables
package main
import (
_ "image/png"
"time"
"github.com/adamstimb/nimgobus"
"github.com/hajimehoshi/ebiten"
)
@peterhellberg
peterhellberg / acnl.go
Last active April 17, 2020 11:50
Initial version of a parser for ACNL pattern files
package acnl
import (
"bytes"
"encoding/binary"
"image"
"image/color"
"io"
"io/ioutil"
)
@peterhellberg
peterhellberg / 46elks-sms-history.go
Created April 10, 2020 12:45
Retrieve SMS History from 46elks via their API as documented on https://46elks.com/docs/sms-history
package main
import (
"encoding/json"
"flag"
"fmt"
"net/http"
"net/url"
"os"
)
@peterhellberg
peterhellberg / bouncing-pixels.go
Created March 29, 2020 12:35
Drawing to the RPi (SenseHat) framebuffer over the network
package main
import (
"bufio"
"bytes"
"image/color"
"image/draw"
"net/http"
"time"
package main
import (
"flag"
"image"
"image/color"
"time"
"github.com/peterhellberg/gfx"
)
@peterhellberg
peterhellberg / gui-twisting-column.go
Created March 1, 2020 21:03
Twisting column using gui (and gfx) inspired by https://trasevol.dog/2018/01/24/di20/
package main
import (
"image"
"image/draw"
"time"
"github.com/peterhellberg/gfx"
"github.com/peterhellberg/gui"
)