Skip to content

Instantly share code, notes, and snippets.

View catwithin's full-sized avatar
🎯
🦉

catwithin

🎯
🦉
View GitHub Profile
@catwithin
catwithin / radix_sort_and_reduce.py
Created July 17, 2025 21:12
Sort list of decimals, discarding fractional part that was not relevant for sorting
def get_digit_at(number, place) -> int:
int_part, _, frac_part = f"{number}".partition('.')
if place > 0:
if place > len(int_part):
return 0
return int(int_part[-place])
elif place < 0:
idx = abs(place) - 1
if idx >= len(frac_part):
return -1
find . -name '*.xmind'
@catwithin
catwithin / gist:8bef22b828a6ee5330d2a3171038dcff
Created August 14, 2021 18:33
Installing Source Code Pro fonts on linux (for spacemacs warning)
sudo mkdir /usr/share/fonts/adobe-source-code-pro
fontpath="/usr/share/fonts/adobe-source-code-pro"
wget https://github.com/adobe-fonts/source-code-pro/releases/download/2.030R-ro%2F1.050R-it/source-code-pro-2.030R-ro-1.050R-it.zip
unzip source-code-pro-2.030R-ro-1.050R-it.zip
cp source-code-pro-*-it/OTF/*.otf $fontpath
fc-cache -f -v
@catwithin
catwithin / .xmodmap
Last active February 22, 2021 17:22
Acute and Grave accents with arrow keys remapped to caps+hjkl
# remapping each symbol according to the sequence:
# layout_1 shift_layout_1 layout_2 shift_layout_2 alt_gr_layout_1 [shift_alt_gr_layout_1]
keycode 43 = h H Cyrillic_er Cyrillic_ER Left
keycode 44 = j J Cyrillic_o Cyrillic_O Down
keycode 45 = k K Cyrillic_el Cyrillic_EL Up Up
keycode 46 = l L Cyrillic_de Cyrillic_DE Right Right
keycode 48 = apostrophe quotedbl Cyrillic_e Cyrillic_E dead_acute dead_diaeresis Ukrainian_ie Ukrainian_IE
keycode 49 = grave asciitilde U2019 apostrophe dead_grave dead_tilde U0301 asciitilde
keycode 12 = 3 numbersign 3 numbersign threesuperior dead_macron section U20B4
@catwithin
catwithin / grep_notes.sh
Last active February 22, 2021 10:11
Grep notes
# will grep both .md and xmind
grep -inr --exclude='*.png' --exclude='*.pdf' "search string" .
# messy output, but will show the name of the node in the .xmind
grep -ainr --exclude='*.png' --exclude='*.pdf' "search string" .
# TODO: take a look at pdfgrep
@catwithin
catwithin / clock
Last active February 22, 2021 10:04
Clock format according to https://www.foragoodstrftime.com/
# clock format for calendar applet
%H:%M %a %e %b w%V d%j
# format for vertical panel
%n%n%H%n%M%n%n%a%n%n%e%n%b%n%nw%V%n%j