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'}
@leopoldodonnell
leopoldodonnell / Readme.md
Last active July 14, 2024 20:34
Install and run Postgres with an extension using docker-compose

Local Postgres

This gist is an example of how you can simply install and run and extended Postgres using docker-compose. It assumes that you have docker and docker-compose installed and running on your workstation.

Install

  • Requires docker and docker-compose
  • Clone via http: git clone https://gist.github.com/b0b7e06943bd389560184d948bdc2d5b.git
  • Make load-extensions.sh executable
  • Build the image: docker-compose build
@hjbotha
hjbotha / free_ports.sh
Last active July 10, 2024 17:33
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 May 12, 2024 16:46
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 July 5, 2024 08:51
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