Skip to content

Instantly share code, notes, and snippets.

View cdimascio's full-sized avatar
👋
🤔👨‍💻🚀

Carmine DiMascio cdimascio

👋
🤔👨‍💻🚀
View GitHub Profile
@carlhoerberg
carlhoerberg / reconnect.js
Created May 13, 2015 14:45
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
@vasanthk
vasanthk / System Design.md
Last active May 16, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@kshcherban
kshcherban / ecs-rollback.py
Created April 12, 2017 08:44
ECS task definition rollback script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import json
import argparse
from datetime import datetime
from subprocess import Popen, PIPE
@jpbarto
jpbarto / secure_iam_get.js
Created May 18, 2017 23:17
NodeJS SigV4 Invocation of AWS IAM authorized API Gateway endpoint
/** The following is a NodeJS port of the AWS SigV4 signing sample code (Python) to NodeJS
* The addition of the Authorization header has been informed by the use of Postman
* For more information see the following documentation:
* http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
*/
var https = require('https');
var crypto = require('crypto');
function sign(key, message) {
@jganzabal
jganzabal / Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras.md
Last active November 2, 2022 11:43
How to setup Nvidia Titan XP for deep learning on a MacBook Pro with Akitio Node + Tensorflow + Keras

In this tutorial we're going to build a set of parser combinators.

What is a parser combinator?

We'll answer the above question in 2 steps.

  1. What is a parser?
  2. and, what is a parser combinator?

So first question: What is parser?

@cdimascio
cdimascio / create_user.sh
Last active April 20, 2018 13:54
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" } ] })
@vemarav
vemarav / console.js
Last active October 22, 2020 03:21
Build rails like console in nodejs
/**
* add console.js at ther root of your app
* Modify to make it more helpful for your project
* > Note: `esm` adds ES6 support in Node
* In package.json
* ...
* "scripts": {
* "start": "nodemon -r esm ./server.js"
* "console": "node -r esm --experimental-repl-await console",
* }
@alecholmez
alecholmez / delta_xds.md
Last active October 12, 2021 17:21
Incremental xDS Implementation Plan
import { DataSource } from 'apollo-datasource'
import { InMemoryLRUCache } from 'apollo-server-caching'
import DataLoader from 'dataloader'
class FooDataSource extends DataSource {
constructor(dbClient) {
super()
this.db = dbClient
this.loader = new DataLoader(ids => dbClient.getByIds(ids))
}