Skip to content

Instantly share code, notes, and snippets.

View peabnuts123's full-sized avatar

Jeff peabnuts123

View GitHub Profile
@peabnuts123
peabnuts123 / git-rewrite-author-history.sh
Last active December 7, 2020 22:24
bash script to replace an author throughout a git history
#!/bin/bash
# Source (now dead): https://help.github.com/articles/changing-author-info/
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@peabnuts123
peabnuts123 / README.md
Last active October 10, 2022 00:11
Suggestion for Sumo Logic Slack notification payloads

Sumo Logic Slack notification payloads

The default notification payloads for Slack are very out of date and recovery payloads cannot be edited at all. This means notifications sent to Slack have an unavoidably poor experience.

Problems with current default template

The current template has several issues which should be changed:

  1. Slack has labled the "attachments" API as legacy functionality and explicitly recommends using the Block Kit API instead. [source]
  2. Sharing a message posted using the default template simply embeds the message into a new message, rather than posting a link to the message
  • I can only assume this is because the contents of the message are "attachments"
@peabnuts123
peabnuts123 / ._README.md
Created October 16, 2022 23:17
Don't load nvm until its used, and automatically call `nvm use` when changing directories.

Lazy-load nvm and automatically call nvm use

There's some nice tooling around for managing nvm, such as zsh-nvm. However, I have found this tooling somewhat insufficient, or having poor performance.

For my needs, all I want is to increase the performance of my shell startup, and to run nvm use automatically whenever I navigate around the filesystem.

To these ends, I have written a very simple solution that one can include in their dotfiles. nvm is initially loaded as a shim that will load nvm when it is run, vastly decreasing my shell's initialisation time (from ~5 seconds to 0.2 seconds). For users of zsh, a chpwd hook is added which will check for a .nvmrc file in the new current directory, and run nvm use if one is found. If the specified version of node.js is not installed, nvm simply prints a message telling you to run nvm install instead - it will not do this for you. A check is also included to run on initialisation, if the shell is opened