Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / getUSPSKeylineCheckDigit.spec.ts
Created Jun 14, 2021
USPS Traditional ACS keyline MOD 10 check digit
View getUSPSKeylineCheckDigit.spec.ts
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 Oct 6, 2020
Public-key Cryptography in NodeJS
View crypt.js
// 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 Aug 19, 2020
XCode Swift gitignore
View .gitignore
# Node builds
.cache/
coverage/
node_modules/
*.log
# Exclude build output
macos.safari-extension/yeehah_extension/script.js
View wp_believe.md

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 Jun 13, 2019
FeathersJS - Demo of services picking up each others hooks
View services.js
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 Aug 10, 2017
Feathers hook for including seqeulize models
View model-includes.hook.js
'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
Simple sequelize migration retry script
View migrate.js
#!/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
Feathers schema switching in sequelize
View headersMiddleware.js
// 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 Nov 8, 2016
Some of the scripts needed to use Docker on AWS ECR and lastoc Beanstalk
View deploy-ecr.sh
#!/bin/bash
# usage: ./deploy-ecr.sh staging f0478bd7c2f584b41a49405c91a439ce9d944657
BRANCH=$1
SHA1=$2
AWS_ACCOUNT_ID=975486958832
NAME=moovyn
EB_BUCKET=moovyn-elasticbeanstalk
View bulk-whois.sh
#!/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.