Skip to content

Instantly share code, notes, and snippets.

View AndreaNicola's full-sized avatar
😀

Andrea Nicola AndreaNicola

😀
View GitHub Profile
@jomix
jomix / aes.go
Created February 14, 2018 08:54
Decrypting something encrypted with OpenSSL passphrase in Golang
//https://dequeue.blogspot.com.au/2014/11/decrypting-something-encrypted-with.html
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"encoding/base64"
"fmt"
@thomasdarimont
thomasdarimont / KeycloakAdminClientExample.java
Last active April 30, 2024 22:18
Using Keycloak Admin Client to create user with roles (Realm and Client level)
package demo.plain;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.ClientRepresentation;
@LorisBachert
LorisBachert / TikaExtractor.java
Last active August 16, 2023 11:43
Using Apache TIKA to extract the following formats: DOC, DOCX, PPT, PPTX, XLS, XLSX, PDF, JPG, PNG, TXT Note: Tesseract must be installed in order to get JPG and PNG extraction working.
/**
* Uses Tikas {@link AutoDetectParser} to extract the text of a file.
*
* @param document
* @return The text content of a file
*/
@Override
public String extractTextOfDocument(File file) throws Exception {
InputStream fileStream = new FileInputStream(file);
Parser parser = new AutoDetectParser();