Skip to content

Instantly share code, notes, and snippets.

View mlersch's full-sized avatar
🍌
coding

Matthias Lersch mlersch

🍌
coding
View GitHub Profile
@mlersch
mlersch / currency.erl
Last active February 5, 2018 18:19
A Erlang snippet to convert a currency strings or binary to a integer
-author("mlersch").
-module(currency).
-export([test/0, convert/1]).
convert(V) when is_binary(V) -> convert(binary_to_list(V));
convert(V) when is_float(V) -> round(V*100);
convert(V) when is_integer(V) -> V*100;
convert(V) when is_list(V) ->
V1 = re:replace(re:replace(V, "[^0-9 ^, ^.]", "", [{return,list},unicode,global]), "\\h", "", [{return,list},global]),
@rafaeltuelho
rafaeltuelho / openid_access_token-decode.md
Last active June 12, 2023 23:45
Decoding an encoded oAuth JSON Web Token (JWT): access_token

Given an encoded (base64) JWT (access_token).

For example, see this sample OAuth2 response generated by JBoss APIMan/Keycloak

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Date: Tue, 25 Aug 2015 19:25:12 GMT
@kamermans
kamermans / configure_docker0.sh
Last active April 26, 2024 00:58
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
#
# NOTE: Since Docker 1.10 (February 4, 2016), it has been possible to configure the
# Docker daemon using a JSON config file. On Linux, this file is normally located at
# /etc/docker/daemon.json. You should use this JSON config method if you are running
# a version of Docker that is at least 1.10!
# Here is an example configuration that sets the docker0 bridge IP to 192.168.254.1/24:
# {
# "bip": "192.168.254.1/24"
# }