Skip to content

Instantly share code, notes, and snippets.

View ConnorRigby's full-sized avatar
🏎️

Connor Rigby ConnorRigby

🏎️
View GitHub Profile
@ConnorRigby
ConnorRigby / Makefile
Last active July 8, 2023 22:41
Example TMX TileMap renderer with C++, OpenGL, GLM, GLFW, Glad and stb
all: test
test: test.cpp
$(CXX) test.cpp -o test -lglfw -lGL -lX11 -lpthread -lXrandr -lXi -ldl -Ilib/tmx/src/ -I glad/include -I lib/stb/ -Llib/tmx/build -ltmx -lxml2 -lz glad/src/glad.c
run: test
./test untitled.tmx
const std = @import("std");
const log = std.log.scoped(.Main);
const glfw = @import("glfw");
const zgl = @import("zgl");
const zlm = @import("zlm");
const Mat4 = zlm.Mat4;
const Shader = @import("Shader.zig");
const Texture = @import("Texture.zig");
const std = @import("std");
pub const Name = enum(u8) {
// register definition names
RegFifo = 0x00,
RegOpMode = 0x01,
RegDataModul = 0x02,
RegBitrate = 0x03,
// RegBitrateMsb = 0x03,
// RegBitrateLsb = 0x04,
RegFdev = 0x05,
@ConnorRigby
ConnorRigby / generator.exs
Last active December 28, 2022 19:01
generate zig structs from elixir structs from blue heron definitions
Mix.install([{:blue_heron, path: "../blue_heron"}])
defmodule ZBLE.Codegen do
@commands BlueHeron.HCI.Command.__modules__()
@events BlueHeron.HCI.Event.__modules__()
def gen_commands() do
# IO.inspect(@commands, pretty: true, limit: :infinity)
commands =
for command <- @commands do
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2022 STMicroelectronics.
* All rights reserved.</center></h2>
zig.h:351:12: error: implicit declaration of function 'zig_addw_u32'; did you mean 'zig_addo_u32'? [-Werror=implicit-function-declaration]
*res = zig_addw_u32(lhs, rhs, bits);
^~~~~~~~~~~~
zig_addo_u32
zig.h: In function 'zig_addo_u64':
zig.h:389:12: error: implicit declaration of function 'zig_addw_u64'; did you mean 'zig_addo_u64'? [-Werror=implicit-function-declaration]
*res = zig_addw_u64(lhs, rhs, bits);
^~~~~~~~~~~~
zig_addo_u64
zig.h: In function 'zig_addo_u8':
@ConnorRigby
ConnorRigby / Ender3-Cura-Profiles.md
Last active November 28, 2022 19:51
Ender3-Cura-Profiles
defmodule Test do
if __ENV__.file != "nofile" do
@original File.read!(__ENV__.file)
end
@doc false
def unquote(:"$handle_undefined_function")(function, args) do
arg_def = Enum.map(1..Enum.count(args)//1, fn i -> {:"_arg_#{i}", [], nil} end)
{:defmodule, meta, [aliases, [{:do, {:__block__, [], ast}}]]} = Code.string_to_quoted!(@original)
ast = Enum.reduce(ast, [], fn
defmodule NervesHubLinkCommon.Downloader do
@moduledoc """
Handles downloading files via HTTP.
internally caches several interesting properties about
the download such as:
* the URI of the request
* the total content amounts of bytes of the file being downloaded
* the total amount of bytes downloaded at any given time