This file contains hidden or 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
backup_dir_function() { | |
# Log the start of the command | |
logger -p syslog.info "Starting backup process." | |
# must pass in a directory | |
directory="$1" | |
# Convert to absolute path if a relative path is given | |
if [[ ! "$directory" = /* ]]; then | |
directory="$(pwd)/$directory" | |
fi |
This file contains hidden or 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
# Check for administrator privileges | |
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
# Relaunch the script as an administrator | |
Start-Process powershell -Verb runAs -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`"" | |
exit | |
} | |
# init directory existence check variable | |
$dirExists = $false |
This file contains hidden or 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
# Define the variables | |
# The server or root directory | |
$localserver = "\\<localserver>" | |
# Share | |
$share = "\share" | |
# Source data folders you wish to backup | |
$dataFolders = @("\backups", "\pics") # You can add more folders to this array if needed |
This file contains hidden or 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 | |
# Manages concurrent execution of nohup jobs with a maximum limit. | |
# Number of maximum concurrent jobs | |
MAX_JOBS=4 | |
# List of commands you want to run with nohup | |
declare -a commands=( | |
"./sleepTest.sh" |
This file contains hidden or 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-ActiveConnections { | |
netstat -an | Where-Object { $_ -match 'ESTABLISHED|LISTENING' } | |
} |
This file contains hidden or 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
Get-FileHash .\FGT* -Algorithm MD5 | Format-Table -AutoSize |
This file contains hidden or 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
# Original idea: https://devblogs.microsoft.com/scripting/clean-up-domain-controller-dns-records-with-powershell/ | |
# dnsSrv is only the only the hostname, no domain, of active DNS server, i.e. MYDNSSERVER | |
$dnsSrv = "<active-dns-server-hostname>" | |
# the server we are trying to remove, FQDN is Fully Qualified Domain Name, i.e. MYDNSSERVER.mydomain.local | |
$oldSrvFQDN = "<old-dns-FQDN>" | |
$oldSrvHost = "<old-dns-Hostname>" | |
$oldSrvIp = "<old-dns-ip-address>" |
This file contains hidden or 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
import smtplib | |
def prompt(prompt): | |
return input(prompt).strip() | |
fromaddr = prompt("From: ") | |
toaddrs = prompt("To: ").split() | |
print("Enter message, end with ^D (Unix) or ^Z (Windows):") | |
# Add the From: and To: headers at the start! |
This file contains hidden or 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
<# | |
# Check DNS Configuration | |
#> | |
Write-Host "Checking DNS configuration..." | |
$error.clear() | |
try {Resolve-DnsName -Name microsoft.com -DnsOnly -QuickTimeout} | |
catch { "timeout period expired" } | |
if ($error) { |
This file contains hidden or 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
# 3D Builder | |
Get-AppxPackage *3dbuilder* | Remove-AppxPackage | |
# Alarms & Clock | |
Get-AppxPackage *windowsalarms* | Remove-AppxPackage | |
# Calculator | |
Get-AppxPackage *windowscalculator* | Remove-AppxPackage | |
# Camera |