Skip to content

Instantly share code, notes, and snippets.

@stvhay
stvhay / backup.sh
Last active November 11, 2022 01:20 — forked from skrajewski/backup.sh
Automate your macOS backup to Backblaze B2 using Restic and launchd.
#!/bin/bash
log () { echo "$(date +"%Y-%m-%d %T") " "$@"; }
home_dir='' # FILL THIS OUT
name='remote'
restic_path='/opt/homebrew/bin' # ADJUST AS NEEDED
pid_file="${home_dir}/.restic/${name}.pid"
timestamp_file="${home_dir}/.restic/${name}.timestamp"
hc_ping="https://hc-ping.com/uuid_here" # REPLACE WITH YOUR UUID
@stvhay
stvhay / autossh.plist
Last active November 24, 2020 11:12 — forked from swinton/autossh.plist
launchd plist for keeping a tunnel alive
<?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">
<!-- https://www.launchd.info/ -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>tunnel.autossh</string>
<key>KeepAlive</key>
<dict>
@stvhay
stvhay / autossh.service
Last active November 24, 2020 10:38 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network-online.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)