Skip to content

Instantly share code, notes, and snippets.

@mfic
mfic / MoveWindow.ps1
Last active July 10, 2024 07:15 — forked from JohnLBevan/MoveWindow.ps1
Move Window To Top Left Corner of Parent Container
# Embed the C# code in PowerShell
# Fork from: https://gist.github.com/JohnLBevan/1593bbb860c2d2af436a1c9414e8adfa
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class WindowMover
{
[StructLayout(LayoutKind.Sequential)]
public struct POINT
@mfic
mfic / cleanupMailuFilter.sh
Last active September 17, 2020 19:27
Remove Mailu filter data if disk space gets used up. Source https://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html
#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom|shm|overlay|udev' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge 90 ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)"
rm -rf /root/mailu-data/filter/*.{map,tmp}
fi
@mfic
mfic / mysql-docker.sh
Created October 31, 2019 12:44 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@mfic
mfic / absender.lco
Created August 14, 2019 18:58 — forked from puppe/absender.lco
Deutsche Briefvorlage für LaTeX (scrlttr2)
\ProvidesFile{absender.lco}
\KOMAoptions{%
% fromemail=true, % Email wird im Briefkopf angezeigt
% fromphone=true, % Telefonnumer wird im Briefkopf angezeigt
% fromfax=true, % Faxnummer wird im Briefkopf angezeit
% fromurl=true, % URL wird im Briefkopf angezeigt
% fromlogo=true, % Logo wird im Briefkopf angezeigt
% subject=titled, % Druckt "Betrifft: " vor dem Betreff
locfield=wide, % Breite Absenderergänzung (location)