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 / magefile.go
Last active April 20, 2023 17:51
optimze dagger go sdk build speed
package main
import (
"os"
"os/exec"
"path/filepath"
"github.com/pterm/pterm"
)
// Build contains the mage task for ... building stuff ... duh.
@sheldonhull
sheldonhull / support-aquaproj.ps1
Last active March 28, 2023 18:02
configure-profile-for-aquaproj-support
if ($PSVERSIONTABLE.PSVersion -lt [version]'7.3.0'){
Write-Error "Update PowerShell. Try choco upgrade powershell-core -y, winget, or scoop install"
return
}
Write-Host "Updating CurrentUserAllHosts to have the required environment variables to properly load binaries managed by Aqua" -ForegroundColor Green
$ENV:PATH = (Join-Path $(go env GOPATH) 'bin'), $ENV:PATH -join [IO.Path]::PathSeparator
$ENV:XDG_DATA_HOME="${HOME}/.local/share
[string]$RootLocation = ''
@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 August 29, 2024 16:31
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"