Skip to content

Instantly share code, notes, and snippets.

View mrnugget's full-sized avatar

Thorsten Ball mrnugget

View GitHub Profile
{
"name": "Snazzy",
"appearance": "dark",
"style": {
"background.appearance": "opaque",
"border": "#1d2433",
"border.variant": "#1d2433",
"border.focused": "#8695b777",
"border.selected": "#1d2433",
"border.transparent": "#1d2433",
@mrnugget
mrnugget / go-sqlite3_database_is_locked.go
Created March 3, 2016 05:58
Program that tests the concurrency issues with go-sqlite3. This will create two tables: `products` and `users`. One goroutine will repeatedly read from the `products` table in N fresh goroutines. At the same time ONE goroutine writes to the other table.
package main
import (
"database/sql"
"fmt"
"log"
"math/rand"
"sync"
"time"
@mrnugget
mrnugget / steve_yegge_notes_mystery_machine_bus.md
Last active February 24, 2024 01:09
Steve Yegge - Notes from the Mystery Machine Bus. This is a mirror of the post on Google+, kept here for safekeeping when Google+ shuts down tomorrow. (converted to Markdown by pasting it into Dropbox Paper and exporting as Markdown)

Note: I'm not the original author. That's Steve Yegge. I copied the essay here from Google+ for safekeeping before Google+ shuts down.

Author: Steve Yegge

Publication Date: 10 Aug 2012

Notes from the Mystery Machine Bus

I've spent the past eight years (starting back in June 2004) writing elaborate rants about a bunch of vaguely related software engineering issues.

@mrnugget
mrnugget / main.go
Created February 22, 2024 16:11
Why?
package main
import (
"fmt"
"log"
"os/exec"
"time"
)
func main() {
@mrnugget
mrnugget / tucan_bibliography.md
Last active February 21, 2024 15:42
Tucan Bibliography. Majority of the resources I used to build Tucan, my toy optimizing compiler in Rust

Tucan - Bibliography

Majority of the resources I used to build Tucan, my toy optimizing compiler in Rust. This list is not complete but most of the things listed here are things I really read through and used.

Books

  • Engineering a compiler (I use this a lot! For SSA, dominance and optimizations)
  • [Static Single Assignment Book][ssabook] (I use this a lot!)
  • Types And Programming Languages
@mrnugget
mrnugget / buy-my-starlabs-starbook.md
Last active January 10, 2024 14:36
I'm selling my Star Labs Starbook. Who wants to buy it?

Buy my Star Labs Starbook 14-inch

Short version: I'm selling my Star Labs Starbook. I'm just not using it enough.

Specs

  • Model: Star Labs Starbook 14-inch
  • OS: Ubuntu (I'll wipe and reinstall Ubuntu)
  • CPU: 2.10GHz 12-core Intel i7-1260P, Turbo Boost up to 4.70GHz
  • RAM: 32GB 3200MHz DDR4
@mrnugget
mrnugget / main.c
Last active October 30, 2023 06:12
GTK4: focus leaving last-focused-child in GtkNotebook and then back into it
// Compile with:
// gcc $(pkg-config --cflags gtk4) -o main ./main.c $(pkg-config --libs gtk4) && ./main
//
// Run with:
// ./main
//
// Reproduce issue:
//
// 1. Click on Page 2
// 2. Select "view3" and type something.
@mrnugget
mrnugget / pointers_and_arrays.c
Last active July 10, 2023 07:25
Kind of a cheat sheet for pointers and arrays in C
#include <stdio.h>
int main(int argc, char *argv[])
{
// Taken from here: http://denniskubes.com/2012/08/19/pointers-and-arrays-in-c/
// initialize an array of ints
int numbers[5] = {1,2,3,4,5};
// standard array notation
@mrnugget
mrnugget / ContentView.swift
Created July 1, 2023 11:05
macOS Swift app with "Quit?" dialog that should accept return, but doesn't
import SwiftUI
struct ContentView: View {
@EnvironmentObject private var appDelegate: AppDelegate
var body: some View {
let confirmQuitting = Binding<Bool>(get: {
self.appDelegate.confirmQuit
}, set: {
@mrnugget
mrnugget / read_one_byte.go
Created March 16, 2014 12:54
Use `stty` to change the operation mode of the terminal to disable line-buffering and non-echoing of typed characters. This lets us read one byte from STDIN. This version is currently tested with OS X
package main
import (
"bytes"
"fmt"
"log"
"os"
"os/exec"
)