Skip to content

Instantly share code, notes, and snippets.

@maximko
maximko / borg-macos-backup.sh
Last active April 6, 2024 15:17
Backup macOS using borg and apfs snapshots
#!/usr/local/bin/bash
export BORG_REPO="ssh://user@server/borg-repo"
if [[ ! "${USER}" == "root" ]]; then
echo Start this script as root
exit 1
fi
echo === Present snapshots ===
@dev01d
dev01d / .env
Last active March 4, 2023 14:20
System-wide Traefik Reverse Proxy
EMAIL=
DOMAIN0=
DOMAIN1=
API_EMAIL=
API_TOKEN=
@Pezmc
Pezmc / fake-scan-automator.sh
Last active October 6, 2023 08:26 — forked from andyrbell/scanner.sh
Make a pdf look scanned with macOS automator as a quick action
#!/bin/bash
# This script takes a PDF or list of PDFs and outputs a file(s)
# named <file>_scanned.pdf that looks like it has been scanned
#
# Requires imagemagic and popper to be installed (brew install imagemagick poppler)
#
# Accepts: a list of files
# Usage: ./<scriptfilename> pdf1.pdf pdf2.pdf
#
# To use as a macOS automator quick action you need to:
@tomwalsh
tomwalsh / preseed.cfg
Last active April 21, 2024 22:21
Debian Installer/preseed Partman Setup for RAID and LVM
# Force the system to unmount any previously found file systems
d-i preseed/early_command string umount /media || true
# We are using RAID as our method - This is important
d-i partman-auto/method string raid
# Define which disks we want to use in our RAID configuration
d-i partman-auto/disk string /dev/sda /dev/sdb
# Remove any previous LVM metadata
d-i partman-lvm/device_remove_lvm boolean true
# Remove any previous MD metadata
d-i partman-md/device_remove_md boolean true
@bluewalk
bluewalk / Fix_standby_battery_drain_MBPro-BigSur.md
Last active July 12, 2023 17:16
Fix standby battery drain Macbook Pro - Big Sur

Fixing standby battery drain issue Macbook Pro - Big Sur

1. Reboot into recovery mode

  1. Disable FileVault (System Preferences -> Security & Privacy -> FileVault -> Turn Off Filevault)
  2. Boot to recovery mode by holding Command + R during boot

2. Preparation

  1. Open Terminal
  2. Run csrutil authenticated-root disable to disable signature validation on the bootable snapshots
  3. Run ioreg -l | grep board-id to get your board ID and write it down.
@aleksandrs-ledovskis
aleksandrs-ledovskis / README.md
Last active November 11, 2023 01:06
Lock Spotify version (macOS)
  1. Create new Automator application with Run Shell script action (exact steps below).

    1. Open Automator.app (e.g. from Spotlight)
    2. Select File → New in menu
    3. Select "Application", click "Choose"
    4. With "Actions" toggle selected, type "Run Shell Script" in filter box, double click on filtered item
  2. Put contents from lock_spotify_version.sh into script's body (exact steps below).

  3. In opened right-hand item select /bin/sh as "Shell" type and copy contents of Gist's "lock_spotify_version.sh" below/in text area

@auipga
auipga / iperf3.service
Last active April 6, 2024 00:21 — forked from mmasaki/iperf.service
systemd service unit for iperf3
# /etc/systemd/system/iperf3.service
# User service: $HOME/.config/systemd/user/iperf3.service
[Unit]
Description=iperf3 server
After=syslog.target network.target auditd.service
[Service]
ExecStart=/usr/bin/iperf3 -s

Simplest app can be created via https://gist.github.com/mathiasbynens/674099 e.g.

mkdir -p MyApp.app/Contents/MacOS
printf '#!/bin/bash\nsleep 5' > MyApp.app/Contents/MacOS/MyApp
chmod +x MyApp.app/Contents/MacOS/MyApp
echo "<plist><dict></dict></plist>" > MyApp.app/Contents/Info.plist

But more "appy" app can be done via the followning steps

@robertstarmer
robertstarmer / ubuntu-server.preseed
Last active August 25, 2022 10:06
example preseed for OpenStack deployment
d-i mirror/country string manual
d-i mirror/http/hostname string 192.168.26.170
d-i mirror/http/directory string /ubuntu
d-i partman/early_command string vgs --separator=: --noheadings | cut -f1 -d: |while read vg ; do vgchange -an $vg ; done ; pvs --separator=: --noheadings | cut -f1 -d: | while read pv ; do pvremove -ff -y $pv ; done
d-i partman-auto/disk string /dev/sda
d-i partman/alignment string cylinder
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
@igmar
igmar / extensions.lua
Created November 13, 2012 15:55
Asterisk LUA dialplan
require("lsqlite3")
-- Igmar: Wanneer closen we dat DB object eigenlijk ?
db = sqlite3.open('/etc/asterisk/users.sqlite')
--CONSOLE = "Console/dsp" -- Console interface for demo
--CONSOLE = "DAHDI/1"
--CONSOLE = "Phone/phone0"
TRUNK = "DAHDI/G1"