Skip to content

Instantly share code, notes, and snippets.

@eunomie
eunomie / README.md
Created April 27, 2017 09:44
How to send containers log to ELK using gelf log driver

Send docker logs to ELK through gelf log driver

There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.

But docker has a gelf log driver and logstash a gelf input. So here we are.

Here is a docker-compose to test a full elk with a container sending logs via gelf.

@mentlsve
mentlsve / scrooge-coin-main.java
Last active May 27, 2021 05:40
Coursera - Programming Assignment: Scrooge Coin - Simple Main Class
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.math.BigInteger;
import java.security.*;
public class Main {
public static void main(String[] args) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException {
// Crypto setup
@dimasch
dimasch / redis-clear
Last active June 13, 2024 02:12
Clear a redis cache in Docker
docker exec -it container-name redis-cli FLUSHALL
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@staltz
staltz / introrx.md
Last active July 4, 2024 10:11
The introduction to Reactive Programming you've been missing
@domenic
domenic / promises.md
Last active June 24, 2024 03:11
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.