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
* ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
*ESCF1F2F3F4F5F6F7F8F9F10F11F12INSDELFN
* ├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┴─────┼─────┤
* │ ` │ 1234567890-=BSPCHOME
* ├─────┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬──┴──┬────────┼─────┤
*TABQWERTYUIOP │ [ │ ] │ BSLSEND
* ├────────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴────────┼─────┤
*LCTRLASDFGHJKL │ ; │ ' │ ENTERPGUP
@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;
@ethan605
ethan605 / print256colours.sh
Created September 11, 2020 14:43 — forked from HaleTom/print256colours.sh
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256