Skip to content

Instantly share code, notes, and snippets.

View norpol's full-sized avatar

Phileas Lebada norpol

View GitHub Profile
@norpol
norpol / keybase.md
Created June 17, 2014 20:11
keybase.md

Keybase proof

I hereby claim:

  • I am norpol on github.
  • I am pl (https://keybase.io/pl) on keybase.
  • I have a public key whose fingerprint is F549 0D6E 1A67 E1F0 A19E 693C 45D0 E421 5EBE 16D9

To claim this, I am signing this object:

@norpol
norpol / findmount_luks_block_device.sh
Last active January 31, 2017 11:45
findmount luks block device
#!/bin/sh
# figure which luks device is used for a given mountpoint (e.g. /)
# usage: findmount_luks_block_device.sh /
# See findmount_luks_block_device_LICENCE.MD (MIT)
set -ue
mountpoint="${1}"
lsblk_output="$(lsblk -l -o NAME,KNAME,PKNAME,TYPE,UUID,MOUNTPOINT)"
# each matching line provided above the command
# exit after print in each awk, because mdadm softraid lvm block device will appear multiple times (md-0)
@norpol
norpol / pidiotop.sh
Last active February 11, 2017 22:57
tiny iotop alternative
#!/bin/sh
# 2017 © MIT https://gist.github.com/norpol/
# Usage: pidiotop.sh <PID>
# Example: pidiotop.sh $(pgrep -n dd)
# Requires: bc
set -ue
pid="${1}"
interval=10
bbytes=
bytes=
@norpol
norpol / automount_copy.sh
Last active March 5, 2017 11:40
Automatically mount (without root) and copy content helper script
#!/bin/sh
# Findmount of OR (Mount and Unmount) a given block device
# ask for user input and
# rsync it's entire content to a specified path
# and do it without root privileges
# Requires: rsync, gvfs-mount, grep with '-c' (count option), awk, ✨Unicode
# Useful for quickly copying photos from a camera to a specified directory
# and unmounting (but not deleting content) properly.
set -ue
@norpol
norpol / README.md
Created July 14, 2017 13:41
zfs history

ZFS on Linux with LUKS encrypted disks

$ lsblk -io KNAME,TYPE,SIZE,MODEL
symbol:~# lsblk -io KNAME,TYPE,SIZE,MODEL
KNAME TYPE    SIZE MODEL
sda   disk    3.7T ST...
sdb   disk    3.7T WDC WD40...
dm-1  crypt   3.7T
dm-2  lvm     3.7T
@norpol
norpol / getopts.sh
Last active November 27, 2017 22:56
getopts example/testcase/discussion
#!/bin/sh
set -ue
error() {
echo "${*:-Something failed}"
exit 1
}
check() {
arguments="${*}"
@norpol
norpol / qrclip
Last active February 2, 2018 15:19
Generate/show a qrcode of what ever is in your x-clipboard
# add this to your i3 config to float the feh image on your screen
# float any window with the title float
for_window [title="^float$"] floating enable, border normal
@norpol
norpol / clip_do
Last active February 3, 2018 13:33
Common clipboard helpers
#!/bin/sh -eu
param="${1:-help}"
# this 'implements' a echo "${param}" | head -1
# in order to avoid passing a multiline string to:
# - command -V -- "${param}"
# - eval "${param}"
# leading in possible executing of ${param}
param="${param%%
*}"
current="$(xclip -o -sel clip)"
@norpol
norpol / README.md
Created March 17, 2018 12:44
ASCII Art thread

ASCII ART TIME

Post your ASCII/UTF-8 in whatever style you prefer. :-)

Please no porn.

@norpol
norpol / firefox-temp
Created April 4, 2018 15:27
Launches a temprorary firefox session
#!/bin/sh
set -u
PROFILEDIR="$(mktemp -p /tmp -d tmp-fx-profile.XXXXXX.d)"
[ -d "${PROFILEDIR}" ] || exit "mktemp failed"
firefox -profile "${PROFILEDIR}" -no-remote -new-instance $*
rm -rf "${PROFILEDIR}"