Skip to content

Instantly share code, notes, and snippets.

View ethan605's full-sized avatar

Thanh Nguyen ethan605

View GitHub Profile
@ethan605
ethan605 / common.sh
Created January 20, 2022 15:44
Common terminal operations
# Find all wayland containers in Sway
swaymsg -t get_tree | jq -r '.. | .app_id?' | grep -v null
# Find all xwayland containers in Sway
swaymsg -t get_tree | jq -r '.. | .instance?' | grep -v null
@ethan605
ethan605 / kbd75.c
Created November 4, 2021 17:14
My KBD75 keymaps
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: Qwerty layer
* ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
* │ ESC │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │ INS │ DEL │ FN │
* ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ BSPC │HOME │
* ├─────┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬────────┼─────┤
* │ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ BSLS │END │
* ├────────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴────────┼─────┤
* │ LCTRL │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ ENTER │PGUP │
@ethan605
ethan605 / machine.js
Created April 14, 2021 15:58
Generated by XState Viz: https://xstate.js.org/viz
const trafficLight = Machine({
id: 'trafficLight',
initial: 'red',
states: {
red: {
on: {
TIMER: 'amber'
}
},
amber: {
@ethan605
ethan605 / machine.js
Last active April 14, 2021 15:57
Generated by XState Viz: https://xstate.js.org/viz
const docVideoFlow = Machine({
id: 'docVideo',
type: 'parallel',
states: {
recordState: {
initial: 'hideButton',
states: {
hideButton: {
on: {
NEXT_RECORD_STATE: 'showButton'
@ethan605
ethan605 / !google_chrome_fake_media_stream
Last active December 11, 2021 14:16
Google Chrome with fake media stream
We couldn’t find that file to show.
@ethan605
ethan605 / !nuc_arch_qemu_gpu_passthrough
Last active June 17, 2021 16:02
Intel NUC10i7FNH/K + Arch Linux: QEMU/KVM Windows 10 guest with CPU pinning + GPU passthrough with Intel GVT-g + Hugepages
We couldn’t find that file to show.
@ethan605
ethan605 / cli-template.js
Last active December 11, 2023 19:47
Boilerplate to quickly write a CLI tool with Node.js
#!/usr/bin/env node
/**
* A script to do something handy in an easy way
*
* For more info, run:
* $ <cli-name> --help
*/
'use strict'
export type SystemTypes = 'os' | 'browser';
export type SystemAttribute = {
codeName: string;
name: string;
versionPrefix: string;
};
export type SystemInfo = {
name: string;