Skip to content

Instantly share code, notes, and snippets.

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

Carmine DiMascio cdimascio

👋
🤔👨‍💻🚀
View GitHub Profile
@cdimascio
cdimascio / Play_WS_Standalone_HowTo.md
Last active December 6, 2017 17:39
Example: Using Play Framework's WS library standalone

This gist provides a simple example of how to use Play's WS library in a standalone application (external to Play).

build.sbt - SBT build file that includes the WS library WSStandaloneTest.scala - A simple example that utilizes WS to invoke an HTTP GET request

@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",
* }
/**
* Express Afterware
*
* Calls `handler` after just before sending back to the client.
* Parameters are `handler( req, res, next, ... ) where the rest
* params are whatever was sent to `res.end`.
*
* WARNING:
* By the time you get to this point, res.end has been intiated, but
* not actually called. So DO NOT call res.send or end again. The
# Execute onto container
aws ecs execute-command \
--region us-west-2 \
--cluster PeprServiceStackDev-EcsDefaultClusterMnL3mNNYNVpc18E0451A-dn35gqXUjrhi \
--task e575d819e2e04dac99387d22a5219576 \
--command /bin/bash --interactive
# Run task with execute enable
aws ecs run-task \
--cluster PeprServiceStackDev-EcsDefaultClusterMnL3mNNYNVpc18E0451A-dn35gqXUjrhi \
@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
@alecholmez
alecholmez / delta_xds.md
Last active October 12, 2021 17:21
Incremental xDS Implementation Plan
@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) {

An Example of Play

To further clarify what really goes on during an AD&D game, read the following example. This is typical of the sort of action that occurs during a playing session. Shortly before this example begins, three player characters fought a skirmish with a wererat (a creature similar to a werewolf but which becomes an enormous rat instead of a wolf). The wererat was wounded and fled down a tunnel. The characters are in pursuit. The group includes two fighters and a cleric.

Fighter 1 is the group's leader.

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))
}