Skip to content

Instantly share code, notes, and snippets.

View dkebler's full-sized avatar

David Kebler dkebler

  • We Also Walk Dogs
  • Oregon, US
View GitHub Profile
@dkebler
dkebler / watch.sh
Created February 19, 2023 16:18 — forked from fago/watch.sh
Inotify script to trigger a command on file changes, e.g. rsync
#!/bin/bash
# (c) Wolfgang Ziegler // fago
#
# Inotify script to trigger a command on file changes.
#
# The script triggers the command as soon as a file event occurs. Events
# occurring during command execution are aggregated and trigger a single command
# execution only.
#
# Usage example: Trigger rsync for synchronizing file changes.
@dkebler
dkebler / !RebootToOs.md
Created April 21, 2021 17:50 — forked from Darkhogg/!RebootToOs.md
"Reboot to {OS}" scripts for rEFInd Next Boot selection

Reboot to {OS}

This a collection of notes and files used in my quest to create "Reboot to Windows" and "Reboot to Linux" scripts (and desktop shortcuts) for Linux and Windows respectively that automatically reboot my system and instruct rEFInd to auto-select the appropriate OS entry.

General Information

The key for achieving this is to modify the EFI Variable PreviousBoot with GUID 36d08fa7-cf0b-42f5-8f14-68df73ed3740, which rEFInd uses to store the last entry selected in the menu and, if using the + default entry, will be used to select the default OS. By doing this, we trick rEFInd into booting the OS we choose without having to be physically there to press the keyboard.

const net = require("net"), fs = require("fs");
let server, istream = fs.createReadStream("./sender/SC-02.pdf");
server = net.createServer(socket => {
socket.pipe(process.stdout);
istream.on("readable", function () {
let data;
while (data = this.read()) {
const net = require("net"), fs = require("fs"), remote_server = process.argv[2];
let socket;
socket = remote_server ? net.connect(8000, remote_server) : net.connect(8000);
let ostream = fs.createWriteStream("./receiver/SC-02.pdf");
let date = new Date(), size = 0, elapsed;
socket.on('data', chunk => {
size += chunk.length;
elapsed = new Date() - date;
@dkebler
dkebler / get_latest_release.sh
Created December 4, 2017 18:37 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@dkebler
dkebler / Git push deployment in 7 easy steps.md
Last active October 6, 2015 04:16 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook