Skip to content

Instantly share code, notes, and snippets.

View ben-ba's full-sized avatar
🎯
Focusing

ben-ba

🎯
Focusing
View GitHub Profile
@namxam
namxam / wg-watchdog
Last active February 23, 2023 06:57 — forked from mattkasun/wg-watchdog.sh
wireguard watchdog script
#!/bin/bash
# 1. Save file to system /usr/bin
# 2. Make it executable
# 3. Add crontab entry:
# sudo su
# crontab -e
# Add `* * * * * /usr/bin/wg-watchdog`
#
# You can track history via `journalctl -f -t wg-watchdog`
@pedrolamas
pedrolamas / docker-iptables-fix.sh
Created August 18, 2020 19:32
Script to fix Docker iptables on Synology NAS
#!/bin/bash
currentAttempt=0
totalAttempts=10
delay=15
while [ $currentAttempt -lt $totalAttempts ]
do
currentAttempt=$(( $currentAttempt + 1 ))
echo "Attempt $currentAttempt of $totalAttempts..."
@x1le
x1le / wireguard-on-seedbox.md
Created April 13, 2020 00:41
VPN on Seedbox

Setup VPN back home

We want to be able to securely sync between the cloudbox and back on-prem (for a local plex server). As a result we'll configure a wireguard VPN link between the two and then setup a rsync daemon on the cloudbox.

See Wireguard vs OpenVPN on a local Gigabit Network for a performance comparison. I've gone with Wireguard over OpenVPN based on it being incorporated into the Linux Kernel and increased performance versus OpenVPN. In addition, there's a useful walkthrough on How to setup your own VPN server using WireGuard on Ubuntu that I leaned on during this process. It's not quite right though and had some errors in.

Install wireguard pre-reqs on both boxes

sudo apt-get -y install software-properties-common; \
sudo add-apt-repository -y ppa:wireguard/wireguard; \
sudo apt-get install -y wireguard; \
@l1pz
l1pz / torrentwatcher.py
Created April 3, 2020 13:00
qBittorrent - download next torrent after the recent one finished moving
#!/usr/bin/env python3
import requests
import json
import random
authUrl = 'http://yourwebuiurl/api/v2/auth/'
torrentsUrl = 'http://yourwebuiurl/api/v2/torrents/'
cookies = {'SID': 'nologin'}
@hjbotha
hjbotha / free_ports.sh
Last active April 22, 2024 14:52
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
#!/bin/bash
set -e
set -x
mkdir ~/transmission
cd ~/transmission
PREFIX=/opt
@kriswebdev
kriswebdev / forcevpn.sh
Last active February 25, 2024 07:35
forcevpn: Force VPN for specific apps, in a better way than killswitch [Linux / OpenVPN]
#!/bin/bash
# === INFO ===
# ForceVPN
# Description: Force VPN tunnel for specific applications.
# If the VPN is down => blackhole the app network traffic.
# Better than a killswitch. IPv4.
VERSION="2.3.0"
# Author: KrisWebDev
# Requirements: Linux with kernel > 2.6.4 (released in 2008).
@kriswebdev
kriswebdev / novpn.sh
Last active April 9, 2024 06:24
novpn: Bypass VPN for specific apps [Linux / OpenVPN]
#!/bin/bash
# === INFO ===
# NoVPN
# Description: Bypass VPN tunnel for applications run through this tool.
VERSION="3.0.0"
# Author: KrisWebDev
# Requirements: Linux with kernel > 2.6.4 (released in 2008).
# This version is tested on Ubuntu 14.04 and 19.10 with bash.
# Main dependencies are automatically installed.
@hfreire
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active March 24, 2024 14:35
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
@melmatsuoka
melmatsuoka / videoContactSheet.sh
Last active May 3, 2024 03:52
Generates thumbnail contact-sheets of all video files in the current working directory
#!/bin/bash
#
# Generates thumbnail contact sheets of all video files in current working directory.
#
# Script defaults to writing PNG contact sheets to the same folder, using the original
# video filename as the basename for the contact sheet
#
# More details: https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video
#
# NOTE: 'montage' requires that Ghostscript be installed, in order to be able to generate titles