Skip to content

Instantly share code, notes, and snippets.

@diresi
diresi / xpid
Created September 12, 2022 06:27
xpid: show pid of program that created an X11 window
#!/bin/bash
# https://www.linuxquestions.org/questions/linux-software-2/something-like-xkill-but-just-output-the-pid-or-resource-id-don%27t-kill-595638/#post2941613
wid=$(xwininfo |grep 'Window id:' |cut -d" " -f4)
pid=$(xprop -id "$wid" |grep "^_NET_WM_PID" | cut -d" " -f3)
echo $pid |grep '^ *[0-9][0-9]* *$' && exit 0
cat <<EOF 1>&2
xpid ERROR: can't get PID for selected window.
allpcb.com
https://www.reddit.com/r/crkbd/comments/ue5akx/jlcpcb_order_issues/
https://peterxjang.com/blog/designing-a-36-key-custom-keyboard-layout.html
https://www.reddit.com/r/ErgoMechKeyboards/comments/twl8yn/why_i_avoid_homerow_modifiers/
https://github.com/callum-oakley/qmk_firmware/tree/master/users/callum
https://github.com/markstos/qmk_firmware/tree/markstos/keyboards/crkbd/keymaps/bcat
https://github.com/markstos/qmk_firmware/tree/markstos/keyboards/crkbd/keymaps/markstos
@diresi
diresi / 20-keyboard-corne.conf
Created June 14, 2022 20:13
/etc/X11/xorg.conf.d/20-keyboard-corne.conf
Section "InputClass"
Identifier "Corne Keyboard"
MatchProduct "ZMK Project Corne Keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us"
Option "XkbVariant" "basic"
EndSection
# it's all about the " --addn-hosts /tmp/dhcpd_hostlist" parameter
# we'd just need to find ways to reload dnsmasq if dhcp leases change ...
...
else
/usr/sbin/dnsmasq --except-interface=lo -r $resolv_file -P 4096 $opt_argv --log-facility /tmp/dnsmasq.log --log-queries --addn-hosts /tmp/dhcpd_hostlist
fi
...
@diresi
diresi / wireguard
Created January 6, 2021 12:49
wireguard, allowedips and routes
https://www.reddit.com/r/WireGuard/comments/gersca/is_allowedips_only_used_for_routes_or_does_it_a/fpp8wz3?utm_source=share&utm_medium=web2x&context=3
@diresi
diresi / lineage-devices-by-height.py
Last active April 3, 2022 11:58
sort lineage devices by some attribute, default is to sort by height
# sort lineage devices by some attribute, default is to sort by height:
#
# - download lineage_wiki, e.g. by cloning it:
# git clone https://github.com/LineageOS/lineage_wiki.git
#
# - change into the root directory, e.g:
# cd lineage_wiki
#
# - run this script:
# python devs.py
http://www.catb.org/esr/hdcp-master.txt
HDCP MASTER KEY (MIRROR THIS TEXT!)
This is a forty times forty element matrix of fifty-six bit
hexadecimal numbers.
To generate a source key, take a forty-bit number that (in
binary) consists of twenty ones and twenty zeroes; this is
the source KSV. Add together those twenty rows of the matrix
@diresi
diresi / tmux.conf
Last active November 12, 2020 10:00
tmux.conf
# use UTF8
set -g utf8
set-window-option -g utf8 on
set-window-option -g xterm-keys on
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
# set scrollback history to 10000 (10k)
set -g history-limit 10000
https://en.wikipedia.org/wiki/BSD_licenses#0-clause_license_(%22Zero_Clause_BSD%22)
@diresi
diresi / avrdude.conf
Created March 1, 2020 16:02
olimex arm-usb-ocd + "avrdude -c arm-usb-ocd"
# this will interface with the chips on these programmers:
#
# http://real.kiev.ua/old/avreal/en/adapters
# http://www.amontec.com/jtagkey.shtml, jtagkey-tiny.shtml
# http://www.olimex.com/dev/arm-usb-ocd.html, arm-usb-tiny.html
# http://www.ethernut.de/en/hardware/turtelizer/index.html
# http://elk.informatik.fh-augsburg.de/hhweb/doc/openocd/usbjtag/usbjtag.html
# http://dangerousprototypes.com/docs/FT2232_breakout_board
# http://www.ftdichip.com/Products/Modules/DLPModules.htm,DLP-2232*,DLP-USB1232H
# http://flashrom.org/FT2232SPI_Programmer