Skip to content

Instantly share code, notes, and snippets.

Avatar

Klaus Alexander Seistrup kseistrup

View GitHub Profile
@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
@kseistrup
kseistrup / selenium-screenshotting.md
Created Mar 25, 2016 — forked from dannguyen/selenium-screenshotting.md
Using Selenium and Python to screenshot a javascript-heavy page
View selenium-screenshotting.md

Using Selenium and Python to screenshot a javascript-heavy page

As websites become more JavaScript heavy, it's harder to automate things like screenshotting for archival purposes. I've seen examples and suggestions to use PhantomJS for visual testing/archiving of websites, but have run into issues such as the non-rendering of webfonts. I've never tried out Selenium until today...and while I'm not thinking about performance implications yet, Selenium seems far more accurate than PhantomJS...which makes sense since it actually opens a real browser. And it's not too hard to script to do complex interactions: here's an [example of how to log in to Twitter, write a tweet, upload an image, and send a tweet via Selenium and DOM element selection](https://gist.github.com/dannguyen/8a6fa49253c1d6a0eb92