Skip to content

Instantly share code, notes, and snippets.

View nrempel's full-sized avatar
🦀

Nick Rempel nrempel

🦀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am nrempel on github.
  • I am nbrempel (https://keybase.io/nbrempel) on keybase.
  • I have a public key ASAftFlDSiw5r-dyaLSzRVeB4-gNEgjo5w2Rqd2P5KbHPgo

To claim this, I am signing this object:

version: '3'
services:
###############################
# Built from local Dockerfile #
###############################
web:
# Build the Dockerfile in this directory.
build: .
# Mount this directory as a volume at /app
volumes:
const SimpleCron = require('simple-cron');
const cron = new SimpleCron();
const amqp = require('amqplib/callback_api');
cron.schedule('* * * * *', () => {
amqp.connect(process.env.RABBIT_URL, (err, conn) => {
conn.createChannel((err, ch) => {
const q = 'clock';
ch.assertQueue(q, { durable: false });
ch.sendToQueue(q, Buffer.from('hi.'));
const amqp = require('amqplib/callback_api');
amqp.connect(process.env.RABBIT_URL, (err, conn) => {
conn.createChannel((err, ch) => {
// Consume messages from web queue
var q1 = 'web';
ch.assertQueue(q1, { durable: false });
ch.consume(q1, (msg) => {
console.info('Message received from web process:', msg.content.toString());
}, {noAck: true});
const express = require('express');
const pg = require('pg');
const redis = require('redis');
const amqp = require('amqplib/callback_api');
const app = express();
app.get('/', (req, res) => {
res.send('Hello World!')
});
#!/bin/bash
set -e
SCRIPT_HOME="$( cd "$( dirname "$0" )" && pwd )"
cd $SCRIPT_HOME
case "$1" in
start)
docker-compose up web worker clock
# Inherit from node base image
FROM node
# This is an alternative to mounting our source code as a volume.
# ADD . /app
# Install Yarn repository
RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
@nrempel
nrempel / postgres_queries_and_commands.sql
Created August 31, 2016 04:10 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
'use strict';
/*
|--------------------------------------------------------------------------
| Application Providers
|--------------------------------------------------------------------------
|
| Here we configure the providers required to run adonis application. They
| are registered only once and can be used inside any file using `use`
| keyword.
'use strict';
/*
|--------------------------------------------------------------------------
| HTTP Server Setup
|--------------------------------------------------------------------------
|
| Here we join different pieces and start the HTTP server. It will be
| a matter of seconds to start your shiny Adonis application.
|