Skip to content

Instantly share code, notes, and snippets.

kwbr /
Created Aug 20, 2020 — forked from romainl/
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,
kwbr /
Last active May 20, 2020 — forked from Konfekt/
convert video files into the WebM format in batches using ffmpeg (and preferrably GNU parallel)
#!/usr/bin/env bash
# convert video files into the WebM format in batches using ffmpeg (and preferrably GNU parallel)
# exit on error or use of undeclared variable or pipe error:
set -o errexit -o nounset -o pipefail
# -crf 10 : Constant Rate Factor (crf) gives video quality from 0 (lossless) to 63 (worst); default is 23.
# -c:a/v ... = transform the audio/video data using ...
# -b:a/v ... = audio/video bitrate is ...
kwbr / sort.vim
Created Mar 17, 2020 — forked from romainl/sort.vim
Sort operator
View sort.vim
function! Sort(type, ...)
nmap <silent> <key> :set opfunc=Sort<CR>g@
" usage:
" <key>ip
" <key>G
View pt-stalk dissection with bash
# Many of these are obvious and stupidly simple, but for your reference and copy-pasting pleasure…
# Mextify all (with workaround for pesky samples that contain multi-line RSA key that breaks pt-mext)
for i in $(ls $1/*-mysqladmin); do { (cat $i | sed -e '/\-\-\-\-\-BEGIN\ PUBLIC\ KEY/,+9d' | pt-mext -r -- cat -) > $i.mext && echo $i.mext;} done;
# Inspect given variable through multiple mext samples (revealing ;-))
grep Table_locks_waited *.mext |less -S
#Find contentious tables
kwbr /
Created May 2, 2019 — forked from rolfn/
Backup auf Cloud-Speicher mit »restic«

Backup auf Cloud-Speicher mit »restic«

Das Programm »restic« ist ein modernes Backup-Programm, welches als Ziel lokal gemountete Verzeichnisse verwenden kann. Darüber hinaus unterstützt es einige ausgewählte Protokolle, um direkt auf Cloud-Speicher zugreifen zu können (SFTP, S3, OpenStack Swift, Google Cloud Storage u.a.). Im Folgenden soll gezeigt werden, wie man unter Linux automatische Backups konfigurieren kann. Als Ziel wird in diesem Beispiel der S3-kompatible »Object Storage Service« (TelekomCLOUD) benutzt. Sinngemäß lassen sich die folgenden Angaben auch auf andere Backup-Ziele (z.B. NFS-Mounts) anwenden. Getestet wurde

#!/usr/bin/env awk -f
# Based on the idea from, the
# script is updated to use the format of the gc logs as received with the parameters:
# -XX:+UseThreadPriorities
# -XX:ThreadPriorityPolicy=42
# -Xms1995M -Xmx1995M
# -Xss256k -XX:StringTableSize=1000003
# -XX:SurvivorRatio=8
# -XX:MaxTenuringThreshold=1
kwbr /
Created Jan 27, 2019 — forked from xaprb/
A little shell script for hammering the dvdstore database on Postgres
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: $0 <iterations>"
exit 1
# Display product ID, category, title, price, num orders
# ordered by top products limit 10
function top_products(){
use strict;
use warnings FATAL => 'all';
use DBI;
use English qw(-no_match_vars);
use Getopt::Long;
use List::Util qw(max);
kwbr /
Created Jan 9, 2019 — forked from SQLadmin/
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"
kwbr / Vagrantfile
Created Jun 22, 2018
Example: apt_repository rewrites sources.list #41647
View Vagrantfile
Vagrant.configure("2") do |config| = "debian/stretch64"
config.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "play.yml"