Skip to content

Instantly share code, notes, and snippets.

View thebracket's full-sized avatar

Herbert "TheBracket" Wolverson thebracket

View GitHub Profile
@thebracket
thebracket / testbed.sh
Created March 4, 2024 13:57
My testbed setup script for LibreQoS
#!/bin/bash
# Set the number of rx/tx queues to create
NUM_QUEUES=1
## This script creates two `veth` devices, each in their own namespace.
## Each is assigned an address (192.168.66.1/30 and 192.168.66.2/30)
## They won't be able to ping each other until a bridge is made available.
## The idea is to simulate a middle-box setup (like `lqosd`), allowing
## `iperf` and other tests between the two.
@thebracket
thebracket / main.rs
Created February 16, 2024 18:40
Rust OzLotto
use anyhow::Result;
use itertools::Itertools;
use serde::Deserialize;
use std::fs::File;
#[derive(Debug, Deserialize)]
struct Row {
numbers: [u8; 9],
}
@thebracket
thebracket / Cargo.toml
Created January 6, 2022 15:31
Bevy 0.6 - Crash on custom mesh with tangents
[package]
name = "bevy_mesh_example"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = "0.5"
@thebracket
thebracket / Cargo.toml
Created November 6, 2021 13:59
Flappy Bonus - WASM edition
[package]
name = "flappy_bonus"
version = "0.1.0"
authors = ["Herbert Wolverson <herberticus@gmail.com>"]
edition = "2018"
[dependencies]
bracket-lib = { git = "https://github.com/amethyst/bracket-lib" }
@thebracket
thebracket / Cargo.toml
Created November 5, 2021 18:27
Very silly solution to https://twitter.com/pragprog/status/1456667629469552651 - I decided to make it as over-engineered as possible, and apply the "bogo" approach of randomly picking values and applying them.
[package]
name = "number_grouping_challenge"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bracket-random = "0.8"
@thebracket
thebracket / prime_fn.rs
Last active July 28, 2021 17:03
Simple Prime Calculator
fn is_prime(n: u32) -> bool {
for i in 2..=n/2 {
if n % i == 0 {
return false;
}
}
true
}
@thebracket
thebracket / flappy_frames.rs
Created July 22, 2021 13:13
Flappy Frames Enum
const DRAGON_FRAMES : [u16; 6] = [ 64, 1, 2, 3, 2, 1 ];
@thebracket
thebracket / flappy_render.rs
Created July 22, 2021 13:08
Flappy Render Function
fn render(&mut self, ctx: &mut BTerm) {
ctx.set_active_console(1);
ctx.cls();
ctx.set_fancy(
PointF::new(0.0, self.y),
1,
Degrees::new(0.0),
PointF::new(2.0, 2.0),
WHITE,
NAVY,
@thebracket
thebracket / flappy_flap.rs
Created July 22, 2021 13:06
Flappy Flap Function
fn flap(&mut self) {
self.velocity = -2.0;
}
@thebracket
thebracket / flappy_gravity.rs
Created July 22, 2021 13:05
Flappy Gravity
fn gravity_and_move(&mut self) {
if self.velocity < 2.0 {
self.velocity += 0.1;
}
self.y += self.velocity;
if self.y < 0.0 {
self.y = 0.0;
}