Skip to content

Instantly share code, notes, and snippets.

@Thomashrb
Thomashrb / gist:3e14dd2b225adf016407ffa91c148a86
Created March 20, 2024 22:57
jump menu to other tmux session
# https://waylonwalker.com/tmux-fzf-session-jump/
bind-key -n M-z display-popup -E "\
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
sed '/^$/d' |\
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\
xargs tmux switch-client -t"
@Thomashrb
Thomashrb / gist:d832a40cb64177dacc1dc9866a057134
Created March 20, 2024 22:56
select tmux session and kill it
for s in \$(tmux list-sessions | awk '{print \$1}' | rg ':' -r '' | fzy); do tmux kill-session -t \$s; done;
@Thomashrb
Thomashrb / gist:cc1e62725e49a6d03b2a8284deaa74f2
Created February 11, 2024 14:48
weechat install slack plugin
# this is also documented on the weechat pluging repository
# except for the first step which took me a minute to figure out
/set script.scripts.download_enabled on
/script install slack.py
/slack register
@Thomashrb
Thomashrb / gist:36cbbf43f05dc5705d5c5df2d436b3dc
Created February 2, 2024 21:42
open emacs client but start emacs daemon initially if it is not running
emacsclient --alternate-editor='' -nw
❯ npm i
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm WARN deprecated @types/testing-library__react@10.2.0: This is a stub types definition. testing-library__react provides its own type definitions, so you do not need this installed.
added 1725 packages, and audited 1726 packages in 20s
@Thomashrb
Thomashrb / sequenced.sh
Last active November 25, 2022 13:59
Sequence 2 commands behind a lock
#!/usr/bin/env bash
# Locking from: https://gist.github.com/jpclipffel/0b8f470be029fc9e3f07
# Run two bash commands in sequence using flock to prevent
# from running multiple instances in paralell
# ./sequenced.sh -g echo 'Hello' > test.txt -t cat test.txt -n lock_name
while getopts 1:2:n: flag; do
case "${flag}" in
1) FIRST_CMD=${OPTARG} ;;
#include "matching_brackets.h"
#include <string.h>
struct Stack {
int top;
char data[20];
};
void push(struct Stack *s, char elem) {
s->top++;
use "collections"
primitive Day01
fun val test_input(): String => "199\n200\n208\n210\n200\n207\n240\n269\n260\n263\n"
fun solve_part1(input: String): USize =>
let depths = _parse_entries(input)
var last_depth: USize = 0
// hack because the first will always be an increase
var incs: USize = -1
@Thomashrb
Thomashrb / 00-gentoo-btrfs-disk
Last active September 23, 2020 08:07 — forked from renich/00-gentoo-installation-partitioning.bash
Install Gentoo Desktop into BtrFS subvolumes
#!/usr/bin/env bash
## PARTITION DISKS
##################
# zap-all and clear partition table
sgdisk -Z /dev/sda && sgdisk -o /dev/sda
# create bios_grub partition
sgdisk -n 1::+8M -t 1:ef02 /dev/sda
# create boot partition
sgdisk -n 2::+512M -t 2:8300 /dev/sda
@Thomashrb
Thomashrb / microcosm-onix-bisac-codes.csv
Created June 15, 2020 09:04 — forked from natebeaty/microcosm-onix-bisac-codes.csv
ONIX BISAC codes from microcosm publishing database, with some manually entered codes — use at your own risk!
ANT000000 Antiques & Collectibles / General
ANT001000 Antiques & Collectibles / Americana
ANT002000 Antiques & Collectibles / Art
ANT003000 Antiques & Collectibles / Autographs
ANT005000 Antiques & Collectibles / Books
ANT006000 Antiques & Collectibles / Bottles
ANT007000 Antiques & Collectibles / Buttons & Pins
ANT008000 Antiques & Collectibles / Care & Restoration
ANT009000 Antiques & Collectibles / Transportation
ANT010000 Antiques & Collectibles / Clocks & Watches