Skip to content

Instantly share code, notes, and snippets.

View jsugarman's full-sized avatar

Joel Sugarman jsugarman

  • Digital Services
  • London
View GitHub Profile
@jsugarman
jsugarman / gist:66632e88538ccf99dd794489a184b3c0
Last active June 20, 2024 14:12
How to dry run a helm upgrade to debug errors in yaml
helm upgrade name-of-your-local-app-chart ./<helm-config-dir>/. \
--install \
--dry-run \
--namespace=your-namespace \
--values ./<helm-config-dir>/<your-values-file>.yaml \
--set image.repository="som-ecr-repo-not-needed-for-dry-run" \
--set image.tag="some-commit-sha-not-needed-for-dry-run"
@jsugarman
jsugarman / gist:87092900735b34f4b368074e62a86dc3
Created March 14, 2024 12:06
install postgis on mac (M1 chip) OSX (sonoma) with postgresql@16
[brew uninstall postgresql@14]
# check version specific path
[brew install postgresql@16]
sudo ln -sf /opt/homebrew/Cellar/postgresql@16/16.2_1/bin/postgres /usr/local/bin/postgres
brew install postgis
# utilities if you need them installed
brew install wget
@jsugarman
jsugarman / session_double_shared_context.rb
Last active May 16, 2024 05:28
RSpec request spec session double
# Idea from
# https://github.com/DFE-Digital/schools-experience/blob/master/spec/support/session_double.rb
#
RSpec.shared_context "with session double" do
let(:session) { session_double }
let(:session_double) { instance_double(ActionDispatch::Request::Session, enabled?: true, loaded?: false, id: SecureRandom.hex) }
let(:session_hash) { {} }
before do
allow(session_double).to receive(:[]) do |key|
@jsugarman
jsugarman / gist:649b0dbf4c4d2a59e1f235105b0f452b
Created September 14, 2023 15:02
Git related shell alias and functions
# ----------------------------------------------
# git related aliases
# ----------------------------------------------
alias gb='git branch -v'
alias glp='git log --first-parent --pretty=format:"%h - %an, %ar : %s"'
alias gl='git log --pretty=format:"%h - %an, %ar : %s" $(git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@")...'
alias gil='git log --pretty=format:"%h - %an, %ar : %s"'
alias gls='git log --pickaxe-regex -S'
alias gd='git diff'
alias gs='git show'
@jsugarman
jsugarman / github-searches.md
Created June 21, 2022 15:49
github searches

Github searches

For use in search boxes n the github UI

PRs merged between dates

is:pr is:closed merged:2022-06-08..2022-06-09 base:main sort:updated-desc 
@jsugarman
jsugarman / debug-github-action.md
Created May 23, 2022 16:55
Debug github action

Debug github actions

see debugging with tmate

TLDR;

Add this after github action step you want to interactively debug

- uses: actions/checkout@v3
- name: Setup tmate session
@jsugarman
jsugarman / python-version-management-with-pyenv.md
Created September 20, 2021 11:07
python version maagement with pyenv

Python version management with pyenv

Information

  pyenv help
  pyenv version
  pyenv versions
  pyenv version-origin
@jsugarman
jsugarman / .pryrc
Last active December 7, 2020 14:17
Custom pry with command aliases and custom rails prompt
# place in ~/.pryrc
if defined?(Pry)
Pry.config.color = true
Pry.config.prompt_name = 'Pry:' + File.basename(Dir.pwd)
Pry.commands.alias_command 'wami', 'whereami'
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
@jsugarman
jsugarman / laa-fee-calculator-pyenv-setup.md
Last active July 18, 2020 13:16
laa-fee-calculator pyenv setup

Setup fee calculator with pyenv

Setup pyenv globally

Create a virtual env

In fee calculator app root dir create a virtual env for a specific version of python (I am using 3.8.3, latest at time of writing), and give it a name.

$ cd .../laa-fee-calcultor
read AWS_ACCESS_KEY_ID ARN URL AWS_SECRET_ACCESS_KEY <<<$(kubectl --context <context> -n <namespace> get secret <secret> -o json | jq -r '.data[] | @base64d'); printf "$AWS_ACCESS_KEY_ID\n$ARN\n$URL\n$AWS_SECRET_ACCESS_KEY"