Skip to content

Instantly share code, notes, and snippets.


Obeng William obengwilliam

Block or report user

Report or block obengwilliam

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
obengwilliam /
Last active Jul 3, 2019 — forked from omidraha/
Authentication and Authorization Concepts for MicroServices

auth with microservices

Authorization and Authentication are hard. when you only have to implement them once (as you do within a monolith) instead of over and over again, it makes the developer happy :-), and maybe leads to less implementation failures.

When you have a bunch of microservices, this is something that has to be considered.

Implement it once or in every microservice, or something in between?

obengwilliam /
Last active Apr 24, 2019 — forked from rantav/
Find slow queries in mongo DB #mongodb #performance

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

View Create admin user for rabbitmq admin dashboard
sudo rabbitmqctl add_user {user} {password}
sudo rabbitmqctl set_user_tags {user} administrator
sudo rabbitmqctl set_permissions -p / {user} ".*" ".*" ".*"
obengwilliam /
Created Feb 14, 2019 — forked from boneskull/
example of how to debug mocha v4 if hanging

Here's an example of how to debug Mocha v4 if it hangs.

Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).

If you run your test, you'll notice it hangs:

$ mocha test.js
View log format
pid: 93535,
hostname: 'your host',
level: 30,
msg: 'my request',
time: '2016-03-07T12:21:48.766Z',
v: 0,
req: {
id: 42,
method: 'GET',
View pino-wrapper.js
'use strict'
const {logOnRequest} = require('pino-wrapper')
const app = require('express')()
app.use(logOnRequest()) // should attach a log instance to req.log
obengwilliam / gist:971f8fa4c6955b5499ca7d5685aad9b6
Created Sep 27, 2018 — forked from DanilloCorvalan/gist:9805138
Node test upload file multi part superagent plus supertest
View gist:971f8fa4c6955b5499ca7d5685aad9b6
var request = require('supertest');
var fs = require('fs');
var reqData = {
title: 'Rahh!',
fileName: 'test-image.jpeg'
var req = request( // = your express object
View test.js
import { execFile } from 'child_process';
import { JSDOM } from 'jsdom';
const { Promise } = global;
const options = { resources: 'usable', runScripts: 'dangerously' };
const server = execFile('node', [ './dist/server/index.js' ], { cwd: process.cwd() });
const browser = { };
beforeAll(async () => {
obengwilliam /
Created Aug 17, 2018 — forked from subfuzion/
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

You can’t perform that action at this time.