Skip to content

Instantly share code, notes, and snippets.

View melissaboiko's full-sized avatar
🐈

Melissa Boiko melissaboiko

🐈
View GitHub Profile
@melissaboiko
melissaboiko / 00-precise-tsv.conf
Created September 1, 2022 22:32
more informative, precise, tab-separated template for rsyslog, in the cleaner list expression syntax
# this will generate entries like:
# info.daemon 2022-09-02T00:27:39.198142+02:00 umbral:systemd[1]: Starting System Logging Service...
# info.syslog 2022-09-02T00:27:39.238310+02:00 umbral:rsyslogd: imuxsock: Acquired UNIX socket '/run/systemd/journal/syslog' (fd 3) from systemd. [v8.2001.0]
# - contrary to default template, you get priority (warn, info, debug...) as well as software-specific tag
# - timestamp in standard rfc3339 format, greppable, sed/awkable, sortable, with high time precision and timezone
# - tabs may take more space but today's monitors are big and the terminal scrolls,
# - and tsv is handy to process with cut(1), easy to sed, and you can just pipe to `xsel -b` and paste in any spreadsheet.
template (name="precise-tsv" type="list") {
@melissaboiko
melissaboiko / 10-noisy.conf
Last active September 1, 2022 22:57
filtering noisy dæmons on rsyslog using the cleaner expression syntax
# /etc/rsyslog.d/10-noisy.conf
# filter out some noisy messages
# most software doesn't set $syslogtag, so you need to look for the identifier in the message.
# the problems here are baffling:
# - for reasons unknown, the message often starts with a space, though not necessarily
# - this makes it cumbersome to impossible to rely on `starts_with`
# - regexpes are significantly slower
# - `contains` is slower than `starts_with`, and may give false positives
# - the `ltrim()` function can't easily be applied to an action
@melissaboiko
melissaboiko / 99-persist-disk-symlinks.rules
Last active September 1, 2022 22:39
udev rules to create symlinks for specific hard drives
@melissaboiko
melissaboiko / lockwise2bitwarden.py
Created August 25, 2021 17:12
Alternative Bitwarden importer for Firefox Lockwise passwords, keeps everything into a separate folder
#!/usr/bin/env python3
'''lockwise2bitwarden.py:
Converts a Firefox Lockwise export CSV into a Bitwarden-format CSV.
Compared to using the built-in Firefox importer, this will:
- Save everything into a Lockwise-{timestamp} folder, and
- Save some extra Firefox stuff in the Notes field.
(Would be nice to use custom fields for those, but then we need
.json, and then we need to create folders, and then we need API
@melissaboiko
melissaboiko / fediblock-archive-to-glitchsoc.py
Created June 27, 2021 18:43
injects everything in fediblock.org directly in the glitch-soc blocked domains database
#!/usr/bin/env python3
import sys
import psycopg2
import urllib.request
import json
from datetime import datetime
from typing import List
# expects working pgident auth. edit parameters to your own:
database='mastodon_production'
@melissaboiko
melissaboiko / 99dynamic-fonts.el
Created November 27, 2020 16:04
Code to set emacs font to best font, and workaround some fallback bug by forcing it to certain codeblocks
;; default
(progn
(setq melissa/font-default "Iosevka Term SS05 Medium")
(set-face-attribute 'default nil :font melissa/font-default :height 140 :slant 'normal)
;; (setq melissa/font-default "Victor Mono SemiBold")
;; (set-face-attribute 'default nil :font melissa/font-default :height 140 :slant 'italic)
;; (setq melissa/font-default "Iosevka Term SS05 Semibold")
@melissaboiko
melissaboiko / soxbeep.sh
Last active August 10, 2020 12:15
make fun beep boop sounds
#!/bin/bash
# usage: soxbeep [N] [duration]
# where N = number of beeps (default 1) and duration = duration in seconds (default 0.2)
# try e.g. soxbeep.sh 7
# c g d a e # penta M
notes=( 323.63 384.87 432.00 513.74 576.65 647.27 769.74 864.00 1027.47 1153.30 1294.54 ) # 1539.47 1728.00)
duration=0.2
function beep() {
@melissaboiko
melissaboiko / kill-switch.sh
Created December 27, 2019 11:56
ufw vpn kill switch
#!/bin/bash
if=tun0
ufw --force reset
ufw default deny incoming
ufw default deny outgoing
ufw allow out on $if from any to any
ufw allow in on $if from any to any
@melissaboiko
melissaboiko / sparkasse-credit.py
Created June 1, 2018 19:46
Converts Sparkasse CVS file FOR CREDIT CARDS to YNAB4 CVS format.
#!/usr/bin/env python3
# Converts Sparkasse CVS file FOR CREDIT CARDS to YNAB4 CVS format.
#
# For the main account extract, see Markus Seidl's sparkasse.py at
# https://github.com/ma-ver-ick/ynab-converter/
# usage: sparkasse-credit.py umsatz-[number]-[date].CSV credit-ynab4.csv
import os
#!/bin/bash
[email protected]
[email protected]
limit=1000
waitfor=30 # minutes
# debug
if [ "$1" ] && [ "$1" == -d ]; then
limit=10