Skip to content

Instantly share code, notes, and snippets.

View sebastian13's full-sized avatar

Sebastian Plocek sebastian13

  • Vienna, Austria
View GitHub Profile
#!/bin/bash
# Change to the script's directory & create directory
cd $(dirname "$(readlink -f "$0")")
mkdir -p ./dbdumps
# Load database name + root password
source .env
# Check if variables were provided
@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 July 30, 2024 08: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 June 24, 2024 23:34
Backup & Auto Upgrade Mikrotik RouterOS
@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