Skip to content

Instantly share code, notes, and snippets.

@lucj
lucj / raft-logs-add-manager.sh
Created May 19, 2017 08:17
raft-logs-add-manager.sh
Entry Index=11, Term=2, Type=EntryNormal:
id: 101251685852937
action: <
action: STORE_ACTION_CREATE
node: <
id: "nvajg1fm52nd2hx80xlwqzo1f"
meta: <
version: <
index: 10
>
@lucj
lucj / raft-logs-create-service.sh
Created May 19, 2017 08:21
raft-logs-create-service.sh
Entry Index=17, Term=2, Type=EntryNormal:
id: 101251685852943
action: <
action: STORE_ACTION_CREATE
service: <
id: "5v6q08sfnnny4g6wb5ydrslna"
meta: <
version: <
index: 16
>
@lucj
lucj / raft-logs-create-secret.sh
Created May 19, 2017 08:27
raft-logs-create-secret.sh
Entry Index=25, Term=2, Type=EntryNormal:
id: 101251685852951
action: <
action: STORE_ACTION_CREATE
secret: <
id: "3kgqwqakmf256vf8s9t1gxtlj"
meta: <
version: <
index: 24
>
version: '3.0'
services:
cass0:
image: poklet/cassandra
ports:
- "9042:9042"
- "9160:9160"
cass1:
image: poklet/cassandra
environment:
@lucj
lucj / gist:6e20db4614d8ba4266347c4d1357f5e7
Created August 31, 2017 13:25
Running test app on Docker4AWS
// Creation of the network
$ docker network create --driver overlay net1
// Définition of 2 services in services.yml
version: '3.3'
services:
consul:
image: consul:0.9.2
command: agent -server -client=0.0.0.0 -bootstrap -ui -bind '{{ GetInterfaceIP "eth0" }}'
dns:
@lucj
lucj / nginx.log
Created November 7, 2018 14:18
Dummy nginx logs to be tested with Elastic stack
46.218.112.178 - - [28/Sep/2017:14:45:19 +0000] "GET /api/1234/1234/from_id HTTP/1.1" 200 615 "https://mydomain.net/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0" "-"
46.218.112.178 - - [28/Sep/2017:14:53:25 +0000] "GET / HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/1234.36" "-"
46.218.112.178 - - [28/Sep/2017:14:53:25 +0000] "GET /assets/styles/materialize.min.css HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/1234.36" "-"
46.218.112.178 - - [28/Sep/2017:14:53:25 +0000] "GET /assets/styles/ReactComponents.css HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/1234.36" "-"
46.218.112.178 - - [28/Sep/2017:14:53:25 +0000] "GET /assets/dependencies/jquery.min.js HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla
@lucj
lucj / nginx.log
Created December 18, 2018 13:47
nginx.log
46.218.112.178 - - [28/Nov/2018:14:45:19 +0000] "GET /api/1234/1234/from_id HTTP/1.1" 200 615 "https://mydomain.net/" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0" "-"
46.218.112.178 - - [28/Nov/2018:14:53:25 +0000] "GET / HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/1234.36" "-"
46.218.112.178 - - [28/Nov/2018:14:53:25 +0000] "GET /assets/styles/materialize.min.css HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/1234.36" "-"
46.218.112.178 - - [28/Nov/2018:14:53:25 +0000] "GET /assets/styles/ReactComponents.css HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/1234.36" "-"
46.218.112.178 - - [28/Nov/2018:14:53:25 +0000] "GET /assets/dependencies/jquery.min.js HTTP/1.1" 304 0 "https://mydomain.net/" "Mozilla

Keybase proof

I hereby claim:

  • I am lucj on github.
  • I am lucj (https://keybase.io/lucj) on keybase.
  • I have a public key ASBw_daat1xpU_7aug3rgZBQjhuxDhsZvU_a0jDM9RCCVQo

To claim this, I am signing this object:

@lucj
lucj / mq-reconnect.js
Created January 14, 2019 10:09
mq-reconnect.js
...
conn.on("close", function() {
winston.error("-> mq.connection: close event received");
mq.channel = null;
// Try to reconnect every X seconds
const timer = setInterval(function () {
winston.info('-> mq.connection: trying to reconnect...');
mq.connect((err) => {
if (err) {
FROM registry.gitlab.com/lucj/sophia.events:latest
ARG token
RUN apk add --no-cache ca-certificates && update-ca-certificates && \
wget -O /microscanner https://get.aquasec.com/microscanner && \
chmod +x /microscanner && \
/microscanner --html --continue-on-failure ${token} && \
rm -rf /microscanner