Skip to content

Instantly share code, notes, and snippets.

@Xeckt
Xeckt / pikvmv4-util.sh
Created January 11, 2024 15:49
Small bash script to manage basic functions for the PiKVMv4 products. Feel free to take and add.
#!/bin/bash
set_edid() {
read -p "enter file location of .hex edid: " edid
if ! [ -f "$edid" ]; then
echo "edid file does not exist"
exit 1
fi
kvmd-edidconf --import="$edid"
}
@Xeckt
Xeckt / domain-check.sh
Created August 9, 2021 10:01
Domain Expiration Check. Adding this here in-case the repo from https://github.com/nixcraft/domain-check-2 expires.
#!/usr/bin/env bash
#
# Program: Domain Expiration Check <domain-check>
#
# Author: Matty < matty91 at gmail dot com >
#
# Current Version: 2.18
# Last Updated: 07-Jan-2019
#
@Xeckt
Xeckt / PrintSpoolFixer.ps1
Last active November 21, 2022 13:39
Clear that pesky printer spool when the queue is just too large!
#Requires -Version 7.3
$global:UserInput = $null
$global:PrintPipelineProcess = "printfilterpipelinesvc"
$global:PrintPipelineExe = "C:\Windows\System32\printfilterpipelinesvc.exe"
$global:SpoolerService = "spooler"
$global:SpoolDirectory = "C:\Windows\System32\spool\PRINTERS"
$global:CurrentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
function GetItemsInQueue() {
@Xeckt
Xeckt / pst.ps1
Created June 30, 2021 12:59
Set Outlook PST Max Size
$global:OutlookPstMaxFileSize = 0
$global:ComputerName = [System.Net.Dns]::GetHostName()
$global:Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('CurrentUser', $global:ComputerName)
$global:OutlookDataSizeRegistryPath = $global:Registry.OpenSubKey("Software\Microsoft\Office\16.0\Outlook\PST", $true)
$FileSize = Read-Host "Write file size in GB for max PST size"
$global:OutlookDataSizeRegistryPath.SetValue("MaxLargeFileSize", ([int]$FileSize * 1024))
# I'm using $global variables for convenience as this script may be added to later to include more outlook functionality and registry interactions.
@Xeckt
Xeckt / backup.sh
Created June 10, 2021 09:35
Rsync backup with remote destination file creation
#!/bin/bash
_backup_serv="username@ip_address"
_backup_loc="/volume1/backups/example"
_current_date=$(date '+%Y-%m-%d-%H:%M:%S')
if [[ $1 == "--backup-sys" ]]; then
if [[ $2 == "--test" ]]; then
rsync -aXv --delete --dry-run --rsync-path="mkdir -p $_backup_loc/$_current_date && rsync" --exclude="/media" --exclude="/mnt" --exclude="/proc" --exclude="/sys" --exclude="/var/lock/" --exclude="/var/lock/" --exclude="/var/run/" / $_backup_serv:$_backup_loc/$_current_date
else
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
@Xeckt
Xeckt / Dockerfile
Created May 25, 2021 16:39
Composer PHP-FPM 7.2.5 Dockerfile
FROM php:7.2.5-fpm
# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
@Xeckt
Xeckt / chkspace.sh
Created May 25, 2021 16:34
Check disk space on system. Exclude list can include more than one drive, example given in the EXCLUDE_LIST.
#!/bin/sh
ALERT=90
EXCLUDE_LIST="/dev/hdd1|/dev/hdd2"
main_prog() {
while read -r output;
do
usep=$(echo "$output" | awk '{ print $1}' | cut -d'%' -f1)
partition=$(echo "$output" | awk '{print $2}')
@Xeckt
Xeckt / swapfile.sh
Last active January 11, 2024 17:39
Change swap file size
#!/bin/bash
change_swap() {
read -rp "Size to change swap file to in whole number format e.g. 8 for 8GB >> " swap_file_size
read -rp "Specify swapfile path/to/file >> " swap_file
echo "Turning off swap for all swap files"
if swapoff -a ; then
echo "Turning off swap successful. DD'ing $swap_file to size $swap_file_size"
if dd if=/dev/zero of="$swap_file" bs=1G count="$swap_file_size" ; then
echo "dd done, setting file permissions for swap"
@Xeckt
Xeckt / install.sh
Last active May 25, 2021 16:35
Ubuntu desktop raid installer
#!/bin/bash
# Device naming
dev_one=""
dev_two=""
raid_device=""
raid_uuid=$(uuidgen)
efi_sysname=""
install_name=""