Skip to content

Instantly share code, notes, and snippets.

View subnut's full-sized avatar
🏛️
Busy. Very very Busy.

Subhaditya Nath subnut

🏛️
Busy. Very very Busy.
View GitHub Profile
@subnut
subnut / firefox.md
Last active February 4, 2023 10:14
Firefox `about:config` preferences

Fix touchpad in linux

Setting Value
apz.fling_friction 0.005
apz.gtk.pangesture.delta_mode 2
@subnut
subnut / Caddyfile.example
Created April 13, 2022 12:45
Sample error generic handling HTML page for caddy webserver
(common) {
tls internal
encode gzip zstd
handle_errors {
rewrite * /error.html
templates
file_server
}
}
@subnut
subnut / vim.md
Last active August 1, 2022 16:33
Useful vim commands

Insert special characters using two-letter short forms

:help digraphs
:help digraph-table

Highlight some text in a window

:help :match
@subnut
subnut / git.md
Last active April 23, 2022 15:54
Useful git commands

Add remotes

git remote add codeberg "git@codeberg.org:subnut/$(basename $(git rev-parse --show-toplevel)).git"
git remote add github "git@github.com:subnut/$(basename $(git rev-parse --show-toplevel)).git"

Create sed script to update renamed files

git diff HEAD^ | grep ^rename | cut -d ' ' -f 3- | sed 'N;s_\(.*\)\n\(.*\)_s|\1|\2|g_;s_\._\\._g' > sedscript
sed -i -f sedscript **/*(.) # needs zsh and GNU sed
@subnut
subnut / void_hrmpf_zfsbootmenu.md
Created February 15, 2022 06:10
Notes made while installing Void Linux on ZFS root using hrmpf as boot ISO and following the guide made by zbm-dev/zfsbootmenu

Installation hiccups

efivarfs not mounted under /sys/firmware/efi/efivars

Mount efivarfs -

mount -t efivarfs efivarfs /sys/firmware/efi/efivars

NVMe drive running in 512b-block emulation mode

Use nvme command to switch to 4K blocksize mode. Be careful.

⚠️ Data will be destroyed/corrupted in the above step. Make backups before proceeding.

@subnut
subnut / swayprop.sh
Last active February 7, 2022 19:19
xprop and xwininfo for Sway (wayland compositor)
#!/bin/sh
# Copyright 2022 Subhaditya Nath
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
@subnut
subnut / ssh-askpass.sh
Created February 7, 2022 14:06
ssh-askpass using zenity
#!/bin/sh
## Logging purposes
# PREVDIR=`pwd`
# cd "$(dirname "$0")"
# exec 1>./log.txt
# exec 2>./log_err.txt
# echo '$PREVDIR:' "$PREVDIR"
# echo '$1:' "$1"
# env | grep ^SSH_
@subnut
subnut / dbus-run-session.sh
Created February 7, 2022 14:01
Alternative to dbus-run-session
#!/bin/sh
{ { ADDRESS=$(dbus-daemon --session --print-address 1 --print-pid 2 --fork); } 2>&1
echo $ADDRESS; } | { tr '\n' ' '; echo; } |
read DBUS_DAEMON_PID DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_ADDRESS
"$@"; EXITCODE=$?
kill $DBUS_DAEMON_PID
exit $EXITCODE
@subnut
subnut / glirc2_config
Created February 2, 2022 15:40
config for glirc2 (aka. glguy/irc-core)
activity-bar: yes
show-ping: yes
nick-padding:
side: left -- try right if you don't like left padding
width: 20
macros:
* name: "shrug"
commands: "say ¯\\_(ツ)_/¯"
@subnut
subnut / init.el
Last active February 2, 2022 15:40
Emacs config
"Required fonts -
| Name | Usage | URL |
|-------------+--------------------+-----------------------------------------------|
| Victor Mono | default | https://github.com/rubjo/victor-mono |
| Roboto Mono | fixed-pitch | https://fonts.google.com/specimen/Roboto+Mono |
| Bitter | variable-pitch | https://fonts.google.com/specimen/Bitter |
| Lobster Two | org-document-title | https://fonts.google.com/specimen/Lobster+Two |
"
;; Enable MELPA