Skip to content

Instantly share code, notes, and snippets.

View sheldonhull's full-sized avatar
👋
Hi! Who keeps their github status up to date? You get a 🌮 just for reading this

sheldonhull sheldonhull

👋
Hi! Who keeps their github status up to date? You get a 🌮 just for reading this
View GitHub Profile
@sheldonhull
sheldonhull / new-profile.ps1
Created January 13, 2023 22:06
super simple powershell profile improvement with starship
# This should go into the $PROFILE file. Open in code easily with `code $PROFILE` in a powershell terminal.
if (-not (Get-InstalledModule PSReadline -ErrorAction SilentlyContinue)) {
Install-Module PSReadline -Force -Confirm:$false -Scope CurrentUser -AllowPrerelease
}
if (-not (Get-Module PSReadline)) {
Import-Module PSReadline -DisableNameChecking -Global -Force
}
Set-PSReadLineOption -EditMode Windows
@sheldonhull
sheldonhull / op_session.sh
Created October 6, 2022 17:22 — forked from scottrbaxter/op_session.sh
1password cli session check and expiration variable
#!/usr/bin/env bash
# starts (or restarts) a 1password cli session, sets 30 minute countdown variable
# use: OP_CLOUD_ACCOUNT="[your-account-name]" source /path/to/op_session.sh command
# e.g.: OP_CLOUD_ACCOUNT="familyname" source ~/op_session.sh get account
check_session(){
# attempt sign in if session is not active
@sheldonhull
sheldonhull / vscode-scripting.md
Last active September 9, 2022 22:36
vscode-scripts

VSCode Scripting

  • Show all installed extensions: code --list-extensions | xargs -L 1 echo code --install-extension
@sheldonhull
sheldonhull / kubectl.md
Last active August 22, 2022 22:45
Kubectl hacks

Port Forwarding To A Pod

When you can't easily port forward to a service, here's how to grab a single pod from the matching selector and port forward to it.

NAMESPACE=
INSTANCE=myapp
CONTEXT=
PORT_LOCAL=
PORT_REMOTE=
@sheldonhull
sheldonhull / .commitlintrc.yml
Created August 4, 2022 16:19
.commitlintrc.yml defaults
---
# parserPreset: conventional-changelog-conventionalcommits
rules:
body-leading-blank:
- 0
- always
body-max-line-length:
- 0
- always
- 100
@sheldonhull
sheldonhull / simpler.go
Last active August 15, 2022 18:41
Simple Log for Leetcode, Hackerank, and other tools using standard library. This is to simplify the need to comment out a bunch of fmt statements and instead provide a lighweight boilerplate for simple log output with indentation that can be disabled when ready with changing level in stuct.
// requires go 1.18
import (
"os"
"fmt"
)
func info(format string, a ...any) (n int, err error) {
return fmt.Fprintf(os.Stdout, format + "\n", a...)
}
@sheldonhull
sheldonhull / backup-zshfiles.sh
Last active March 26, 2022 22:26
backup zsh files to bak directory
#!/usr/bin/env bash
setopt extended_glob
set +e
export ZDOTDIR=$HOME/.config/zsh
zfiles=( "$HOME/.zlogin" "$HOME/.zlogout" "$HOME/.zpreztorc" "$HOME/.zprofile" "$HOME/.zsh_history" "$HOME/.zshenv" "$HOME/.zshrc" )
echo "$zfiles"
mkdir -p ~/.bak
for zfile in "${zfiles[@]}"; do
echo "backing up $zfile"
(cp $zfile ~/.bak 2>/dev/null || true)
@sheldonhull
sheldonhull / pulumi-kubernetes-setup.go
Created January 28, 2022 22:07
[Use Pulumi With Kubernetes and Handle Loading Config as Well As Overrides] Not elegant but worked for round 1 #kubernetes #go #pulumi
package main
import (
"fmt"
"os"
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
@sheldonhull
sheldonhull / README.md
Last active December 15, 2021 21:05
Uninstall Disabled Extensions from VSCode Settings Backup

Cleanup Extensions

I've had issues with them toggling back on and causing conflict.

Download the json from settings backup, parse to the disabled extensions and then forcibly uninstall to ensure no further sync issue.

cat extensions.uninstall.json | jq '.[] | select(.disabled==true)' | jq '.identifier.id' -r | while read -r key; read -r val; do
  code-insiders --uninstall-extension $val
done
@sheldonhull
sheldonhull / README.md
Last active December 14, 2021 03:37
Clean Go Mod Cache

Clean Go Mod Cache

  • run go clean -modcache
  • run sudo --preserve-env find $HOME/go/pkg/mod -exec rm -rf {} +