Skip to content

Instantly share code, notes, and snippets.

@ahknight
ahknight / fix_timemachine_backup.sh
Last active August 9, 2023 20:25
When Time Machine asks you to delete your backups and start over, ignore it. Run this and then start a backup again.
#!/bin/bash -x
# Generally based on ideas found at:
# http://www.garth.org/archives/2011,08,27,169,fix-time-machine-sparsebundle-nas-based-backup-errors.html
#
# Reduced the ideas there down to their essentials.
# 1. Unlock the image.
# 2. Reset the saved failure in the backup metadata.
# 3. Verify/fix the filesystem.
@jpillora
jpillora / tinc-install.sh
Last active March 2, 2021 09:56
Install and run tinc-1.1pre11 on Raspberry Pi 2 (Raspberrian)
# install tinc
apt-get update && echo "===> update deps" &&
apt-get install -y make libssl-dev zlib1g-dev liblzo2-dev libreadline-dev libncurses5-dev && echo "===> got deps" &&
curl http://www.tinc-vpn.org/packages/tinc-1.1pre11.tar.gz | tar xzvf - && echo "===> got tinc src" &&
cd tinc-1.1pre11 &&
./configure && echo "===> configured tinc" &&
make &&
make install && echo "===> installed tinc" &&
tinc --version # tinc version 1.1pre11 (built Nov 12 2015 16:25:28, protocol 17.4)
@matthiassb
matthiassb / auth-duo.py
Created July 31, 2016 03:31
PAM LDAP Authentication with two-factor authentication with DUO in python
import duo_client
import ldap
auth_api = duo_client.Auth(
ikey='<ikey>',
skey='<skey>',
host='<host>',
)
LDAP_SERVER = 'ldap://10.1.0.143'
@andyrbell
andyrbell / scanner.sh
Last active April 5, 2024 09:01
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@loveshizuka
loveshizuka / _vultr-snapshot.md
Created December 18, 2017 23:04
Automatic snapshots using Vultr API

Automated Snapshots / Backups via Vultr API

A more customizable alternative to Vultr's backup feature using Vultr API v1. Tested on Ubuntu 16.04. Run this php script on a Vultr instance to create a snapshot of itself and rotate out the oldest snapshot(s). Use the $backup_tag field to uniquely id a set of snapshots.

  1. Set $api_key to your Vultr API key.
  2. Set $num_of_backups to specify how many snapshots to keep.
  3. Set chmod +x vultr-snapshot.php.
  4. Add vultr-snapshot.php to your cron tab.
  5. Epic winning at life.
@recursivecodes
recursivecodes / backup.sh
Last active May 12, 2023 04:04
backup.sh
#!/usr/bin/env bash
source ~/.zshrc
PROFILE_NAME=DEFAULT
BACKUP_NAME=[your_manual_backup_name]
TMP_BACKUP_NAME=$(date +%Y-%m-%d_%H-%M-%S)
echo "Running at ${TMP_BACKUP_NAME}."
echo "Getting previous backup..."
@cagartner
cagartner / deploy.sh
Last active May 6, 2024 20:09
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master