Skip to content

Instantly share code, notes, and snippets.

@DMeurer
DMeurer / PiHoleTopNAllowedDomains.py
Created June 4, 2025 22:16
Show the top N (defalut is 100) allowed queries in your network. Run with `--help` to get more info. Run this script on your device with the PiHole installed.
#!/usr/bin/env python3
"""
Pi-hole FTL Database Query Exporter
Exports top 100 allowed/permitted queries with all available information to CSV
Creates two output files:
1. Summary CSV: Just the top domains with their query counts (100 rows)
2. Detailed CSV: All individual queries for these top domains (can be large)
Use --summary-only to only create the summary file and skip the detailed export.
@DMeurer
DMeurer / gitAutoBackup.ps1
Created December 12, 2024 14:42
Auto-Backup a Git Repository. You can run it in Autostart or from TaskScheduler, etc. It will display MERGE CONFLICT and pause if you got one, otherwise it will just close itself. I'm using it to Backup a KeePass File.
git stash -u
git pull
git stash pop
$outp = $null;
$outp = git ls-files -u
if ($outp -eq $null){
Write-Host "No conflics" -ForegroundColor Green
} else {
Write-Host "===== MERGE CONFLICTS =====" -BackgroundColor DarkRed
@DMeurer
DMeurer / install_chocolately_and_package.ps1
Created October 24, 2024 10:20
Install a chocolately package and chocolately if not already installed. You have to run `Set-ExecutionPolicy remotesigned` to execute the script.
# install Chocolately
If(Test-Path -Path "$env:ProgramData\Chocolatey") {
echo "Chocolately is installed"
} Else {
echo "Chocolately is not installed. Installing now..."
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
echo "Chocolately is installed"
}
# reload path
@DMeurer
DMeurer / MultiCopy.ps1
Last active September 2, 2024 06:36
A wrapper for robocopy asking for the paths and filling in the rest. Can be used as automatable cli or just startet with some prompts.
$paramMode = $args[0]
$paramSource = $args[1]
$paramDestination = $args[2]
$paramSilent = $args[3]
$silent = (($paramSilent -eq "-s") -or ($paramSilent -eq "--silent"))
if ($silent -eq $false)
{
Write-Host "$( [char]0x1b )[38;5;51m ______ ___ _______________ $( [char]0x1b )[38;5;84m _________ $( [char]0x1b )[0m