Skip to content

Instantly share code, notes, and snippets.

View README.md

Accompanying scripts for https//stuartleeks/posts/wsl-github-cli-windows-notifications-part-2/

Abbreviated setup notes

Enjoy!

View wait-for-dns.sh
#!/bin/bash
############################################################################################
#
# Script used testing access to an Azure storage account with a private endpoint
#
############################################################################################
#
# Argument parsing
@stuartleeks
stuartleeks / .bashrc-utils.sh
Last active Jul 7, 2020
.bashrc-utils: Functions, aliases etc from my .bashrc
View .bashrc-utils.sh
# Functions, aliases etc from my .bashrc
#
# General utils
#
# from: https://gist.github.com/stuartleeks/c21f035a411215fd20f5a85f78450d01
# simplify dlv debug etc: `dlv2 debug ./cmd/to/run arg1 arg2 ...`
dlv2() { dlv $1 $2 --headless --listen localhost:2345 --api-version 2 -- "${@:3}" ; }
View PowerShellProfile.ps1
$env:HOME="" # avoid conflicts with devcontainers across OSes
$env:GIT_SSH="C:\Windows\System32\OpenSSH\ssh.exe" # set git to use the OpenSSH install and pick up keys from the SSH Agent (avoiding prompting for passphrases)
View dlv2-add-to-bashrc.sh
# simplify dlv debug etc: `dlv2 debug ./cmd/to/run arg1 arg2 ...`
dlv2() { dlv $1 $2 --headless --listen localhost:2345 --api-version 2 -- "${@:3}" ; }
View PowerShellInclude.ps1
function Set-Prompt {
param (
# Specifies a path to one or more locations.
[Parameter(Mandatory=$true,
ValueFromPipeline=$true)]
[ValidateNotNull()]
[string]
$PromptText
)
$Host.UI.RawUI.WindowTitle = $PromptText
View free-mem.sh
free -h
sync
echo 3 > /proc/sys/vm/drop_caches
free -h
View .bashrc-ssh-forward.sh
#
# Set up ssh agent forwarding to host
#
# Include this in .bashrc
# Ensure that the ssh-agent service is running on windows
# build https://github.com/jstarks/npiperelay and ensure it is in your PATH (or modify the script to specify the qualified path)
# Configure ssh forwarding
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
@stuartleeks
stuartleeks / helpers.sh
Last active Apr 6, 2020
wcode - launch VS Code in Windows from WSL (using \\wsl$\... path)
View helpers.sh
wcode() { cmd.exe /C code ''$(wslpath -w $1)''; }
wcode-insiders() { cmd.exe /C code-insiders ''$(wslpath -w $1)''; }
View devcontainer.sh
# usage: `devcontainer <partial container name or mount path>`
#function devcontainer(){ docker exec -it $(docker ps -q | xargs docker inspect --format "{{.ID}} {{.Name}} {{range .Mounts}}{{.Source}}|{{end}}" | grep $1 | awk '{print $1}') bash; }
# replaced by https://github.com/stuartleeks/devcontainer-cli/