Skip to content

Instantly share code, notes, and snippets.

View robearlam's full-sized avatar

Rob Earlam robearlam

View GitHub Profile
@robearlam
robearlam / profile.ps1
Last active June 6, 2023 23:19
PowerShell profile definition
#requires -Version 6
function Get-BranchName
{
$default = "n/a"
$currentPath = $ExecutionContext.SessionState.Path.CurrentLocation
while ($true)
{
try
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot
$remoteport = bash.exe -c "ip addr show eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
schtasks /create /tn "WSL-Port-Mapping" /sc onstart /delay 0000:30 /rl highest /ru system /tr "powershell.exe -file "<<PATH_TO_POWERSHELL_SCRIPT>>"
sudo certbot certonly --standalone -d <<DOMAIN_NAME>>
wget https://releases.hashicorp.com/vault/1.4.0/vault_1.4.0_linux_amd64.zip
unzip vault_1.4.0_linux_amd64.zip
mv vault /usr/local/bin/
disable_cache = true
disable_mlock = true
ui = true
listener "tcp" {
address = "0.0.0.0:8200"
tls_disable = 0
tls_cert_file = "/etc/letsencrypt/live/<<DOMAIN_NAME>>/fullchain.pem"
tls_key_file = "/etc/letsencrypt/live/<<DOMAIN_NAME>>/privkey.pem"
}
sudo vault server -config /etc/vault/config.json
vault operator init