Skip to content

Instantly share code, notes, and snippets.

@uucidl
uucidl / real_mode_boot.c
Last active May 23, 2020
legacy bios bootsector
View real_mode_boot.c
// -*- mode: c ; c-file-style: "k&r" -*-
// x86 boot sector.
//
// Once you execute this program you will get a series of disk images, which you can try in qemu:
// qemu -drive file=boot.img,format=raw
//
// and burn to a usb stick using something like rufus or dd
#include <assert.h>
#include <stdlib.h>
@uucidl
uucidl / wm.el
Created Apr 5, 2020 — forked from pervognsen/wm.el
Dynamic tiling window manager for Emacs (inspired by dwm/awesome/xmonad for Linux)
View wm.el
(require 'cl)
(defstruct wm-window buffer (point 0) (start 0) (hscroll 0) dedicated)
(defvar wm-windows)
(defvar wm-windows-alist)
(defvar wm-focus)
(defvar wm-workspace 0)
(defvar wm-workspaces nil)
(defvar wm-layout 0)
@uucidl
uucidl / compilation_times.md
Last active Mar 31, 2020
Notes about compilation time
View compilation_times.md
View bitwise-notes-62.md

Bitwise Day 62: Indexed Arrays

Per worked 20h since Day 61.

How do we get a good story for dynamic arrays? What we called stretchy bufs (buf_... API)

Added many new intrinsics to gen_intrinsic:

  • apush, kadd, kdget, kdel
  • hget, hdel
@uucidl
uucidl / ibbq-thermometer-protocol.md
Last active Jul 21, 2020
ibbq-thermometer-protocol
View ibbq-thermometer-protocol.md

Example devices:

  • Inkbird IBT-2X

  • EasyBBQ FCCID: FCC ID 2AI4MPRO3 (SHENZHEN HYPERSYNES CO.,LTD Smart Wireless Thermometer PRO3)

  • @ConnectTimeout: 60 seconds

  • @BatteryPollingInterval: 5 minutes

The iBBQ is a Bluetooth LE Gatt Device

@uucidl
uucidl / traverse_children.ion
Last active Dec 9, 2018
Traversing Hierarchies
View traverse_children.ion
// Depth first traversal algorithm.
//
// (credit to Alexander Stepanov in Elements Of Programming)
//
// One of the benefits is that the visitor can implement pre or post traversal algorithms, and combine them in one single piece.
//
// @generic in T, the node value type
func traverse_children_recursively(tree_root: T*, step_visitor: func(step: TraversalStep, node: T*))
{
step_visitor(TraversalStep_PRE, tree_root);
@uucidl
uucidl / test_metal_with_sdl2.c
Created Nov 11, 2018
Testing metal on my macs. My dear Mac Mini does not support it
View test_metal_with_sdl2.c
#include "SDL2.framework/Headers/SDL.h"
#define sdl2_guard(__expr) \
if ((__expr) != 0) { \
fprintf(stderr, "SDL Error: '%s'\n", SDL_GetError()); \
assert(0); \
}
#include <assert.h>
@uucidl
uucidl / README.md
Last active Oct 29, 2018
Rokusa (Pure)
View README.md

Some useful code written in ion

@uucidl
uucidl / 00ctztree.md
Last active Oct 24, 2018
Octave Tree
View 00ctztree.md

CTZTree

A tree can be produced by counting the number of trailing zeros from an input integer index.

This count ('c') of trailing zeros (or position of the lowest bit) comes back every 2^c sample, i.e. corresponds to a frequency of 2^-c

Furthermore every sample corresponds with one and only one octave.

View ZZ_CodeResources.md
You can’t perform that action at this time.