Skip to content

Instantly share code, notes, and snippets.

Avatar
💙
Coding Go

Peter Hellberg peterhellberg

💙
Coding Go
View GitHub Profile
@peterhellberg
peterhellberg / alacritty.yml
Last active May 8, 2021
Alacritty configuration with Jellybeans colorscheme, and ⌘↵ to ToggleSimpleFullscreen
View alacritty.yml
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
env:
# TERM variable
#
# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
@peterhellberg
peterhellberg / gfx-kickstart-insert-floppy.go
Last active Apr 16, 2021
Renderer for an answer to "Why was the Kickstart 1.x “Insert floppy” graphic so bad?" https://retrocomputing.stackexchange.com/a/13940
View gfx-kickstart-insert-floppy.go
package main
import (
"image"
"image/draw"
"github.com/peterhellberg/gfx"
)
const width, height = 320, 200
@peterhellberg
peterhellberg / ebiten-gfx-noise-flow-field.go
Created Feb 19, 2021
Noise flow field using Ebiten and GFX
View ebiten-gfx-noise-flow-field.go
package main
import (
"image"
"github.com/hajimehoshi/ebiten/v2"
"github.com/peterhellberg/gfx"
)
func main() {
@peterhellberg
peterhellberg / gfx-vintage.go
Created Feb 16, 2021
Effect inspired by the Youtube video “Recreating Vintage Computer Art with Processing” https://www.youtube.com/watch?v=LaarVR1AOvs
View gfx-vintage.go
package main
import "github.com/peterhellberg/gfx"
const (
numLines = 16
frames = 300
)
func main() {
View core_input_mouse.zig
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 Jan 13, 2021
Advent Of Code 2020 - 01
View aoc-2020-01.zig
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);
View donut.go
package main
import (
"math"
"time"
)
func main() {
delay := 16 * time.Millisecond
coreString := ".,-~:;=!*#$@"
@peterhellberg
peterhellberg / Lesson01.diff
Created Sep 11, 2020
zigNeHe Lesson01 patched to compile with current zig master https://github.com/mypalmike/zigNeHe
View Lesson01.diff
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;
View tibber-graphql-query.go
package main
import (
"context"
"encoding/json"
"flag"
"os"
"time"
"github.com/c7/graphql"
@peterhellberg
peterhellberg / minimal.c
Created Aug 13, 2020
Trimmed down https://stackoverflow.com/a/59596600 to make it even more minimal
View minimal.c
// 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