Skip to content

Instantly share code, notes, and snippets.

View camsjams's full-sized avatar
🦀
Save Ferris!

Cameron Manavian camsjams

🦀
Save Ferris!
View GitHub Profile
@camsjams
camsjams / keybase.md
Created December 18, 2019 18:45
keybase.md

Keybase proof

I hereby claim:

  • I am camsjams on github.
  • I am camsjams (https://keybase.io/camsjams) on keybase.
  • I have a public key whose fingerprint is 3685 0AB3 F8D9 E29C FEDF 83C2 E312 4546 D37A 5C39

To claim this, I am signing this object:

@camsjams
camsjams / guide.md
Last active May 1, 2022 16:21
How to upgrade a Node JS Express project using Swagger-Express

How to upgrade a Node JS Express project using Swagger

Migrate [swagger-express-mw] / and underlying [swagger-node-runner] to [express-openapi]

Intro

Why do this?

There have been a number of high and critical vulnerabilities caused by the npm package.

I myself have been hunting through ways to figure out how to solve these problems, as the package maintainers seem to have abandonded this library (there was even an NPM fork which still seems to have issues with bagpipes - see [swagger-node-runner year old PR]). I have created a basic guide to help others out, so that I am not just another DenverCoder9 (https://xkcd.com/979/)

[npm audit] and [snyk] scans find issues like:

@camsjams
camsjams / circleci-slack-merge-message.sh
Last active April 24, 2018 20:31
CircleCI merge develop message to slack [MIT]
#! /bin/bash
# Description: Call this from your CircleCi config after your deploys have been completed
#
# Set the following variables:
# ENVIRONMENT - the name of the environment the deploy went to, ex: "dev", "staging", "production"
# CHANNEL - the slack channel you want to post to
# WEBHOOK - the slack webhook url you created
# PROJECT_NAME - this defaults to looking in a package.json for the "name", customize to your liking and language
ENVIRONMENT="test"
@camsjams
camsjams / circleci-slack-deploy-message.sh
Last active April 20, 2018 17:13
CircleCI deploy message to slack [MIT]
#! /bin/bash
# Description: Call this from your CircleCi config after your deploys have been completed
#
# Set the following variables:
# ENVIRONMENT - the name of the environment the deploy went to, ex: "dev", "staging", "production"
# CHANNEL - the slack channel you want to post to
# WEBHOOK - the slack webhook url you created
# PACKAGE_VERSION - this defaults to looking in a package.json for the "version", customize to your liking and language
# PROJECT_NAME - this defaults to looking in a package.json for the "name", customize to your liking and language
@camsjams
camsjams / jscpdReporter.js
Last active February 18, 2016 17:46
sample reporter that exits process with non-zero exit code, useful for continuous integration tests
const DUPLICATION_LIMIT = 100;
const FILE_SPAN_LIMIT = 2;
module.exports = function() {
/**
* @see node_modules/jscpd/src/report.coffee
*/
if (this.map.numberOfDuplication > DUPLICATION_LIMIT || this.map.numberOfFiles > FILE_SPAN_LIMIT) {
console.error('Copy Paste detection found too many files over threshold.\n');
console.error(this.stdReporter());
var startTime;
function start() {
startTime = new Date().getTime();
}
function stop() {
var endTime = new Date().getTime(),
diff = (endTime - startTime);
console.log('\nTime taken: ' + format(diff) + '\n');