Skip to content

Instantly share code, notes, and snippets.

kwbr /
Created Feb 5, 2022 — forked from drmalex07/
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward


Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

Description=Setup a secure tunnel to %I
kwbr / after#ftplugin#javascript.vim
Created May 10, 2021
Set proper &path for Next.js and Nuxt.js
View after#ftplugin#javascript.vim
autocmd BufNewFile,BufRead * call <SID>DetectFrontEndFramework()
function! s:DetectFrontEndFramework()
if v:version >= 801 && has('patch1803')
let package_json = findfile('package.json', '.;')
if len(package_json)
let dependencies = readfile(package_json)
\ ->join()
\ ->json_decode()
kwbr / awk-expense-calculator.awk
Created May 2, 2021 — forked from samask/awk-expense-calculator.awk
Awk Expense Calculator, by Ward Cunningham
View awk-expense-calculator.awk
#!/usr/bin/awk -f
# Source:
/^[A-Z]+[A-Z0-9]*$/ {
if (sums[$1] == "" || $1 == "SUM") {
sums[$1] = sum # Define Symbol
$1 = sum
sum = 0
kwbr / Dockerfile
Created Mar 25, 2021 — forked from anthonypotappel/Dockerfile
View Dockerfile
FROM alpine as base
RUN apk update \
&& apk add --no-cache \
FROM scratch as user
COPY --from=base . .
kwbr / Makefile
Created Mar 25, 2021 — forked from anthonypotappel/Makefile
View Makefile
# --------------------------------------------------------------------
# Copyright (c) 2019 LINKIT, The Netherlands. All Rights Reserved.
# Author(s): Anthony Potappel
# This software may be modified and distributed under the terms of the
# MIT license. See the LICENSE file for details.
# --------------------------------------------------------------------
# If you see pwd_unknown showing up, this is why. Re-calibrate your system.
PWD ?= pwd_unknown
kwbr / docker-compose.yml
Created Mar 25, 2021 — forked from anthonypotappel/docker-compose.yml
View docker-compose.yml
version: '3.4'
# Makefile fills PROJECT_NAME to current directory name.
# add UID to allow multiple users run this in parallel
container_name: ${PROJECT_NAME}_${HOST_UID:-4000}
hostname: ${PROJECT_NAME}
# These variables are passed into the container.
- UID=${HOST_UID:-4000}
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