Skip to content

Instantly share code, notes, and snippets.


Carmine DiMascio cdimascio

Block or report user

Report or block cdimascio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:bded6a90aa61ba3fa8bbd648fc4f3262
ngrok http -bind-tls=true localhost:3000
View kong
1. Kong default config
2. Then modify
pg_host = # The PostgreSQL host to connect to.
pg_port = 60335 # The port to connect to.
pg_user = kong # The username to authenticate if required.
pg_password = # The password to authenticate if required.
pg_database = kong # The database name to connect to.
cdimascio / Count connections to MongoDB by IP address
Last active Jul 19, 2018
Count and sort connections to MongoDB aggregated by IP address
View Count connections to MongoDB by IP address
# Replace mongodb.log with your mongodb log
cat mongodb.log | grep "syslog" | cut -d " " -f 6 | sort | uniq -c | sort -rn
cdimascio / gist:f55b4d45a0772f96a6eb455c8ba294b7
Created Jun 20, 2018
Kubernetes: Create Secret with a Self Signed TLS cert
View gist:f55b4d45a0772f96a6eb455c8ba294b7
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/tls.key -out /tmp/tls.crt -subj "/"
kubectl create secret tls example --key /tmp/tls.key --cert /tmp/tls.crt # example is the ingress secret key
cdimascio / mongodump
Last active Jun 6, 2018
Compose MongoDB mongodump/mongorestore
View mongodump
mongodump --host your-hostname --port your-port --ssl --sslAllowInvalidCertificates --db=your-db-name --archive=./ep-ao-dump -u admin -p your-password --authenticationDatabase admin
cdimascio /
Last active Apr 20, 2018
Create MongoDB user via Mongo shell
# start the mongo shell, then set to the appropriate db and create a user
# in this case, create a user with dbadmin, and read write access roles
use my_db
db.createUser( { user: "my_user", pwd: "MyP@ssw0rd", roles: [ { role: "readWrite", db: "my_db"}, { role: "dbAdmin", db: "my_db" } ] })
cdimascio / crypto-ctr.js
Last active Mar 2, 2018 — forked from chris-rock/crypto-ctr.js
Encrypt and decrypt text in nodejs
View crypto-ctr.js
// Part of
// Nodejs encryption with CTR
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq',
key = Buffer.from('5ebe2294ecd0e0f08eab7690d2a6ee69', 'hex'),
iv = Buffer.from('26ae5cc854e36b6bdfca366848dea6bb', 'hex');
function encrypt(text){
cdimascio / Configure awscli
Last active Jan 2, 2018
IBM Cloud Object Storage COS with AWS CLI
View Configure awscli
cat ~/.aws/config
region = us-standard
output = json
cdimascio /
Last active Jan 1, 2018
Dotenv Java
# formatted as key=value
cdimascio / Node 8 Mocha with Babel VSCode
Last active Jul 27, 2018
Connect VSCode debugger to Node.js, Typescript using webpack, mocha, ...
View Node 8 Mocha with Babel VSCode
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"protocol": "inspector",
"args": [
You can’t perform that action at this time.