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 / gfx-kickstart-insert-floppy.go
Last active April 16, 2021 14:53
Renderer for an answer to "Why was the Kickstart 1.x “Insert floppy” graphic so bad?" https://retrocomputing.stackexchange.com/a/13940
package main
import (
"image"
"image/draw"
"github.com/peterhellberg/gfx"
)
const width, height = 320, 200
@peterhellberg
peterhellberg / ebiten-gfx-noise-flow-field.go
Created February 19, 2021 22:36
Noise flow field using Ebiten and GFX
package main
import (
"image"
"github.com/hajimehoshi/ebiten/v2"
"github.com/peterhellberg/gfx"
)
func main() {
@peterhellberg
peterhellberg / gfx-vintage.go
Created February 16, 2021 00:39
Effect inspired by the Youtube video “Recreating Vintage Computer Art with Processing” https://www.youtube.com/watch?v=LaarVR1AOvs
package main
import "github.com/peterhellberg/gfx"
const (
numLines = 16
frames = 300
)
func main() {
const std = @import("std");
const ray = @cImport({
@cInclude("raylib.h");
});
pub fn main() void {
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800;
@peterhellberg
peterhellberg / aoc-2020-01.zig
Last active January 13, 2021 16:30
Advent Of Code 2020 - 01
const std = @import("std");
const input = @embedFile("input");
const testing = std.testing;
const expect = testing.expect;
const print = std.debug.print;
pub fn main() anyerror!void {
var nums = try numberList(std.heap.page_allocator);
package main
import (
"math"
"time"
)
func main() {
delay := 16 * time.Millisecond
coreString := ".,-~:;=!*#$@"
@peterhellberg
peterhellberg / Lesson01.diff
Created September 11, 2020 10:05
zigNeHe Lesson01 patched to compile with current zig master https://github.com/mypalmike/zigNeHe
diff --git a/Lesson01/build.zig b/Lesson01/build.zig
index 7d1fc5b..83e4ee4 100644
--- a/Lesson01/build.zig
+++ b/Lesson01/build.zig
@@ -1,5 +1,5 @@
-const Builder = @import("std").build.Builder;
-const builtin = @import("builtin");
+const std = @import("std");
+const Builder = std.build.Builder;
package main
import (
"context"
"encoding/json"
"flag"
"os"
"time"
"github.com/c7/graphql"
@peterhellberg
peterhellberg / minimal.c
Created August 13, 2020 23:19
Trimmed down https://stackoverflow.com/a/59596600 to make it even more minimal
// based on https://stackoverflow.com/a/59596600
// Minimal Pure C code to create a window in Cocoa
// $ clang minimal.c -framework Cocoa -o minimal.app
#include <objc/runtime.h>
#include <objc/message.h>
#include <Carbon/Carbon.h>
#define cls objc_getClass
@peterhellberg
peterhellberg / webview-gui.go
Last active April 11, 2022 11:32
Webview GUI
package main
import (
"fmt"
"net"
"net/http"
"sync"
"text/template"
"github.com/zserge/webview"