Skip to content

Instantly share code, notes, and snippets.

View cognivator's full-sized avatar

cognivator cognivator

View GitHub Profile
@cognivator
cognivator / claude-mcp-npx-wrapper.md
Last active April 3, 2025 06:39
Configure Claude MCP for use with NVM

Claude MCP - with NVM

As documented by Jonathan Gastón Löwenstern (hereafter, JGL), loading Claude Desktop MCP servers while using Node Version Manager (NVM) can be fraught, and there is little assistance in the community. Thankfully, Jonathon describes and solves the problems.

My modification is the ability to configure and use an NVM alias for use with Claude MCPs, without hardcoding the node version.

Caveats: This is tested and known to work on MacOS Monterey with ZSH. I have not tried other flavors of MacOS, Linux, or shells.

The Strategy

@cognivator
cognivator / macos_multiple_SSH_keys.md
Last active March 28, 2024 19:32
Manage multiple SSH keys on MacOS

Situation

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.

Solution

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
cognivator / .Insomnia_SalesforceAPI.md
Last active June 15, 2020 22:49
Insomnia template for Salesforce REST API with Oauth password flow

Install

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

Environment

The environment variables are stored in MyOrg folder.

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

Summary

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

Diff

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

Merge

  • Merge Command: open -W -n -b "com.jetbrains.intellij" --args
  • Merge Arguments: merge "$PWD/$LOCAL" "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$MERGED"
@cognivator
cognivator / git_fetch_by_hash
Created September 4, 2018 22:47
SourceTree Custom Action to FETCH the selected branch
#!/bin/bash
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
cognivator / Hipchat_sort-and-display-people.md
Last active June 28, 2018 16:49
Hipchat - sort and display Rooms & People

Edit HipChat.app/Contents/Resources/chat.html

  1. In _getPeopleList, replace,
...
name: room.name
...

with,

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

Scenario

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.

Configuration

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

$stateProvider
  .state('login', {
 url: '/login',
@cognivator
cognivator / showAllStates.md
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.

Usage

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

Installation

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(),