Skip to content

Instantly share code, notes, and snippets.

@localpcguy
localpcguy / 1-setup.md
Created August 28, 2025 21:23 — forked from troyfontaine/1-setup.md
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@localpcguy
localpcguy / simple-hash.js
Created April 1, 2024 19:36 — forked from jlevy/simple-hash.js
Fast and simple insecure string hash for JavaScript
// These hashes are for algorithmic use cases, such as bucketing in hashtables, where security isn't
// needed and 32 or 64 bits is enough (that is, rare collisions are acceptable). These are way simpler
// than sha1 (and all its deps) or similar, and with a short, clean (base 36 alphanumeric) result.
// A simple, *insecure* 32-bit hash that's short, fast, and has no dependencies.
// Output is always 7 characters.
// Loosely based on the Java version; see
// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
const simpleHash = str => {
let hash = 0;
@localpcguy
localpcguy / .profile
Created September 27, 2019 17:55 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@localpcguy
localpcguy / CamelCaseMacro.velocity
Created October 26, 2018 20:15 — forked from Pencroff/CamelCaseMacro.velocity
Transformation file name to CamelCase in IntelliJ IDEA file templates
## file name transformation
## file-name => FileName
## Sources:
## http://stackoverflow.com/questions/6998412/velocity-string-function
## http://stackoverflow.com/questions/21288687/using-velocity-split-to-split-a-string-into-an-array-doesnt-seem-to-work
## http://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/util/StringUtils.html#split(java.lang.String, java.lang.String)
#set( $CamelCaseName = "" )
#set( $part = "" )
@localpcguy
localpcguy / .gitconfig
Last active April 2, 2018 01:36
Bunch of aliases for git commands, some my own, others pulled from various blog posts, stack overflow comments and other places online
[alias]
co = checkout
ci = commit
st = status
br = branch
fl = log -u
filelog = log -u
del = branch -d
delr = push origin -d
df = diff
@localpcguy
localpcguy / .block
Last active January 8, 2018 22:42
Add elements using .enter and .append (starting with empty selection).
license: gpl-3.0
height: 130
border: no
//<p class="name">hi {{name}}</p>
Handlebars.templates["hi"]=function(data) {
return "<p class=\"name\">hi "
+ escapeExpression(data['name'])
+ "</p>\n";
});
{
"5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9": 10,
"6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b": 3,
"d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35": 3,
"4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce": 11,
"4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a": 2,
"ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d": 2,
"e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683": 3,
"19581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7": 2,
"4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5": 5,
@localpcguy
localpcguy / .block
Last active June 14, 2017 20:57
SVG bar chart
license: mit
@localpcguy
localpcguy / getClass.js
Created May 31, 2017 18:12
Get the class type of a JavaScript element
function getClass(obj) {
if (typeof obj === 'undefined') {
return 'undefined';
}
if (obj === null) {
return 'null';
}
return Object.prototype.toString.call(obj).match(/^\[object\s(.*)\]$/)[1];
}