Skip to content

Instantly share code, notes, and snippets.

View RobertHeim's full-sized avatar

Robert Heim RobertHeim

  • Berlin, Germany
View GitHub Profile
@goeh
goeh / set-keycloak-client-secret.groovy
Created November 29, 2019 12:00
Inject client secrets from a local file into a Keycloak Realm Export (JSON) file
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
def jsonSlurper = new JsonSlurper()
def secrets = jsonSlurper.parse(new File(args[1] ?: "secrets.json")).clients.inject([:]) { map, c -> map[c.client] = c.secret; map }
def realm = jsonSlurper.parse(new File(args[0]))
for(client in realm.clients) {
if(secrets[client.clientId]) {
@Tucker-Eric
Tucker-Eric / generate.sh
Created February 16, 2017 18:06
Script to generate nginx config
SED=`which sed`
CURRENT_DIR=`dirname $0`
echo "What is the domain?"
read DOMAIN
# check the domain is valid!
PATTERN="^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$";
if [[ "$DOMAIN" =~ $PATTERN ]]; then
DOMAIN=`echo $DOMAIN | tr '[A-Z]' '[a-z]'`
@sephiroth74
sephiroth74 / git pretty stat
Last active April 17, 2024 22:23
Show lines added/deleted and total commits per author in a period of time on all branches
git log --all --numstat --pretty="%H" --author="author" --since=1.year | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d\nlines deleted: -%d\ntotal commits: %d\n", plus, minus, total)}'