Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Thomas Darimont thomasdarimont

🏠
Working from home
Block or report user

Report or block thomasdarimont

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thomasdarimont
thomasdarimont / App.java
Last active Nov 16, 2019
Secure REST API Example with Spring Security, Spring Session, Spring Boot
View App.java
package demo;
import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@thomasdarimont
thomasdarimont / application.yml
Last active Nov 14, 2019
Hello OAuth Groovy example (Keycloak + Spring Security OAuth)
View application.yml
security:
oauth2:
client:
# clientId in keycloak
clientId: demo
# clientSecret in keycloak
clientSecret: xxxx
# From Authorization Server's metadata
# Keycloak realm is spring-security-sso
accessTokenUri: http://localhost:8081/auth/realms/spring-security-sso/protocol/openid-connect/token
@thomasdarimont
thomasdarimont / docker-compose.yml
Created Jan 25, 2019
Docker OpenLDAP + phpldapadmin example
View docker-compose.yml
version: '2'
services:
openldap:
image: osixia/openldap:1.2.3
container_name: openldap
environment:
LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "Example Inc."
LDAP_DOMAIN: "example.org"
LDAP_BASE_DN: ""
@thomasdarimont
thomasdarimont / RsyncOverSsh_Fast_Documentation.md
Created Nov 12, 2019 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)
View RsyncOverSsh_Fast_Documentation.md

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
View HttpClientExample.java
package demo.example;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class HttpClientExample {
public static void main(String[] args) throws Exception {
View Example020_HttpClientExample.java
package demo;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@thomasdarimont
thomasdarimont / AesCipher.php
Last active Nov 10, 2019
Example for 128bit AES with Java and PHP
View AesCipher.php
<?php
class AesCipher {
private const OPENSSL_CIPHER_NAME = "aes-128-cbc";
private const CIPHER_KEY_LEN = 16; //128 bits
private static function fixKey($key) {
if (strlen($key) < AesCipher::CIPHER_KEY_LEN) {
@thomasdarimont
thomasdarimont / app.py
Created Jul 19, 2017
Simple python example using flask, flask_oidc and keycloak, needs a small patch of flask_oidc: https://github.com/puiterwijk/flask-oidc/issues/35
View app.py
import json
import logging
from flask import Flask, g
from flask_oidc import OpenIDConnect
import requests
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__)
@thomasdarimont
thomasdarimont / readme.md
Last active Nov 6, 2019
Use Keycloak as Identity provider for Drupal
View readme.md
@thomasdarimont
thomasdarimont / App.java
Last active Nov 5, 2019
How to use custom SpEL functions in @value with Spring Boot
View App.java
package demo;
import static java.lang.reflect.Modifier.*;
import java.util.Arrays;
import java.util.Set;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanExpressionResolver;
You can’t perform that action at this time.