Skip to content

Instantly share code, notes, and snippets.

View mathieuancelin's full-sized avatar

Mathieu ANCELIN mathieuancelin

View GitHub Profile
function jwt_decode() {
jq -R 'split(".") | .[0] | @base64d | fromjson' <<< "$1"
jq -R 'split(".") | .[1] | @base64d | fromjson | if .iat then (.iat_str = (.iat|gmtime|strftime("%Y-%m-%dT%H:%M:%S %Z"))) else . end | if .exp then (.exp_str = (.exp|gmtime|strftime("%Y-%m-%dT%H:%M:%S %Z"))) else . end | if .nbf then (.nbf_str = (.nbf|gmtime|strftime("%Y-%m-%dT%H:%M:%S %Z"))) else . end' <<< "$1"
}
@mathieuancelin
mathieuancelin / otoroshi (2).json
Last active April 8, 2020 12:07
Keycloak docker mtls
{
"clientId": "otoroshi",
"name": "otoroshi",
"description": "otoroshi",
"rootUrl": "http://localhost:8080",
"adminUrl": "http://localhost:8080/*",
"surrogateAuthRequired": false,
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-x509",
package otoroshi.plugins.defer
import akka.http.scaladsl.util.FastFuture
import akka.stream.Materializer
import env.Env
import org.joda.time.DateTime
import otoroshi.script._
import play.api.libs.json._
import play.api.mvc.Result

Otoroshi cluster demos

assuming your local ip address is 192.168.86.194

Getting otoroshi

curl -L -o otoroshi.jar 'https://dl.bintray.com/maif/binaries/otoroshi.jar/1.4.6/otoroshi.jar'
# or
curl -L -o otoroshi.jar 'https://dl.bintray.com/maif/binaries/otoroshi.jar/snapshot/otoroshi.jar'
/*
"dependencies": {
"bcrypt": "3.0.3",
"node-jsencrypt": "1.0.0"
}
*/
const bcrypt = require('bcrypt');
const JSEncrypt = require('node-jsencrypt');
const _crypto = require('crypto');
#!/bin/bash
set -e
outfile=
passfile=
pin=
encKey=01
action=encrypt
xrandr --output DP-1 --set underscan on
xrandr --output DP-1 --set "underscan hborder" 31 --set "underscan vborder" 42
@mathieuancelin
mathieuancelin / index.js
Created April 26, 2018 09:36
Copy Otoroshi apikeys from one group to another
const fetch = require('node-fetch');
const base64 = require('base-64');
const argv = require('minimist')(process.argv.slice(2));
const OTOROSHI_URL = argv['otoroshi-url'] || 'http://otoroshi-api.foo.bar'
const APIKEY_ID = argv['otoroshi-apikey-id'] || 'admin-api-apikey-id'
const APIKEY_SECRET = argv['otoroshi-apikey-secret'] || 'admin-api-apikey-secret'
const SERVICE_FROM = argv['service-from'] || '--';
const SERVICE_TO = argv['service-to'] || '--';
const http = require('http');
const url = require('url');
const faker = require('faker');
const bytes = require('bytes');
const _ = require('lodash');
const port = process.env.PORT || process.argv[2] || 8080;
const cache = {};
package app
import cats.Applicative
import cats.effect._
import cats.implicits._
import fs2.StreamApp.ExitCode
import fs2.{Stream, StreamApp}
import io.circe._
import io.circe.generic.semiauto._
import org.http4s.circe._