Skip to content

Instantly share code, notes, and snippets.

@stuartleeks
stuartleeks / devcontainer.sh
Last active July 7, 2020 06:48
devcontainer
# 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/
$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)
@stuartleeks
stuartleeks / cloudSettings
Last active June 24, 2020 08:12
Visual Studio Code Sync Settings GIST
{"lastUpload":"2020-06-24T08:12:00.857Z","extensionVersion":"v3.4.3"}
@stuartleeks
stuartleeks / dlv2-add-to-bashrc.sh
Created June 8, 2020 10:40
dlv2 - delve helper
# simplify dlv debug etc: `dlv2 debug ./cmd/to/run arg1 arg2 ...`
dlv2() { dlv $1 $2 --headless --listen localhost:2345 --api-version 2 -- "${@:3}" ; }
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
free -h
sync
echo 3 > /proc/sys/vm/drop_caches
free -h
@stuartleeks
stuartleeks / .bashrc-ssh-forward.sh
Last active May 4, 2020 20:47
WSL SSH forwarding
#
# 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 April 6, 2020 13:32
wcode - launch VS Code in Windows from WSL (using \\wsl$\... path)
wcode() { cmd.exe /C code ''$(wslpath -w $1)''; }
wcode-insiders() { cmd.exe /C code-insiders ''$(wslpath -w $1)''; }
@stuartleeks
stuartleeks / README.md
Last active December 4, 2019 10:14
Quick kubectl config

NOTES

Quick script that I can drop in to set up kubectl completion and aliases etc

wget -q -O - https://gist.githubusercontent.com/stuartleeks/29e58601de67f270f27ee240d7b0a5e3/raw/setup.sh | bash
@stuartleeks
stuartleeks / profile-azbrowse.json
Created November 7, 2019 17:53
Windows Terminal config snippets
// profile for azbrowse (including navigating to subscription - hint: update the subscription id)
{
"acrylicOpacity": 0.5,
"closeOnExit": true,
"colorScheme": "Ubuntu-sl",
"commandline": "C:\\Windows\\System32\\bash.exe -c \"azbrowse navigate /subscriptions/00000000-0000-0000-0000-000000000000\"",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Fira Code",
"fontSize": 14,