Skip to content

Instantly share code, notes, and snippets.

View mmastrac's full-sized avatar

Matt Mastracci mmastrac

View GitHub Profile
#!/bin/bash
set -euf -o pipefail
# Check if the correct number of arguments are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <PR-number> <origin-branch>"
exit 1
fi
# Arguments
@mmastrac
mmastrac / debugme.ts
Created April 4, 2024 16:07
Debug current deno
let c = new Deno.Command("code", {args:["--open-url", `vscode://vadimcn.vscode-lldb/launch/config?{'request':'attach','pid':${Deno.pid}}`]}).spawn();
@mmastrac
mmastrac / signed_check.c
Created December 20, 2022 15:04
Signed integer addition overflow check
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
bool checked_add_intrinsic(int32_t a, int32_t b) {
int res;
// return __builtin_add_overflow(a, b, &res);
return 1;
}
@mmastrac
mmastrac / recipes.txt
Last active October 23, 2024 17:45
Recipes scraped from a Delonghi Dinamica Plus
Beverage: EspressoCoffee (id 0x01)
╭─[EspressoCoffee:1:1]
1 │ 01·0028•02·03•08·00•1b·04•19·01
· ───┬─── ──┬── ──┬── ──┬── ──┬──
· │ │ │ │ ╰──── Visible=1
· │ │ │ │
· │ │ │ ╰────────── IndexLength=4
· │ │ │
· │ │ ╰──────────────── DueXPer=0
var Stylus = {
inject: function(what, loadCallback) {
return createInjector(what, loadCallback);
},
};
var STYLUS_STATUS_ID = '__STYLUS_style_el';
var Injector = function() {};
@mmastrac
mmastrac / Wii Drive.md
Created February 5, 2017 19:32
Wii Drive Investigation

The Wii drive itself operates at the smallest possible DVD read size: a 32kB ECC block. This is the minimum that the drive can read from the disc, even if the game is asking for less data.

As game assets tend to be larger in size, the drive has a special 1MB (32 ECC block) streaming buffer that it maintains in the background. The drive will try to keep 1MB of data in memory from the last location the game requested. This streaming buffer is actually circular and will re-use old data still within the streaming buffer window. Seeking forward by more than 1MB or backward at all will destroy the buffer.

The drive has two seek speeds: short/slow and long/fast. Short seeks are slower and occur when seeking less than 1mm physically on the disc. Long seeks are much faster and occur when the drive needs to seek more than 1mm.

After completely filling the streaming buffer, the drive leaves the head parked on the track where the streaming buffer ended. If the game requests a read starting at this position it doesn't

[merge "clang_format"]
name = clang-format merge driver
driver = /tmp/merge_driver.sh %O %A %B %L %P
recursive = binary
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1
hQIMAz2cwGg4V0HRAQ/6AjVTehOaMKHDsCyP74YqH96kPpCt9twy4vTnXqlEzxqz
tYVFhzcrqI/34wowR/sbHQEn15LpyogeDck+Dxa8adPHnB/ebq1DiulNBkvxPbAE
CXHHXhXDg+Ng3qx1yo+ruZQv6LoSR/zssu8iyskwQh7mtvz7UzHfBlTuaXWQYk7t
a8BwXdzyaSIe6cEkzE8dASmg6NiexZDJBIXHhY6EHSEMDUA7+35rDOV7FoT52/g5
kCELAdeIHtzz+O4kdDcA0b+nPnKEo5ihohxF8JByDyCBC1EIFwk3lZsPpj8b3r2U
sEoSOWnKfNbu1l2VSo6dWNIRU/PNI4Sl4oDkXwB6j5D2mwoFaR8FackElHxVR+Vk
3PCmExW5jsdszaX4vuGTruWS30qy2nBhhYaKBKc+I0l/BHSpNqCF+i4PNq5geTUK
@mmastrac
mmastrac / keybase.md
Last active August 29, 2015 14:07
Keybase proof

Keybase proof

I hereby claim:

  • I am mmastrac on github.
  • I am mmastrac (https://keybase.io/mmastrac) on keybase.
  • I have a public key whose fingerprint is B64A 2338 BE69 9BDA 12C0 E642 B9B0 44E1 44AC E235

To claim this, I am signing this object: