View wslsetup.ps1
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
if (((wsl -l --all) | Where-Object { $_ -like "Ubuntu-20.04" }).Length -eq 0) { | |
wsl --install --distribution Ubuntu-20.04 | |
} | |
RefreshEnv | |
ubuntu2004.exe run sudo apt-get install -y software-properties-common | |
ubuntu2004.exe run sudo apt-add-repository -y ppa:rael-gc/rvm | |
ubuntu2004.exe run sudo apt-get update | |
ubuntu2004.exe run sudo apt-get install rvm |
View gitchanges.sh
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
if ! git diff-index --quiet HEAD --; then | |
echo "I have changes to be pushed" | |
fi |
View profiles.json
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
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"globals": { | |
"alwaysShowTabs": true, | |
"initialCols": 120, | |
"initialRows": 30, |
View hamilton.sh
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 hamilton() { | |
results=$(curl -s https://www.formula1.com/en/results.html/$(date +%Y)/races.html) | |
gp=$(echo "$results" | nokogiri -e 'puts $_.at_xpath("//table[@class=\"resultsarchive-table\"]/tbody/tr[last()]/td[2]/a").text.strip' 2>/dev/null) | |
date=$(echo "$results" | nokogiri -e 'puts $_.at_xpath("//table[@class=\"resultsarchive-table\"]/tbody/tr[last()]/td[3]").text' 2>/dev/null) | |
winner=$(echo "$results" | nokogiri -e 'puts $_.at_xpath("//table[@class=\"resultsarchive-table\"]/tbody/tr[last()]/td[4]/span[2]").text' 2>/dev/null | tr 'A-Z' 'a-z') | |
echo -e "Did Hamilton win?\n${gp}: ${date}\n" | |
if [ "$winner" == "hamilton" ]; then | |
echo "YES. I'm guessing Ferrari botched team orders, and Williams probably came last." | |
else | |
echo "NO. ANYTHING IS POSSIBLE. REVEL IN THE UNPREDICTABLITY OF LIFE." |
View mktemp.ps1
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 mktemp { | |
param ( | |
[Parameter(mandatory=$false)]$Extension | |
) | |
$randomfile = [System.IO.Path]::GetRandomFileName() | |
if ($Extension) { | |
$randomfile = [System.IO.Path]::ChangeExtension($randomfile, $Extension) | |
} | |
return Microsoft.PowerShell.Management\Join-Path ([System.IO.Path]::GetTempPath()) "$randomfile" | |
} |
View check-windows-cert-expiry.ps1
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
# exit codes reflect this script's use as a Sensu check | |
# replace "YOUR ISSUER HERE" with the CA of your choice | |
param ( | |
[Parameter(Mandatory=$True)][int]$critical = $(throw "-critical - is required."), | |
[Parameter(Mandatory=$True)][int]$Warning = $(throw "-warning - is required."), | |
[Parameter(Mandatory=$False)][string]$computer = $env:COMPUTERNAME.Tolower() | |
) | |
$cert=$(get-childitem cert:LocalMachine\My -recurse | where-object { $_.Issuer -match "YOUR ISSUER HERE" } | select Subject,@{Name="DaysRemaining";Expression={($_.NotAfter).subtract([DateTime]::Now).days}}) |
View unifi_jail_file_transfer_from_host.sh
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
# get jail paths | |
root@freenas:~ > jls | |
JID IP Address Hostname Path | |
3 unifi /mnt/default/iocage/jails/unifi/root | |
root@freenas: > mv ~/keystore /mnt/default/iocage/jails/unifi/root/usr/local/share/java/unifi/data/ |
View unifi_dns_record.sh
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
# Create a DNS record in a Unifi USG | |
# ssh to USG | |
configure | |
# create an A record | |
set system static-host-mapping host-name HOSTNAME inet IPADDRESS | |
# create a CNAME | |
set system static-host-mapping host-name HOSTNAME alias CNAME |
View ntpconfig.ps1
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
# from an elevated prompt | |
Stop-service w32time | |
w32tm /config /syncfromflags:manual /manualpeerlist:"server1.domain.tld,server2.domain.tld" | |
w32tm /config /reliable:yes | |
start-service w32time | |
# get sync status | |
W32tm /query /status |
View gitconfig
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
[alias] | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
since = !git log $(git merge-base --fork-point master)..HEAD | |
files-changed="!f() { git log --name-only $1..HEAD --oneline --format=%n ${2:-.} | grep -v '^$' | sort | uniq; }; f" |
NewerOlder