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 / Makefile
Last active October 1, 2024 13:13
AI Snake implementation based on https://www.youtube.com/watch?v=_UR3bi5xyaY
CC=zig cc
CFLAGS = -Wall -Wextra -Werror
INCLUDES = -I/usr/include/SDL2/
LIBS = -lSDL2
SRCS = aisnake.c
OBJS = $(SRCS:.c=.o)
MAIN = aisnake
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LIBS)
@peterhellberg
peterhellberg / w4on2-under-Linux.md
Last active September 26, 2024 18:42
w4on2 under Linux

w4on2 under Linux

git clone git@github.com:JerwuQu/w4on2.git
cd w4on2
cargo build --release

Note

There has been some minor changes in Zig ⚡,

@peterhellberg
peterhellberg / Jellybeans.ron
Last active September 24, 2024 15:59
Jellybeans theme for COSMIC terminal emulator
(
name: "Jellybeans",
foreground: "#E6E6CD",
background: "#141414",
cursor: "#FFB371",
bright_foreground: "#E6E6CD",
dim_foreground: "#E6E6CD",
normal: (
black: "#353534",
red: "#D35737",
@peterhellberg
peterhellberg / README.md
Last active September 20, 2024 11:51
razer-blade-14-2022-wifi

Razer Blade 14 (2022) WiFi

Razer Blade 14 (2022)

Problem

Running Linux on this machine isn't painless, specifically the wireless interface isn't being brought up by default.

Instructions

@peterhellberg
peterhellberg / go.mod
Created September 19, 2024 13:44
Example of github.com/tursodatabase/libsql-client-go/libsql usage
module experiments/libsql/libsql-example
go 1.23.0
require (
github.com/tursodatabase/libsql-client-go v0.0.0-20240902231107-85af5b9d094d
modernc.org/sqlite v1.33.1
)
require (
@peterhellberg
peterhellberg / build.zig
Last active September 16, 2024 08:02
HTTP GET request using Zig ⚡ 0.14.0-dev.1210+54e48f7b7
const std = @import("std");
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "whatthecommit",
.root_source_file = b.path("whatthecommit.zig"),
.target = b.standardTargetOptions(.{}),
.optimize = b.standardOptimizeOption(.{}),
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@peterhellberg
peterhellberg / C-Compilation-Process-Essentials.typ
Last active September 13, 2024 09:50
Trying out the cram-snap template for Typst
#import "@preview/cram-snap:0.1.0": cram-snap
#set page(
paper: "a3",
flipped: true,
margin: 1cm,
)
#set text(font: "Inter", weight: "regular", size: 8pt)
@peterhellberg
peterhellberg / build.zig
Last active September 11, 2024 16:00
A WebAssembly plugin for Typst
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
});
const hello = b.addExecutable(.{
.name = "hello",
@peterhellberg
peterhellberg / dos.zig
Created September 9, 2024 08:34
Example of using dos-like from Zig
const std = @import("std");
const c = @cImport({
@cInclude("dos.h");
});
pub const videomode_40x25_8x8: usize = 0;
pub const videomode_40x25_9x16: usize = 1;
pub const videomode_80x25_8x8: usize = 2;
pub const videomode_80x25_8x16: usize = 3;