Skip to content

Instantly share code, notes, and snippets.

View sebastian13's full-sized avatar

Sebastian Plocek sebastian13

  • Vienna, Austria
View GitHub Profile
@sebastian13
sebastian13 / enum-enc-shares.sh
Last active April 7, 2024 16:41
List any encrypted but not mounted volume on a Synology NAS
#!/bin/bash
#
# List any encrypted but not mounted volume on a Synology NAS
#
# Author: Sebastian Plocek
# https://gist.github.com/sebastian13/81f4b6124e8d7d0551c1b3e2ffb2c609
#
dsm="https://<your-nas-domain>:<your-dsm-port>"
@sebastian13
sebastian13 / fix-wordpress-permissions.sh
Last active April 7, 2024 16:40
Set WordPress' file permissions when using docker compose
#!/bin/bash
# https://gist.github.com/sebastian13/c57fb8f62863112825b7b1b912b9a2d8
#
# This script sets WordPress' file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
# and https://stackoverflow.com/a/23755604/8940679
#
# Idea from https://github.com/mconigliaro/notes/blob/master/wordpress/permissions.md
#
# To use this script run:

Download RouterOS packages for CAPs on CAPsMAN

  1. Create the script download-caps-routeros. Add or remove packages, depeding on caps' hardware.

  2. Add a scheduler

/system scheduler
add name=download-caps-routeros on-event=":delay 120s\
 \n/system script run download-caps-routeros" start-time=startup
@sebastian13
sebastian13 / $mikrotik-backup-and-upgrade.md
Last active January 2, 2024 17:02
Backup & Auto Upgrade Mikrotik RouterOS

Backup & Auto Upgrade Mikrotik Routers

  1. Set SMTP
/tool e-mail
set address=smtp.gmail.com from=___@gmail.com port=587 tls=starttls \
    user=___@gmail.com password=___
@sebastian13
sebastian13 / AdminPrinterDeploy.ps1
Last active February 16, 2024 14:44
How to install printers post PrintNightmare patch
# Deploy this via PDQ Deploy or run once as admin
# Delete all Network Printers
Get-WmiObject -Class Win32_Printer | where{$_.Network -eq 'true'} | ForEach-Object {$_.Delete()}
# Add Driver to the Store
# ... example for Sharp 1910a - 9.1.18.47
pnputil.exe /a "\\nas01\tools\drivers\_Printers\MX_D54_PCL6_PS_1910a_German_64bit\German\PCL6\64bit\su0emdeu.inf"
# Install the Driver
@sebastian13
sebastian13 / nginx-redirect-to-first-servername.conf
Created October 4, 2021 08:09
Redirect any server_name to the first one defined
server {
listen 80;
listen [::]:80;
server_name example.com 1.example.com;
# Redirect all HTTP links to the matching HTTPS page
location / {
return 301 https://$host$request_uri;
}
}
@sebastian13
sebastian13 / mikrotik-wifi-button.rsc
Created May 14, 2021 20:43
Script to enable & disable wifi on a Mikrotik (standalone) Access Point using the Mode Button
:log info message=("mode button was pressed");
:local i
:if ( [/int wir get 0 disabled ] = true ) do={
:foreach i in= [ /int wir find ] do={ :int wir enable $i };
} else={
:foreach i in= [ /int wir find ] do={ :int wir disable $i };
}
#!/bin/bash
# Change to the script's directory & create directory
cd $(dirname "$(readlink -f "$0")")
mkdir -p ./dbdumps
# Start mysql service
docker --log-level=error compose up -d mysql
# Wait
@sebastian13
sebastian13 / reset-zabbix-admin.sh
Created October 10, 2019 19:48
Reset a zabbix user password using mysql
# Access mysql console
mysql -u root -p
# Select Database
use zabbix;
# List existing users
select * from users;
# Update Password
@sebastian13
sebastian13 / synology-commands.sh
Created August 30, 2019 18:14
Collection of useful terminal commands for Synology DS.
# Renew Let's Encrypt Certificates
/usr/syno/sbin/syno-letsencrypt renew-all
# Disable Firewall
/usr/syno/bin/synofirewall --disable