Skip to content

Instantly share code, notes, and snippets.

View mrnugget's full-sized avatar

Thorsten Ball mrnugget

View GitHub Profile
@mrnugget
mrnugget / a.md
Last active November 20, 2022 11:03

UPDATE: See "Update" below

Problem

What can cause unaligned pointers to end up on my stack? Or: what, on my stack, can look like unaligned pointers?

Context is that I'm trying to write a conservative GC. I want to scan the stack for things that look like pointers (and then mark them, but I'm not at that point yet). I copied & hacked together some code from other GCs I found, which essentially does the following:

  1. At program start: save the current %rbp away as the "stack bottom" (highest address)
  2. When scanning stack: save now-current %rbp away as "stack top" (lowest address)
@mrnugget
mrnugget / trigger_update_testscript.sql
Created August 30, 2022 09:37
Testing whether I can `CREATE OR REPLACE` the function used by a database trigger.
begin;
-- create two tables
drop table if exists a;
create table a (
id bigserial NOT NULL primary key,
value text
);
drop table if exists stats;
create table stats (
@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 / pg_test_fsync_outputs.md
Created August 2, 2021 08:40
Notes from debugging difference in Postgres performance between 16in MBP and Linux machine with roughly same specs.

pg_test_fsync outputs

On macOS on the 16" MBP:

pg_test_fsync
5 seconds per test
Direct I/O is not supported on this platform.

Compare file sync methods using one 8kB write:
@mrnugget
mrnugget / update-circle-ci-docker-user.campaign.yaml
Created February 12, 2021 11:29
Sourcegraph campaign to change Docker Hub username in Circle CI configuration
name: update-circle-ci-docker-user.campaign.yaml
description: Changes the Docker Hub username used for Circle CI
# Search for repositories containing a circle-ci.yml file with the old usename
on:
- repositoriesMatchingQuery: mydockerhub-user file:circle-ci.[yaml|yml]
# In each repository
steps:
# replace the old with the new username in the found files
@mrnugget
mrnugget / webtesting.md
Last active January 29, 2021 23:24
twop: My thoughts on web testing

The following was written by Simon Korzunov

Decided to capture my thoughts in a document. The intent of this document is to be a starting point of a discussion.

So here are my recollection of thoughts/feedback on freshly added testing doc (thanks @felixfbecker!).

On goals

In general I do agree with the stated goals, but I would love to simplify/reduce number of them.

use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::fmt;
use crate::ast::*;
use super::{symbol_table::Def, Context};
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
pub struct BlockId(pub usize);

Windows and Linux logbook

Date: December 2020

  • Windows 10: time is always outdated. I have to sync time every time I reboot.

  • Windows 10: login never accepts password on first try. Known problem.

  • Ubuntu: can't show network activity, because my motherboard seems to be too new?

  • Ubuntu: 4k display and scaling means font sizes are all over the place. Spotify is tiny. Terminal font needs to be two points smaller to match what it

@mrnugget
mrnugget / expend_end_statement.patch
Created August 18, 2020 05:25
Change the Monkey parser to expect expression statements to either end in a semicolon, a closing brace (because of `if (x) { foo }`) or EOF
diff --git a/parser/parser.go b/parser/parser.go
index dbd581d..c7ebdf9 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -114,6 +114,20 @@ func (p *Parser) expectPeek(t token.TokenType) bool {
}
}
+func (p *Parser) expectStatementEnd() bool {
+ switch p.peekToken.Type {
@mrnugget
mrnugget / technical_papers_reading_log_2020.md
Created March 3, 2020 13:51
Technical Papers - Reading Log 2020

Technical Papers

2019

  1. Oct 15: Google's Bigtable paper
  2. Dec 5: "Producing Wrong Data Without Doing Anything Obviously Wrong!" +

2020

  1. Jan 20: "Source Code Rejuvenation is not Refactoring" +