Skip to content

Instantly share code, notes, and snippets.

View benjamin051000's full-sized avatar

Benjamin Wheeler benjamin051000

View GitHub Profile
@benjamin051000
benjamin051000 / spinny.sh
Created December 30, 2023 17:27 — forked from mothdotmonster/spinny.sh
spin your monitor around, slowly but surely
#!/bin/bash
# make sure we're not on Wayland, because xrandr doesn't work on Wayland
if [ "$(loginctl show-session $(loginctl user-status $USER | grep -E -m 1 'session-[0-9]+\.scope' | sed -E 's/^.*?session-([0-9]+)\.scope.*$/\1/') -p Type | grep -ic "wayland")" -ge 1 ]; then # stolen from stackoverflow
echo "You aren't using X!"
exit
fi
# no more annoying cursor
tput civis
@benjamin051000
benjamin051000 / duff.c
Created August 22, 2023 06:25
duff's device: literal spaghetti code!
/**
* A demonstration of Duff's Device,
* which entangles a switch/case statement
* with another C idiom, like a do/while.
*
* https://en.wikipedia.org/wiki/Duff%27s_device
*/
#include <stdlib.h>
#include <stdio.h>
@benjamin051000
benjamin051000 / c-tools.h
Last active February 24, 2023 17:56
Some useful tools I use when I write C to make it a little nicer
/**
* c-tools.h
*
* My collection of useful stuff that C doesn't come with
*/
#ifdef RUSTY_INT_TYPES
#include <stdint.h>
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
@benjamin051000
benjamin051000 / vga_simulator.py
Last active February 24, 2023 04:40 — forked from pvieito/VGASimulator.py
View VGA frames from an HDL simulation
"""
VGASimulator.py - Pedro José Pereira Vieito © 2016
View VGA output from a VHDL simulation.
Ported from VGA Simulator:
https://github.com/MadLittleMods/vga-simulator
by Eric Eastwood <contact@ericeastwood.com>
More info about how to generate VGA output from VHDL simulation here:
http://ericeastwood.com/blog/8/vga-simulator-getting-started
@benjamin051000
benjamin051000 / fpga-tips.md
Last active July 8, 2024 03:05
FPGA pro tips
@benjamin051000
benjamin051000 / c_cpp_properties.json
Created April 3, 2022 17:44 — forked from nouredd2/c_cpp_properties.json
Config options for using VSCode for kernel module development.
{
"configurations": [
{
"name": "Linux",
"browse": {
"path":[
"/usr/include",
"/usr/local/include",
"/usr/src/linux-headers-5.8.0-41-generic/include",
"/usr/src/linux-headers-5.8.0-41-generic/arch/x86/include/",