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 / 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() {
@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 (
"image"
"image/color"
"math"
"math/rand"
"time"
"github.com/peterhellberg/natsdraw"
@peterhellberg
peterhellberg / ebiten-gfx-blocks.go
Last active November 11, 2020 15:23
Blocks rendered by Ebiten with gfx.
package main
import (
"github.com/hajimehoshi/ebiten"
"github.com/peterhellberg/gfx"
)
const (
title = "Ebiten GFX Blocks"
scale = 4
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;
@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 / pixel-particles.go
Created July 22, 2017 11:08
pixel-particles.go
package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"math"
"math/rand"
"time"
@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();