This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Splits an audio file based on timestamps in a cuesheet | |
split_music_compilation() { | |
[[ -f $1 ]] || { echo 'Audio file not found:' "$1"; return 1; } | |
[[ -f $2 ]] || { echo 'Cuesheet file not found:' "$2"; return 1; } | |
local source=$1 cuesheet=$2 count=0 pstamp='0:00' stamp title album | |
while read -r line; do | |
[[ $line =~ ([0-9]+:[0-9]+:[0-9]+).-.(.*).\[(.*)\] ]] && { | |
stamp=${BASH_REMATCH[1]} | |
title=${BASH_REMATCH[2]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generates a coordinate grid to move a player to generate a Minecraft map | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
# Quick n dirty original version: | |
#for x in $(seq -2500 100 2500); do | |
# for z in $(seq -2500 100 2500); do | |
# echo "Cords: $x $z" | |
# screen -S mc -X stuff "/tp $player $x 128 $z\n" | |
# sleep 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SMSManagementPoint { | |
<# .SYNOPSIS | |
Finds SCCM management point based on site code #> | |
Param( | |
# The site code to search | |
[Parameter(Mandatory)] | |
[string]$SiteCode | |
) | |
return [adsisearcher]::new( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Wrapper to start and stop wireguard interfaces | |
wg_start() { | |
echo "Setting up Wireguard interface $2..." | |
ipv4=$(awk '$1 ~ /Address/ && $3 ~ /\./ {print $3}' /etc/wireguard/"${2}".conf) | |
ipv6=$(awk '$1 ~ /Address/ && $3 ~ /:/ {print $3}' /etc/wireguard/"${2}".conf) | |
ip link add dev "$2" type wireguard | |
[[ -n $ipv4 ]] && ip addr add dev "$2" "$ipv4" | |
[[ -n $ipv6 ]] && ip addr add dev "$2" "$ipv6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Last updated 20240331 by AfroThundr | |
# SPDX-License-Identifier: GPL-3.0-or-later | |
Set-StrictMode -Version Latest | |
#region Internal Variables | |
$DefaultPSProfileContent = @' | |
# Note: This profile stub is automatically overwritten, make changes instead in profile_local.ps1 | |
# Always use strict mode | |
Set-StrictMode -Version Latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-StringPermutations { | |
<# .SYNOPSIS | |
Calculates the permutations of an input string #> | |
[Alias('permutate')] | |
Param( | |
# String to calculate permutations from | |
[Parameter(Mandatory)] | |
[String]$String, | |
# Return only unique permutations | |
[Parameter()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SSLServerCertificate { | |
<# .SYNOPSIS | |
Retrieves the X509 certificate by connecting to a SSL enabled server #> | |
[Alias('s_client')] | |
Param( | |
# Hostname or IP address to connect to | |
[Parameter(Mandatory)] | |
[String]$Hostname, | |
# Port to connect to | |
[Parameter()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
const u_btoa = str => btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (_match, pl) => String.fromCharCode('0x' + pl))) | |
const u_atob = str => decodeURIComponent(atob(str).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Set-ScriptSignature { | |
<# .SYNOPSIS | |
Wrapper function to sign and timestamp a script file #> | |
[Alias('SignScript')] | |
Param( | |
# The script file to sign | |
[Parameter(Mandatory)] | |
[String]$ScriptFile | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-RunningTasks() { | |
while ((Get-Task | Where-Object { $_.state -eq 'running' }).count -gt 0) { | |
Get-Task | Where-Object { $_.state -eq 'running' } | | |
Sort-Object name, percentcomplete | | |
Format-Table Name, State, PercentComplete, StartTime, | |
@{ L = 'Target'; E = { $_.ExtensionData.Info.EntityName } }, | |
@{ L = 'Initiator'; E = { $_.ExtensionData.Info.Reason.UserName } } | |
Start-Sleep 10 | |
} | |
} |