Skip to content

Instantly share code, notes, and snippets.

  1. Download ISO image (foobar.iso)
  2. Install geteltorito (usually included in genisoimage) and fatcat
  3. Extract fat32 image with geteltorito -o update.img foobar.iso
  4. Create a directory to extract everything into (mkdir update_dump) and extract fat32 image into it (fatcat ./update.img -x ./update_dump)
  5. Copy update_dump/Flash to your ESP, e.g. sudo cp -r ./update_dump/Flash /boot/efi/Flash
  6. Create a systemd-boot config file at /boot/efi/loader/entries/flash.conf:
title   Firmware Updater
efi     /Flash/NoDCcheck_bootx64.efi
@creshal
creshal / check_nrpe_ssh.sh
Last active December 23, 2015 11:38
Tunnel Nagios NRPE over SSH
#! /bin/bash
# Author: Sven Schwedas <sven.schwedas@tao.at> for TAO Software
# Published under MIT license
function freeport () {
# pick random port to keep collision chance minimal, ideally we don't want
# to enter the loop at all
pnum=$(shuf -i $(sed 's/\t/-/' /proc/sys/net/ipv4/ip_local_port_range) -n 1)
while nc -z 127.0.0.1 $pnum; do
let pnum++
#! /bin/python
import sys,os,time,glob,shutil
import subprocess as sp
def backup (src,dst):
src = sys.argv[1]
exclude_file = os.path.join (src,'.backup-exclude')
dst = sys.argv[2]
dst_dir = os.path.join (dst,'%i'%time.time())
lnk_dir = get_old_backups (dst)[-1]
@creshal
creshal / ssh-benchmark
Last active August 29, 2015 14:24
ssh-benchmark
#! /bin/bash
pgrep sshd >/dev/null || (echo "Please make sure SSH is running _locally_." && exit 1)
sz=${1:-128}
testfile=$(mktemp -p /run/user/$UID)
filename=$(basename $testfile)
echo "Generating temporary file, $sz MiB size. Supply a size argument to change. (Should be small enough to fit in RAM twice.)"
@creshal
creshal / fix-shell-escapes.patch
Created October 29, 2014 13:04
Patch against lsyncd version in Debian stable
Sanitize mv arguments:
1. Fixes crashes on file names containing `, $ or "
2. Also prevents shell execution of ``, $() … in file names, which can be
used to gain remote shell access as lsyncd's (target) user.
Index: lsyncd-2.0.7/default-rsyncssh.lua
===================================================================
--- lsyncd-2.0.7.orig/default-rsyncssh.lua 2012-02-16 08:24:20.000000000 +0100
+++ lsyncd-2.0.7/default-rsyncssh.lua 2014-10-29 13:59:51.165553255 +0100
@@ -29,14 +29,17 @@