Skip to content

Instantly share code, notes, and snippets.

Hakky54 /
Last active Jul 28, 2022
Cheat Sheet - Http Client SSL TLS Configuration for Java Kotlin and Scala with example http requests
View single-file-web-component.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Single File Web Component</title>
<template id=single-file>
h1 {
michalc /
Last active May 14, 2022
Use libsqlite3 directly from Python with ctypes: without using the built-in sqlite3 Python package, and without compiling anything
# From, which is itself inspired by
from contextlib import contextmanager
from collections import namedtuple
from ctypes import cdll, byref, string_at, c_char_p, c_int, c_double, c_int64, c_void_p
from ctypes.util import find_library
from sys import platform
def query(db_file, sql, params=()):
andrebrait /
Last active Aug 10, 2022
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes. By default, this driver uses the F-keys as multimedia shortcuts and you have to press Fn + the key to get the usual F1 through F12 keys.

Checksum / assert.jq
Last active Jul 17, 2022
Assertion library for jq
View assert.jq
# A simple assertion library for jq (
# Author: Srinath Sankar
def assert(level; expr; msg):
if expr then
. |= . + [{ level: level, message: msg }]
skybldev /
Last active Mar 20, 2022
A script that content-aware-scales (or seam carves) a video.
#!/usr/bin/env bash
inputFile=$1 # input file
outputFile=$2 # output file
outputRes=$3 # output resolution in WIDTHxHEIGHT
fps=$4 # fps for both input and output
useLeftoverFrames=0 # whether or not to process already split frames
# create temp dir if it doesn't exist yet
if [[ ! -d ".lqrtemp/" ]]; then
echo ":: Creating temporary directory .lqrtemp/..."
romainl /
Last active Jul 17, 2022
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,
SQLadmin /
Last active Feb 6, 2022
Automate xtrabackup for FULL/Incremental and restore
# This is my production backup script.
set -e
set -u
usage() {
echo "usage: $(basename $0) [option]"
echo "option=full: Perform Full Backup"
rolfn /
Last active Jun 16, 2022
Backup auf Cloud-Speicher mit »restic«

Automatische Backups auf Online-Speicher mit »Restic«

Das Programm »Restic« ist ein modernes Backup-Programm, welches als Speicherort sowohl lokale Verzeichnisse als auch per Netzwerk erreichbare Speicher (Online-Speicher) nutzen kann. Der Autor von »Restic« zeigt in anschaulicher Weise in zwei Videos viele Details zur Arbeitsweise seines Programms: »FOSDEM 2015« (2015-01-28) und »CCCCologne« (2016-01-29).

Im Folgenden soll gezeigt werden, wie man unter Linux automatische Backups mit »Restic« einrichten kann. Als Speicherort wird per WebDAV-Protokoll erreichbarer Online-Speicher genutzt. Sinngemäß können die Hinweise aber auch auf andere Speicherorte übertragen werden. Getestet wurde unter »openSUSE« und »Linux Mint« (»Ubuntu«), wobei aber auch alle anderen systemd-basierten Linux-Distributionen in derselben Art oder mit geringfügigen Änderungen geeignet sind.