Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🌈

Klaus Alexander Seistrup kseistrup

💭
🌈
View GitHub Profile
@kseistrup
kseistrup / simplex-startup.fish
Created Apr 23, 2022
Simple, stupid fish script to dump the last 10 messages from SimpleX Chat
View simplex-startup.fish
#!/usr/bin/env fish
echo 'select chat_dt, msg_body from all_messages_plain order by chat_dt;' \
| sqlite3 ~/.simplex/simplex_v1_chat.db \
| tail \
| while read line
set data (string split '|' "$line")
set text (echo "$data[2]" | jq -r .params.content.text)
printf '%s %s\n' "$data[1]" "$text"
end
@kseistrup
kseistrup / PKGBUILD
Created Dec 26, 2021
PKGBUILD to build python-standardebooks on ArchLinux
View PKGBUILD
# Maintainer: Tassos Natsakis <7712382@eipieq.com>
# Maintainer: Standard Ebooks <admin@standardebooks.org>
# Contributor: Standard Ebooks <standardebooks@googlegroups.com>
# Contributor: Klaus Alexander Seistrup <klaus@seistrup.dk>
# -*- sh -*-
pkgname=python-standardebooks
_pkgname="${pkgname#python-}"
pkgver=2.3.1
pkgrel=3
@kseistrup
kseistrup / is_isogram.py
Created Jul 20, 2020
Test if TEXT is an isogram, using Python
View is_isogram.py
def is_isogram(text, case_sensitive=False):
"""Test if TEXT is an isogram"""
if type(text) is not str:
return False
if not text:
return True
unique = set(text if case_sensitive else text.casefold())
return len(text) == len(unique)
@kseistrup
kseistrup / 68-bits.md
Created Apr 29, 2020
68 Bits of Unsolicited Advice
View 68-bits.md

68 Bits of Unsolicited Advice

  • Learn how to learn from those you disagree with, or even offend you. See if you can find the truth in what they believe.
  • Being enthusiastic is worth 25 IQ points.
  • Always demand a deadline. A deadline weeds out the extraneous and the ordinary. It prevents you from trying to make it perfect, so you have to make it different. Different is better.
  • Don’t be afraid to ask a question that may sound stupid because 99% of the time everyone else is thinking of the same question and is too embarrassed to ask it.
  • Being able to listen well is a superpower. While listening to someone you love keep asking them “Is there more?”, until there is no more.
  • A worthy goal for a year is to learn enough about a subject so that you can’t believe how ignorant you were a year earlier.
  • Gratitude will unlock all other virtues and is something you can get better at.
  • Treating a person to a meal never fails, and is so easy to do. It’s powerful with old friends and a great way to make new frie
@kseistrup
kseistrup / syslogtail.sh
Created Jan 19, 2020
journalctl doesn't have an --exclude switch, so let's make out own
View syslogtail.sh
#!/bin/bash
exec 0</dev/null
exec 2>&1
clear
exec journalctl --utc --lines=2048 --follow > \
>(exec stdbuf --output=L awk '$5 !~ "^(kernel|audit|CROND|crond)" {print}' > \
>(exec stdbuf --output=L ccze --raw-ansi --plugin syslog --options nolookups))
View readit.sh
# run this script with a shell other than fish (bash, ksh, yash, …)
printf 'A B\tC D\t\tE \tF\t G \t \t H I\n' \
| while read A B C D E F G REST
do
printf 'A="%s"\n' "$A"
printf 'B="%s"\n' "$B"
printf 'C="%s"\n' "$C"
printf 'D="%s"\n' "$D"
printf 'E="%s"\n' "$E"
View readit.fish
# run this script with fish
printf 'A B\tC D\t\tE \tF\t G \t \t H I\n' \
| while read A B C D E F G REST
printf 'A="%s"\n' "$A"
printf 'B="%s"\n' "$B"
printf 'C="%s"\n' "$C"
printf 'D="%s"\n' "$D"
printf 'E="%s"\n' "$E"
printf 'F="%s"\n' "$F"
@kseistrup
kseistrup / gris.txt
Created Apr 18, 2018
Gris er det nye svin
View gris.txt
angrebgriskel.
bacongris.
butikgrisdue.
bægergrisger.
dannebroggrisdue.
engrisklet adj., engrisklede.
fedegris.
forsatgrisdue.
forgrisde, forsvandt, forsvundet (forsvunden, forsvundne, jf. § 31-34).
forgrisding -en, -er, i sms. forgrisdings-, fx forgrisdingsnummer.
View blockstack.txt
Verifying that "kseistrup.id" is my Blockstack ID. https://onename.com/kseistrup
@kseistrup
kseistrup / zeronet.service
Last active Mar 30, 2016
Service file for Zeronet
View zeronet.service
[Unit]
Description=Decentralized websites using Bitcoin crypto and the BitTorrent network
[Service]
User=zeronet
Group=zeronet
WorkingDirectory=/opt/zeronet
LimitNOFILE=8192
ExecStart=/opt/zeronet/zeronet --config_file /etc/zeronet.conf
Restart=on-failure