This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Grab('com.github.scribejava:scribejava-apis:6.9.0') | |
| import com.github.scribejava.apis.KeycloakApi; | |
| import com.github.scribejava.core.builder.ServiceBuilder; | |
| import com.github.scribejava.core.model.OAuth2AccessToken; | |
| import com.github.scribejava.core.model.OAuthRequest; | |
| import com.github.scribejava.core.model.Response; | |
| import com.github.scribejava.core.model.Verb; | |
| import com.github.scribejava.core.oauth.OAuth20Service; | |
| import java.io.IOException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Mount wait-for-it https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh | |
| version: "3" | |
| networks: | |
| kong-net: | |
| driver: bridge | |
| services: | |
| ####################################### | |
| # Postgres: The database used by Kong | |
| ####################################### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # X509 Browser and Direct grant | |
| # https://access.redhat.com/documentation/en-us/red_hat_single_sign-on/7.2/html/server_administration_guide/authentication | |
| # https://github.com/keycloak/keycloak-documentation/blob/4.8.x/server_admin/topics/authentication/x509.adoc | |
| #https://stackoverflow.com/questions/54258996/git-bash-string-parameter-with-at-start-is-being-expanded-to-a-file-path | |
| unameOut="$(uname -s)" | |
| case "${unameOut}" in | |
| CYGWIN*) prefix="/";; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //https://iamdav.in/2014/10/24/bookmarklet-creating-csv-html-table/ | |
| //http://js.do/blog/bookmarklets/ | |
| javascript:(function(){ | |
| function getJavaScript(url, success) { | |
| var script = document.createElement('script'); | |
| script.src = url; | |
| var head = document.getElementsByTagName('head')[0], | |
| done = false; | |
| script.onload = script.onreadystatechange = function(){ | |
| if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CountUppercase { | |
| static final int ITERATIONS = Math.max(Integer.getInteger("iterations", 1), 1); | |
| public static void main(String[] args) { | |
| String sentence = String.join(" ", args); | |
| for (int iter = 0; iter < ITERATIONS; iter++) { | |
| if (ITERATIONS != 1) System.out.println("-- iteration " + (iter + 1) + " --"); | |
| long total = 0, start = System.currentTimeMillis(), last = start; | |
| for (int i = 1; i < 10_000_000; i++) { | |
| total += sentence.chars().filter(Character::isUpperCase).count(); | |
| if (i % 1_000_000 == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import SimpleHTTPServer | |
| import SocketServer | |
| import logging | |
| PORT = 8090 | |
| class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
| def do_GET(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Convert PREFIX_XXX=YYY variable to --xxx=YYY | |
| PREFIX=$1 | |
| DEFAULT=$DEFAULT_ARGS | |
| RESULT= | |
| if [ ${#PREFIX} -ge 2 ]; then | |
| while IFS= read -r line | |
| do | |
| PRE_KEY=$(echo $line | cut -d'=' -f1) | |
| KEY=$(echo $PRE_KEY |sed -e "s/$PREFIX/--/g; s/_/-/g; s/\(.*\)/\L\1/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.net.ssl.SSLSocket; | |
| import javax.net.ssl.SSLSocketFactory; | |
| import java.io.*; | |
| /** Establish a SSL connection to a host and port, writes a byte and | |
| * prints the response. See | |
| * http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services | |
| */ | |
| public class SSLPoke { | |
| public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #set -x | |
| #bash templater.sh < oc-template.tpl.yml | oc process -f - | oc create -f - | |
| #bash templater.sh < oc-template.tpl.yml > oc-template.yml && oc process -f oc-template.yml | oc create -f - | |
| while IFS= read -r line | |
| do | |
| end_offset=${#line} | |
| IS_VAR=true | |
| # Read variable in file | |
| while [[ "${line:0:$end_offset}" =~ (.*)(\$\{([a-zA-Z_][a-zA-Z_0-9]*)\})(.*) ]] ; do |