Skip to content

Instantly share code, notes, and snippets.

View cognivator's full-sized avatar

cognivator cognivator

View GitHub Profile
cognivator /
Last active March 28, 2024 19:32
Manage multiple SSH keys on MacOS


There are plenty of references for generating and using SSH keys on MacOS. Google for answers and they're everywhere. What is less obvious is how to use multiple SSH keys, especially for the same host, e.g. GitHub. I had multiple SSH keys and a ~/.ssh/config file, but certain of the credentials weren't being found.


The nuggets of goodness I found describe how to properly use ~/.ssh/config - (here, here, here, here... +many more). The key is actually using the resulting Host aliases!

Go figure, huh? 🤦

Example: Github - SourceTree

cognivator /
Last active June 15, 2020 22:49
Insomnia template for Salesforce REST API with Oauth password flow


Import the accompanying insomnia_salesforceAPI.json into Insomnia to create a workspace with sample requests that,

  • get a bearer token using Salesforce built-in Oauth password workflow
  • make REST API requests referencing the bearer token

Setup / Customize


The environment variables are stored in MyOrg folder.

cognivator /
Last active September 19, 2019 23:43
Configure Sourcetree to use Intellij (Jetbrains) as external Diff or Merge tool


If the prescribed method of configuring Sourcetree using Jetbrains' command line scripts fails, here is an alternative configuration:


  • Diff Command: open -W -n -b "com.jetbrains.intellij" --args
  • Diff Arguments: diff "$LOCAL" "$PWD/$REMOTE"


  • Merge Command: open -W -n -b "com.jetbrains.intellij" --args
  • Merge Arguments: merge "$PWD/$LOCAL" "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$MERGED"
cognivator / git_fetch_by_hash
Created September 4, 2018 22:47
SourceTree Custom Action to FETCH the selected branch
set -e
set -o pipefail
unset fetch_git_branch
fetch_git_branch=`git name-rev --refs=heads/* --name-only $1 | grep -oE '^[^~]+'`
echo fetching... $fetch_git_branch
cognivator /
Last active June 28, 2018 16:49
Hipchat - sort and display Rooms & People


  1. In _getPeopleList, replace,


// Assumes jwt-client has been loaded to define JWT global
(function expireJWT() {
JWT.defaults = {key: 'jwt', tokenPrefix: '', storage: window.localStorage, padding: false};
decodedJWT =;
decodedJWT.claim.exp = ( / 1000) - 1;
cognivator / ui-router controller
Last active August 25, 2016 19:33
ui-router: testing for controller instantiation


You're using ui-router to manage Angular 1.x routing states. You have a parent state that should always navigate to a child state, but without relying on ui-router-extras like $deepStateRedirect. This is to avoid deep linking into the child state. Some logins need to operate this way, for instance, so the Terms of Service acknowledgement cannot be skipped.


This is an example ui-router state hierarchy that defines a series of states used for login pages.

  .state('login', {
 url: '/login',
cognivator /
Last active July 26, 2016 17:34
showStates - console function to extract the configured states of ui-router and print them to the console as a JSON tree.


At the Javascript console, run showAllStates() to see a JSON tree of the currently configured ui-router states as returned by $state.get().


Copy showStates code below into your Javascript console (tested with Chrome Devtools), and execute it to create the showStates function. Optionally, create similar functions in the console with the other scripts in this gist.

showAllStates = function () {
	var $injector = angular.element('html').injector(),
cognivator /
Last active April 17, 2016 03:36
.gitignore cache cleaning
# Run this from the root of a git repo - AFTER YOU COMMIT THE CHANGES YOU CARE ABOUT!
# Then, if you need to keep the deleted files in your working copy (e.g. IDE config files),
# be sure to unstage them before your next commit.
# attribution:
for file in `cat .gitignore` ; do git rm -r --cached $file; done