Skip to content

Instantly share code, notes, and snippets.

View robearlam's full-sized avatar

Rob Earlam robearlam

View GitHub Profile
sudo vault server -config /etc/vault/config.json
vault operator init
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"
}
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/
sudo certbot certonly --standalone -d <<DOMAIN_NAME>>
schtasks /create /tn "WSL-Port-Mapping" /sc onstart /delay 0000:30 /rl highest /ru system /tr "powershell.exe -file "<<PATH_TO_POWERSHELL_SCRIPT>>"
$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;
}
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
@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
@robearlam
robearlam / dockergist.ps1
Created November 20, 2019 15:55
Get Internal IP for all running Docker containers on Windows
(docker ps -q | ForEach-Object { docker inspect $_ --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}' }).replace('/','')
@robearlam
robearlam / Dockerfile
Last active August 11, 2019 02:57
Using VSCode to debug a .NETCore application running inside a Docker container
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
COPY myapp/*.csproj ./myapp/
RUN dotnet restore
# copy everything else and build app
COPY myapp/. ./myapp/