Skip to content

Instantly share code, notes, and snippets.

View sscarduzio's full-sized avatar

Simone Scarduzio sscarduzio

View GitHub Profile
@sscarduzio
sscarduzio / index.js
Last active April 15, 2024 15:45
Zero bullshit Keycloak authentication for Express JS - from
/*
SEE FIRST COMMENT FOR DESCRIPTION AND USAGE
*/
const Keycloak = require('keycloak-connect')
const express = require('express')
const session = require('express-session')
const app = express()
const LOGIN_PATH = '/login'
const LOGOUT_PATH = '/logout'
@sscarduzio
sscarduzio / relog.sh
Created August 24, 2014 21:20
BtWiFi_with_FON automatic login written as a bash script. I have this running every 10 minutes on my raspberry pi
#!/bin/bash
# CONF
DBG=true
RELOG_UNAME=your@email.com
RELOG_PASSW=xxxxxxxxxxxxxxx
# END CONF
@sscarduzio
sscarduzio / BinaryRedisCodec.java
Last active June 8, 2023 14:17
Binary codec for Lettuce (asynchronous redis client for Java)
package com.lambdaworks.redis.codec;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
/**
* A {@link RedisCodec} that handles binary keys and values.
* This is useful if you are storing non-UTF8 data in Redis
* such as serialized objects or multimedia content.
{"ts":"2022-04-15T13:01:08.780Z","msg":"logger initialized with name desktop"}
{"ts":"2022-04-15T13:01:08.821Z","msg":"on:ready","version":"2.0.46"}
{"ts":"2022-04-15T13:01:09.161Z","msg":"Core process status","alive":false}
{"ts":"2022-04-15T13:01:09.311Z","msg":"","cliBinPath":"/usr/local/bin/envkey","cliCurrent":"2.0.24","cliVersion":"2.0.24"}
{"ts":"2022-04-15T13:01:09.311Z","msg":"Starting core process daemon via CLI"}
{"ts":"2022-04-15T13:01:23.188Z","msg":"Successfully started core process"}
{"ts":"2022-04-15T13:01:23.188Z","msg":"core is running","currentAppVersion":"2.0.46"}
{"ts":"2022-04-15T13:01:23.188Z","msg":"Fetching root-device-key from OS credential store..."}
{"ts":"2022-04-15T13:01:23.188Z","msg":"CLI inside `pkg`"}
{"ts":"2022-04-15T13:01:23.189Z","msg":"loading keytar from __non_webpack_require__('keytar')"}
@sscarduzio
sscarduzio / CONTRIBUTING.md
Created February 7, 2021 21:10
ReadonlyREST Elasticsearch plugin CLA

Contribution License Agreement

Thank you for your interest in ReadonlyREST (“Product”), managed by Beshu Limited, a company duly established under the laws of United Kingdom, with registration number No. 10888034, and registered address at Office 32 13-21 Crawford Street, WH1 1PG, the owner the product (“We” or “Us”). We appreciate all the Contributions, made to our Product.

The purpose of this Contribution License Agreement (“CLA”, or “Agreement”) is to clarify the intellectual property rights granted with the Contribution to the Product from any person or entity. This CLA serves as a protection for a Contributor, as well as the protection of Us, our Product and its users.

This Agreement does not change your right to use your Contribution for the other purposes.

const http = require('http')
const httpProxy = require('http-proxy')
const l = require('chalk')
// ---- Kibana
function filterHeaders(prefix, o) {
var filtered = []
for (k of Object.keys(o)) {
if (k.indexOf(prefix) >= 0) {
var partialObj = {}
const http = require('http')
const httpProxy = require('http-proxy')
const l = require('chalk')
// ---- Kibana
function filterHeaders(prefix, o) {
var filtered = []
for (k of Object.keys(o)) {
if (k.indexOf(prefix) >= 0) {
var partialObj = {}
@sscarduzio
sscarduzio / git-tag-delete-local-and-remote.sh
Last active May 13, 2020 10:45 — forked from mobilemind/git-tag-delete-local-and-remote.sh
How to delete multiple git tags locally and remote
# Usage: ./git-tag-delete-local-and-remote.sh 1.19
# will delete tags: "1.19.1" "1.19.2" "1.19.3" ...
for i in `git tag|grep $1`
do
git push --delete origin "$i"
git tag -d "$i"
done
@sscarduzio
sscarduzio / docker-compose_1.yml
Created March 3, 2020 14:50
Secure Your ELK Stack
version: '3.3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2
container_name: ror_elasticsearch
hostname: ror_elasticsearch
ports:
- "9200:9200"
@sscarduzio
sscarduzio / docker-compose_2.yml
Last active March 3, 2020 14:50
Secure Your ELK Stack via Either X-Pack or ReadonlyREST (2)
version: '3.3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2
container_name: ror_elasticsearch
hostname: ror_elasticsearch
ports:
- "9200:9200"