Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / getUSPSKeylineCheckDigit.spec.ts
Created June 14, 2021 18:40
USPS Traditional ACS keyline MOD 10 check digit
const keylinesChecks: [string, number][] = [
['JLSTMS6796', 9],
['TMS1112/62', 3],
['218XN91LMS', 4],
['OTUBIKALAM', 8],
['ABC999NN//3', 2],
['ANIT 028', 1],
['0012 ////', 8],
['811N IS00 0111', 9],
['OTUB IKAL AM', 8],
@skinofstars
skinofstars / crypt.js
Last active October 6, 2020 22:06
Public-key Cryptography in NodeJS
// FROM https://vanjs-decentralized.hashbase.io/#12
const crypto = require('crypto');
const read = require('fs').readFileSync;
// The original message
const message = Buffer.from('Hi Alice! This is a secret :)');
// ENCRYPT message with Alice PUBLIC key
const alicePublicKey = read('./keys/alice/public_key.pem');
@skinofstars
skinofstars / .gitignore
Created August 19, 2020 08:37
XCode Swift gitignore
# Node builds
.cache/
coverage/
node_modules/
*.log
# Exclude build output
macos.safari-extension/yeehah_extension/script.js
@skinofstars
skinofstars / wp_believe.md
Last active August 11, 2020 10:12
wp_believe

I believe the president Made America Great Again. I believe we need him reelected to Make America Great Again Again.

I believe Joe Biden is “Sleepy” and “weak.” I believe Biden could “hurt God” and the Bible.

I believe that if Biden is elected, there will be “no religion, no anything,” and he would confiscate all guns, “immediately and without notice.” He would “abolish” “our great,” “beautiful suburbs,” not to mention “the American way of life.” There would be “no windows, no nothing” in buildings.

I believe the news media would have “no ratings” and “will go down along with our great USA!” if the president loses — and that this would be bad even though the media is fake.

I believe it’s normal for the president to say “Yo Semites” and “Yo Seminites,” “Thigh Land,” “Minne-a-napolis,” “toe-tally-taria-tism,” “Thomas Jeffers” and “Ulyss-eus S. Grant.” I believe it’s Biden who’s cognitively impaired.

@skinofstars
skinofstars / services.js
Created June 13, 2019 10:03
FeathersJS - Demo of services picking up each others hooks
module.exports = function(app) {
class BeepBoop {
async update(id, data, params) {
console.log("BeepBoop", id, params);
// passing params here will also pass the route.id
await app.service("zap").update("456", {}, params);
return Promise.resolve();
}
@skinofstars
skinofstars / model-includes.hook.js
Last active August 10, 2017 02:57
Feathers hook for including seqeulize models
'use strict';
// Feathers hook to do `/thing?includes=other`
// before : {
// find: [modelIncludes()],
// get: [modelIncludes()]
// },
// after : {
// find: [modelIncludes()],
@skinofstars
skinofstars / migrate.js
Created May 2, 2017 14:00
Simple sequelize migration retry script
#!/usr/bin/env node
'use strict';
const program = require('commander');
const exec = require('child_process').exec;
program
@skinofstars
skinofstars / headersMiddleware.js
Last active May 2, 2017 13:37
Feathers schema switching in sequelize
// setup a middleware that provides access to the express headers
module.exports = (req, res, next) => {
req.feathers.headers = req.headers;
next();
};
@skinofstars
skinofstars / deploy-ecr.sh
Created November 8, 2016 14:14
Some of the scripts needed to use Docker on AWS ECR and lastoc Beanstalk
#!/bin/bash
# usage: ./deploy-ecr.sh staging f0478bd7c2f584b41a49405c91a439ce9d944657
BRANCH=$1
SHA1=$2
AWS_ACCOUNT_ID=975486958832
NAME=moovyn
EB_BUCKET=moovyn-elasticbeanstalk
@skinofstars
skinofstars / bulk-whois.sh
Created August 2, 2016 11:43
quick ISP lookup
#!/bin/bash
# USE
# - Save as bulk.sh, then run the commands
# - chmod +x bulk.sh
# - ./bulk.sh ip_addresses.txt
# It reads the ip_address.txt line by line,
# does a whois request on each line, and looks
# for the term 'netname' in each whois.