Skip to content

Instantly share code, notes, and snippets.

@NiceRath
NiceRath / windows-get-list-of-installed-programs.ps1
Last active November 12, 2025 10:15
Get List of installed Programs on Windows via Powershell
function Get-InstalledApps {
param (
[Parameter(ValueFromPipeline=$true)]
[string[]]$comps = $env:COMPUTERNAME
)
foreach ($comp in $comps) {
$keys = '','\Wow6432Node'
foreach ($key in $keys) {
$apps = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$comp).OpenSubKey("SOFTWARE$key\Microsoft\Windows\CurrentVersion\Uninstall").GetSubKeyNames()
@NiceRath
NiceRath / mssql-permissions-zabbix-monitoring.txt
Last active October 15, 2025 09:36
MSSQL minimal Permissions for Zabbix ODBC Monitoring
For: https://www.zabbix.com/integrations/mssql
# MSSQL PERMISSIONS:
Server-Roles: public
User Mapping:
msdb: db_owner
Securables: (for local Server)
Grant: Connect SQL
Grant: View any definition
@NiceRath
NiceRath / fio-benchmark-nvme-64k-mssql.cnf
Last active August 25, 2025 12:46
FIO NVMe Disk-Benchmark for 64k-Performance (MSSQL Server)
# TO RUN:
# apt install fio
# add the config-file on your target system
# replace '/dev/nvmeXn1' with either:
# the path to a block-device you want to benchmark (examples: /dev/md1, /dev/sdb, /dev/nvme2n1, /zfs_nvme [or whatever zfs mountpoint you use])
# the path to a test-file on a mounted partition of ZFS-volume (performance will most likely be worse than on the block-device directly)
# start: fio test.cnf
# NOTE: You might want to lower the iodepth and numjobs to the point where you do not see any improvement - we just eye-balled it
@NiceRath
NiceRath / aruba-cx-backup-pull.sh
Last active August 1, 2025 09:30
ArubaCX Script to backup config via SSH with non-admin user (from Linux server)
#!/bin/bash
# SWITCH CONFIG:
# user-group readonly
# 10 permit cli command "show running-config"
# 20 permit cli command "show startup-config"
# 30 permit cli command "no page"
# 40 permit cli command "show logging -r"
# user backupuser group readonly password plaintext ...
# user backupuser authorized-key ssh-ed25519 ...
@NiceRath
NiceRath / get-list-of-ad-users-password-expiration.ps1
Last active July 15, 2025 17:03
Powershell script to query a list of active AD-Users which password will expire soon or has expired
# Powershell script to query a list of active AD-Users which password will expire soon or has expired
Import-Module ActiveDirectory
$SearchBase="OU=<OU>,DC=<domain>,DC=<dc>"
$users = get-aduser -SearchBase $SearchBase -Filter {(enabled -eq $true) -and (passwordNeverExpires -eq $false)} -properties sAMAccountName, displayName, PasswordNeverExpires, PasswordExpired, PasswordLastSet, EmailAddress, lastLogon, whenCreated
$DefaultmaxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge
foreach ($user in $users) {
$emailaddress = $user.emailaddress
@NiceRath
NiceRath / speedtest_http_ip4_ip6.sh
Last active July 15, 2025 09:35
IPv4 vs IPv6 HTTP Speedtest Script (to CSV)
set -eo pipefail
if [[ -z "$2" ]]
then
echo 'USAGE:'
echo ' 1 > Domain to target (without www)'
echo ' 2 > Number of requests'
echo ''
echo 'OPTIONAL ENV-VARS:'
echo ' CURL_INT > Interface to use'
@NiceRath
NiceRath / speedtest_http3.sh
Last active July 15, 2025 09:36
HTTP2 vs HTTP3 Speedtest Script (to CSV)
set -eo pipefail
if [[ -z "$2" ]]
then
echo 'USAGE:'
echo ' 1 > Domain to target (without www)'
echo ' 2 > Number of requests'
echo ''
echo 'OPTIONAL ENV-VARS:'
echo ' CURL_INT > Interface to use'
@NiceRath
NiceRath / ansible-vault-rekey-file.py
Last active July 8, 2025 09:44
Script to change Ansible-Vault-Password for all Secrets in a YAML file
#!/usr/bin/env python3
# USAGE:
# python3 ansible-vault-rekey.py -i ~/.vault/old.txt -o ~/.vault/new.txt -f ./secrets/dev.yml
# BEHAVIOUR:
# reads the YAML variable-file
# processes all variable-values recursively
# if the variable-value is an Ansible-Vault-encrypted value
# it decrypts it with the old password (or throws error if failed to)
@NiceRath
NiceRath / sphinx_create_modify_timestamps_git.sh
Last active April 8, 2025 14:15
Sphinx - Add Create/Modify Timestamps (GIT-REPO)
# SCRIPT 1:
# BUILDS LIST OF FILE-to-TIMESTAMP CSV
# EXECUTE IN GIT REPO
# NOTE: if you also build the docs on your source-system, you can merge it with script #2
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"
@NiceRath
NiceRath / sphinx_create_modify_timestamps.sh
Last active April 8, 2025 13:49
Sphinx - Add Create/Modify Timestamps (SEE LINK FOR GIT-REPO)
#!/usr/bin/env bash
# FOR GIT SUPPORT: https://gist.github.com/NiceRath/0f1e20bef3d0eea993f7439bc8fc96e6
# NOTE: you might need to change '/contentinfo\">' to whatever element you want to append the timestamps to
set -e
cd "$(dirname "$0")"
rm -rf build