Skip to content

Instantly share code, notes, and snippets.

View capitaineplanete's full-sized avatar

capitaineplanete

  • United Kingdom
View GitHub Profile
@capitaineplanete
capitaineplanete / cronify.sh
Last active June 10, 2022 09:06
send notifications from a cronjob, inspired by https://bbs.archlinux.org/viewtopic.php?id=193589
#!/bin/bash
notification_agent=/usr/bin/dunstify
wm=dwm
if [[ $? -eq 0 ]]; then
pids=$(pgrep $wm$)
for p in $pids; do
dbus="$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/"$p"/environ | tr '\0' '\n' | sed 's/DBUS_SESSION_BUS_ADDRESS=//')"
user=$(grep -zPo '/home/\K[^"/]+' /proc/"$p"/environ | tr '\0' '\n' | awk '!seen[$0]++')
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
@capitaineplanete
capitaineplanete / thelounge.css
Last active November 7, 2021 16:39
TheLounge mobile-oriented CSS
/** https://thelounge.chat/docs/guides/custom-css **/
/** Bigger custom CSS field **/
textarea#user-specified-css-input {
height: 600px;
}