Skip to content

Instantly share code, notes, and snippets.

@MawKKe
MawKKe / ssh-key-fingerprints
Last active Jul 27, 2021
List OpenSSH key fingeprints of all private keys found under ~/.ssh/
View ssh-key-fingerprints
#!/usr/bin/env sh
# Author: Markus H (MawKKe) ekkwam@gmail.com
set -eu
PNAME="$(basename ${0})"
# OpenSSH default checksum type as of 2021-07
E=sha256
@MawKKe
MawKKe / ublock-filter.txt
Last active Nov 17, 2018
uBlock cosmetic rule for startpage.com (2018-11-18)
View ublock-filter.txt
# Around mid November of 2018, Startpage.com updated it's visual look.
# Among other things, they changed the behaviour of the header block which
# contains the search bar and button. The header now follows you as you scroll.
# I don't know what kind of idiot thought that was a good idea.
# To get rid of this behaviour add the following line into your uBlock "My Filters" list:
startpage.com##.header--content:style(position: relative !important)
@MawKKe
MawKKe / linux-fs-namespace-workaround.txt
Created Sep 13, 2018
Not enough space on /tmp for Matlab install? No problem.
View linux-fs-namespace-workaround.txt
Problem scenario:
------------------
1) stupid Matlab installer wants to download several gigabytes into your /tmp directory.
2) You don't have "several gigabytes" available on your root partition (where /tmp is). The installer warns you and/or fails.
3) You DO have available disk space, but on some other disk/partition/wherever.
Solution:
----------
Run the command inside Linux filesystem namespace. For example:
@MawKKe
MawKKe / split_ffmpeg.py
Last active Mar 8, 2021
Split audio file with ffmpeg based on chapter metadata
View split_ffmpeg.py
#!/usr/bin/env python3
import sys
import os
import re
import subprocess as sub
import argparse
import tempfile
import json
from concurrent.futures import ThreadPoolExecutor, as_completed
@MawKKe
MawKKe / cryptsetup-with-luks2-and-integrity-demo.sh
Last active Jul 18, 2021
dm-crypt + dm-integrity + dm-raid = awesome!
View cryptsetup-with-luks2-and-integrity-demo.sh
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) ekkwam@gmail.com
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@MawKKe
MawKKe / fizzbuzz.c
Last active Jun 29, 2019
Unconditional fizzbuzz
View fizzbuzz.c
//
// Unconditional FizzBuzz
//
// Author: Markus (MawKKe) ekkwam@gmail.com | 2017-01-11
//
// Compile:
// gcc -std=c99 -Wall -Wextra -pedantic fizzbuzz.c -o fizzbuzz
//
#include <stdio.h>
@MawKKe
MawKKe / jolla-sms.sql
Created Feb 16, 2016
Query Jolla's commhistory.db for SMS's
View jolla-sms.sql
/*
jolla-sms.sql - Query Jolla's commhistory.db for SMS's.
- Shows sent/received from last 2 months, oldest to newest.
- Messages are printed with newlines replaced by spaces.
---
Usage:
@MawKKe
MawKKe / smsread.py
Last active Jun 6, 2020
Python CLI program to show (unread) SMS's on Jolla/Sailfish OS
View smsread.py
#!/usr/bin/env python3
#
# Author: Markus (MawKKe) ekkwam@gmail.com | 2016-01-27 02:52
#
# ---
# CLI program to show (unread) SMS's on Jolla/Sailfish OS
#
# Reads directly form an sqlite3 database, so standard Python libraries suffice.
#
# The database file is typically located in ~/.local/share/commhistory/commhistory.db
@MawKKe
MawKKe / argsparse.py
Created Jul 7, 2015
Testing out python's argparse
View argsparse.py
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
# Markus Holmström (MawKKe) ekkwam@gmail.com
# 2015-07-08
#
# Testing out python's argparse
import argparse
import sys
from itertools import product