Skip to content

Instantly share code, notes, and snippets.

View tniswong's full-sized avatar

Todd Niswonger tniswong

View GitHub Profile
@tniswong
tniswong / Makefile
Created March 30, 2022 02:21
Makefile for golang
.DEFAULT_GOAL := build
NOW := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
# Current git revision
GIT_REV := $(shell git rev-parse --short HEAD)$(shell git diff --quiet || echo '-dirty')
# List of binaries this repostiory generates
BINARIES := $(shell ls -l cmd/ | grep ^d | awk '{print $$9}')

Keybase proof

I hereby claim:

  • I am tniswong on github.
  • I am tniswong (https://keybase.io/tniswong) on keybase.
  • I have a public key whose fingerprint is 1D8D 078D CF7A 783A 7A45 E8F2 3880 B72E F221 66C6

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 17s5GSrmmECN11KWq7vLkpqV8VBEKdKwTL https://explorer.blockstack.org/address/17s5GSrmmECN11KWq7vLkpqV8VBEKdKwTL
# Using ECC with 384 bits
# Generate a self-signed certificate
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-384 -pkeyopt ec_param_enc:named_curve -out temp-ca.key
openssl req -new -sha256 -key temp-ca.key -out temp-ca.csr -subj "/C=Country/ST=State/L=City/O=Company/OU=Department/CN=temp-ca"
openssl req -x509 -sha256 -days 1 -key temp-ca.key -in temp-ca.csr -out temp-ca.crt
# Issue a client certificate from the above self-signed certificate
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-384 -pkeyopt ec_param_enc:named_curve -out server.key
openssl req -new -sha256 -key server.key -out server.csr -subj "/C=Country/ST=State/L=City/O=Company/OU=Department/CN=consul"
@tniswong
tniswong / RegExcape.es6.js
Created October 1, 2015 20:40
Escape a String to use as a RegExp.
export default (regexStr) => regexStr.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
@tniswong
tniswong / parse-angular-patch.js
Last active August 29, 2015 14:10
Parse Compatibility patch for Angular (Parse 1.3.1)
/*!
* The MIT License (MIT)
*
* Copyright (c) 2014 Todd Niswonger
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@tniswong
tniswong / semverRegex-2.0.0.js
Last active May 22, 2018 21:11
Semver Regex 2.0.0
/**
* see: http://semver.org/
*
* semverRegex:
* match[0] = semver
* match[1] = version
* match[2] = preRelease
* match[3] = metadata
*
* versionRegex:
@tniswong
tniswong / gist:5910264
Last active December 19, 2015 06:19
Handlebars ifTest helper. Allows for javascript condition evaluations. http://jsfiddle.net/YsteK/
Handlebars.registerHelper('ifTest', function(expression, options) {
var evalStr = '',
context = [options.data, options.hash];
if(Object.prototype.toString.call(this) == '[object Object]') {
context.push(this);
} else {
context.push({ that: this });
}