Skip to content

Instantly share code, notes, and snippets.

View mpr1255's full-sized avatar

matthew p robertson mpr1255

View GitHub Profile
@mpr1255
mpr1255 / save-my-bacon
Last active May 30, 2025 09:26
Auto-backup script for protection against AI code editors
#!/usr/bin/env bash
# save-my-bacon.sh - Auto-backup with Git shadow repository
#
# Monitor a directory and automatically commit all changes to a temporary Git repo.
# Perfect for protecting against accidental deletions or overwrites by AI editors.
#
# Usage: save-my-bacon [directory]
# Monitors current directory if no argument provided
#
# Features:
@mpr1255
mpr1255 / remotepaste.md
Created June 15, 2024 12:55 — forked from burke/remotepaste.md
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@mpr1255
mpr1255 / make_google_alert.js
Created November 4, 2021 05:24
make google alerts
// consult here for the explanation, but this is a fixed version based on https://dev.to/frenchcooc/how-to-create-a-bunch-of-google-alerts-in-3-minutes-54n
// it has a standard 3 second pause or whatever not some exponential thing that was breaking the code.
// also implemented the explanation in the comment section
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);