(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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); | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Update Homebrew’s package database.
brew update
To install the MongoDB binaries, issue the following command in a system shell:
brew install rabbitmq
Using our beloved docker and docker-compose, we can very quickly bring up an Apache Airflow instance on our mac.
About the only thing you need to customize in this docker-compose.yml file is the volumes section. This will tell docker to map the given directory containing your Airflow DAGs/plugins to container file system.
version: '3'
services:
check host localhost with address 127.0.0.1 | |
start "/sbin/start myapp" | |
stop "/sbin/stop myapp" | |
if failed port 3000 protocol HTTP | |
request / | |
with timeout 5 seconds | |
then restart |
const http = require('http'); | |
const express = require('express'); | |
const redis = require('redis'); | |
const { RateLimiterRedis } = require('rate-limiter-flexible'); | |
const redisClient = redis.createClient({ | |
enable_offline_queue: false, | |
}); | |
const maxWrongAttemptsByIPperMinute = 5; | |
const maxWrongAttemptsByIPperDay = 100; |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)# install needed libraries | |
sudo yum install texinfo libXpm-devel giflib-devel libtiff-devel libotf-devel | |
# compile autoconf | |
cd /tmp | |
wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2 | |
tar xjvf autoconf-2.68.tar.bz2 | |
cd autoconf-2.68/ | |
./configure && make && sudo make install |
/** | |
* Module dependencies | |
*/ | |
var express = require('express'); | |
var fs = require('fs'); | |
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
// img path |