Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Herbert DanHerbert

View GitHub Profile
@DanHerbert
DanHerbert / Positive-Adjective-List.txt
Created September 10, 2022 17:35 — forked from Xeoncross/Positive-Adjective-List.txt
Positive Adjective List
View Positive-Adjective-List.txt
Positive Adjective List
abundant
accessible
accommodative
accomplished
accurate
achievable
adaptable
adaptive
View keybase.md

Keybase proof

I hereby claim:

  • I am danherbert on github.
  • I am danherbert (https://keybase.io/danherbert) on keybase.
  • I have a public key whose fingerprint is B692 4325 34E2 D4D6 9AF8 8FC7 A9FD 6A58 FE51 843E

To claim this, I am signing this object:

@DanHerbert
DanHerbert / sshport
Last active August 29, 2015 14:01
Node script to get the port for an SSH host based on the settings in your ~/.ssh/config
View sshport
#!/usr/bin/env node
// Given a "Host", this script parses the SSH config file to get the port of that host
// Useful for shell scripts that test that a host's SSH port is open
var fs = require("fs");
var path = require("path");
var sshConfPath = path.join(getHome(), ".ssh", "config");
var hostnameToFind = new RegExp("\\b" + process.argv[2] + "\\b");
var portParser = /Port\s+(.+)$/m;
var hosts = fs.readFileSync(sshConfPath).toString().split("Host ");
@DanHerbert
DanHerbert / sshhost
Created April 21, 2014 21:14
Node script to get the real Hostname of an SSH config alias
View sshhost
#!/usr/bin/env node
// Given a "Host", this script parses the SSH config file to get the real Hostname of that host
// Useful for scripts that need to do a combo of SSH and other Bash commands and don't want to flip
// between using an SSH host alias and the real IP
var fs = require("fs");
var path = require("path");
var sshConfPath = path.join(getHome(), ".ssh", "config");
var hostnameToFind = new RegExp("\\b" + process.argv[2] + "\\b");
var hostNameParser = /Hostname\s+(.+)$/m;
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active May 12, 2023 07:45
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@DanHerbert
DanHerbert / Moved.md
Last active January 20, 2016 23:25
Aliases I use for Git
View Moved.md
@DanHerbert
DanHerbert / super-gen-pass-bookmarklet.js
Created November 10, 2012 18:36
SuperGenPass Bookmarlet, with all references to external images Base64 encoded so that no HTTP requests need to be made to load the bookmarklet.
View super-gen-pass-bookmarklet.js
javascript:(function(){function b64_md5(p){p=utf8_en(p);return binl2b64(core_md5(str2binl(p),p.length*8));}function hex_md5(p){p=utf8_en(p);return binl2hex(core_md5(str2binl(p),p.length*8));}function binl2b64(binarray){var tab='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678998';var str='';for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(i%254))%260xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%254))%260xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%254))%260xFF);for(var j=0;j<4;j++){str+=tab.charAt((triplet>>6*(3-j))%260x3F);}}return str;}function binl2hex(binarray){var hex_tab='0123456789abcdef';var str='';for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((i%254)*8+4))%260xF)+hex_tab.charAt((binarray[i>>2]>>((i%254)*8))%260xF);}return str;}function core_md5(x,len){x[len>>5]|=0x80<<((len)%2532);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d