Skip to content

Instantly share code, notes, and snippets.

View yuanweixin's full-sized avatar

Wei yuanweixin

  • New York, NY, USA
View GitHub Profile
@yuanweixin
yuanweixin / gist:457be1af286f7c90f80bb106ac9842ef
Created June 30, 2023 21:07
Showing the size of types in Rust.
use std::mem::size_of;
type TigerInt = i32;
type Label = usize;
type Temp = usize;
#[derive(Debug)]
pub enum IrExp {
Const(TigerInt),
Name(Label),
@yuanweixin
yuanweixin / bash_strict_mode.md
Created May 24, 2023 12:45 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@yuanweixin
yuanweixin / darktable_build.md
Created May 20, 2023 23:33
building darktable

The ubuntu snap version doesn't have the latest lensfun data files. For reasons, it seems to have hard coded the lensfun data files, and also for reasons, the snap seems to be mounted as read-only file system, so you can't just copy the lensfun files there.

lensfun needs to be updated using lensfun-update-data. If you type it in cli it would suggest what pkg to install to get it on ubuntu.

trying to compile darktable myself. checking out the source turns out to take forever.

deb

sed -e '/^#\sdeb-src /s/^# *//;t;d' "/etc/apt/sources.list" \
  | sudo tee /etc/apt/sources.list.d/darktable-sources-tmp.list > /dev/null \
@yuanweixin
yuanweixin / nim_concept_factory.nim
Created February 8, 2023 11:03
factory pattern with nim concepts
type Frame* = concept x, type T
T.newFrame is T
type Arch = enum
x86
mips
proc translateExp[T : Frame]() =
discard T.newFrame()
@yuanweixin
yuanweixin / ubuntu_ui_setup.md
Last active January 27, 2023 11:50
Ubuntu UI Setup

This is to tweak the gnome UI that come out of box on 22.4.

It's a whole bunch of tweaks, without which the touchpad and keyboard are useless.

This is intended to emulate the feel of a mac laptop, with most of the keyboard bindings and trackpad behavior!

The nuclear option: reset gnome to factory setting

Sadly if gnome just stops working for...no reason after an update, for instance mouse works before login but completely stops moving/responding, even though all the drivers exist and all mice are detected, then it's probably something messed up in your gnome setting.

@yuanweixin
yuanweixin / papers.md
Created November 24, 2019 03:31 — forked from dominictarr/papers.md
Distributed Systems Papers

(dominic: this list of papers was originally recommended to me by Brain Noguchi @bnoguchi, and was a great start to understanding distributed systems)

Here's a selection of papers that I think you would find helpful and interesting:

Time, Clocks, and the Ordering of Events in a Distributed System

The seminal paper about event ordering and concurrency. The important result is that events in a distributed system define a partially ordered set. The connection to what we're working on is fundamental, as this defines how to detect concurrent updates. Moreover, the chosen algorithm to turn the partially ordered set into a totally ordered set defines the conflict resolution algorithm.

http://research.microsoft.com/en-us/um/people/lamport/pubs/time-clocks.pdf

@yuanweixin
yuanweixin / gist:67b1e552e6f9d173055055975b68dc9b
Created November 24, 2019 03:31 — forked from pbailis/gist:5660980
Assorted distributed database readings

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht