Skip to content

Instantly share code, notes, and snippets.

View nalcorso's full-sized avatar

Nick Alcorso nalcorso

View GitHub Profile
@nalcorso
nalcorso / isValidABN.ts
Last active May 18, 2016 10:34
Check whether a given string is a valid ABN (Australian Business Number), written in Typescript.
// The following formula can be used to verify the ABN.
// To verify an ABN:
// 1. Subtract 1 from the first (left) digit to give a new eleven digit number
// 2. Multiply each of the digits in this new number by its weighting factor
// 3. Sum the resulting 11 products
// 4. Divide the total by 89, noting the remainder
// 5. If the remainder is zero the number is valid
isValidABN(value: string) :boolean {
var weights : number[] = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];
@nalcorso
nalcorso / push_public_key.sh
Created December 16, 2015 13:41
Push SSH Key to Remote Host
cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"