Skip to content

Instantly share code, notes, and snippets.

View gamma's full-sized avatar

Gerry Weißbach gamma

View GitHub Profile
@gamma
gamma / rsync
Created June 13, 2023 06:12
Create Backup from Hetzner Storage Box to Synology DSM using ActiveBackup For Business
#!/bin/bash
# Backing up a Hetzner Storage box TO the Synology DSM does not work easily due to
# the special rsync paths requhired by Hetzner which is /home as root. However, Synology
# does not allow the and requests the path // - which is basically the root. Hetzner
# not allow that in turn. This script solves the issue by being a wrapper to rsync,
# which modifies the command to reflect that change.
#
# Script is provided as is, for free, no guarantees given. Use at your own risk.
#
@gamma
gamma / install-printer.sh
Last active September 29, 2022 06:43
Install alpine PDF printer
#!/bin/bash
# run with:
# curl -sSL https://gist.githubusercontent.com/gamma/a089aed5277cc727f9ccee01c4f8d1c6/raw | sh --
# Add testing repo
echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
# Install cups
apk add cups cups-libs cups-pdf@testing cups-client cups-filters hplip@testing
@gamma
gamma / ImageReadTest.java
Created March 22, 2022 19:25
Adoptium JVM Docker Crash with OpenJPEG2k / JNR JFFI
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import javax.imageio.ImageIO;
import javax.imageio.spi.IIORegistry;
@gamma
gamma / relocate.sh
Created November 15, 2021 10:45
SVN relocate for a list of directories
#!/bin/bash
# This script is used to relocate a Subversion repository from one
# filesystem location to another. It is intended to be run from the
# command line, but it can be run from any other program too.
# You can prepare the new repository location using:
#
# export NEW_SVN_LOCATION=file:///path/to/new/repository
#
# The script can be run using the following command - The list
@gamma
gamma / gradle@6.rb
Created October 14, 2021 07:26
gradle@6.rb
# cat > /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gradle@6.rb
class GradleAT6 < Formula
desc "Open-source build automation tool based on the Groovy and Kotlin DSL"
homepage "https://www.gradle.org/"
url "https://services.gradle.org/distributions/gradle-6.9.1-all.zip"
sha256 "b13f5d97f08000996bf12d9dd70af3f2c6b694c2c663ab1b545e9695562ad1ee"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, x86_64_linux: "fd167292281521adf832093bbc0485f5a03e82c9962039f54f12e59d0d2dce1b"
@gamma
gamma / dd-progress.sh
Created March 4, 2019 09:38
MacOS bash dd command with progress
function isodump {
FILE=$1
DISK=$2
if [ -z "$FILE" ] || [ -z "$DISK" ] ; then
echo "Usage: isodump <ISO File> <DEVICE>"
return 128
fi
@gamma
gamma / gradle4.rb
Last active May 4, 2022 13:27
Gradle 4 for homebrew
# cat > /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gradle4.rb
# brew install --build-from-source gradle4
class Gradle4 < Formula
desc "Open-source build automation tool based on the Groovy and Kotlin DSL"
homepage "https://www.gradle.org/"
url "https://services.gradle.org/distributions/gradle-4.10.3-all.zip"
sha256 "336b6898b491f6334502d8074a6b8c2d73ed83b92123106bd4bf837f04111043"
# not needed in newer gradle releases
# bottle :unneeded
@gamma
gamma / maz.sh
Created April 26, 2018 05:29
Abzug der aktuellen Tageszeitung der MAZ Oberhavel
#!/bin/bash
USER="$1"
PASS="$2"
BASE="https://epaper.maz-online.de"
LOGIN=$(curl -v $BASE 2>&1)
COOKIE=$(echo "$LOGIN" | grep "Set-Cookie" | tail -n 1 | awk '{print $3}')
TOKEN=$(echo "$LOGIN" | grep "token" | awk -F\" '{print $6}')
@gamma
gamma / upgrade.sh
Last active August 7, 2017 04:40
Rolling Update with docker-compose and old Swarm Image. Expects docker-compose.yml side-by-side
#!/bin/bash
# Use the command line arguments as input. Each argument is a service.
SERVICE_LIST=`echo "$@" | tr ' ' '\n'`
if [ -z "${SERVICE_LIST[@]}" ]; then
SERVICE_LIST=`docker-compose config --services`
fi
# Check for all services in the compose file, scale them to "two"
echo "+++++++++++++++++++++++++"
@gamma
gamma / README.md
Last active July 31, 2024 03:13
How to connect a docker container to the docker daemon on a Synology NAS

Note: This originates from: https://forum.synology.com/enu/viewtopic.php?f=258&t=107508&sid=78d911737c5ecea1f9087bdab13612bf&start=15#p478281

Here are steps that I have modified to work for me. This assumes you have a shared folder named "docker" in volume1.

We need to Symlink /var/run/docker.sock to /volume1/docker/docker.sock, because Synology Docker GUI will not be able to run it when it's pointed directly to /var/run/docker.sock. Also the symlink needs to persist after reboot. To make it do so, you will need to create an automated task in your Synology DSM via "Task Scheduler".

  • Go to "Control Panel" > "Task Scheduler".
  • Click "Create" > "Scheduled Task" > "User-defined Script".
  • On the "Create Task: Window, make sure "User:" is selected as "root" and rename the "Task:" to whatever you like.
  • Click "Schedule" tab. Under "Date - Run on the following days", select "Daily". Under "Time - Frequency", select "Every 1 hour(s)" (just to be on the safe side).