This file contains 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 logging | |
import sys | |
from logging.handlers import TimedRotatingFileHandler | |
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") | |
LOG_FILE = "my_app.log" | |
def get_console_handler(): | |
console_handler = logging.StreamHandler(sys.stdout) | |
console_handler.setFormatter(FORMATTER) |
This file contains 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 | |
#usage: mysql-drop-all-tables -d database -u dbuser -p dbpass | |
TEMP_FILE_PATH='./drop_all_tables.sql' | |
while getopts d:u:p: option | |
do | |
case "${option}" | |
in |
This file contains 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
// ==UserScript== | |
// @name Google Bookmarks fix | |
// @match https://www.google.com/bookmarks/* | |
// @grant none | |
// @require https://code.jquery.com/jquery-1.12.4.min.js | |
// @require https://code.jquery.com/ui/1.12.1/jquery-ui.js | |
// ==/UserScript== | |
$(function() { | |
try { |
This file contains 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 | |
for domain in "github.com" "bitbucket.org"; do | |
echo $domain | |
sed -i "/$domain/d" ~/.ssh/known_hosts | |
line=$(ssh-keyscan $domain,`nslookup $domain | awk '/^Address: / { print $2 ; exit }'`) | |
echo $line >> ~/.ssh/known_hosts | |
done |
This file contains 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
# Cache sudo password | |
sudo -v | |
# Enable installation of 32-bit packages | |
sudo dpkg --add-architecture i386 | |
# Enable the Ubuntu partner repository (this doesn't seem to be necessary for 20.04) | |
if [ $(lsb_release -r | awk '{print $2}') == '18.04' ]; then | |
sudo sed -i 's/^# deb http:\/\/archive.canonical.com\/ubuntu/deb http:\/\/archive.canonical.com\/ubuntu/' /etc/apt/sources.list | |
sudo apt update |
This file contains 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
{ | |
"meta": { | |
"theme": "elegant" | |
}, | |
"basics": { | |
"name": "Thomas Davis", | |
"label": "Web Developer", | |
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4", | |
"summary": "I'm a full stack web developer who can build apps from the ground up. I've worked mostly at startups so I am used to wearing many hats. I am a very product focused developer who prioritizes user feedback first and foremost. I'm generally very flexible when investigating new roles. ", | |
"website": "https://lordajax.com", |
Docker allows storing configurations outside docker images and running containers. This feature, named configs, eliminates the need to use volumes, bind-mount, or environment variables to pass configurations to containers.
The configs have the following characteristics:
- Configs are not encrypted (secrets are encrypted)
- Config values can be strings or binary data
- Config values have maximum size of 500 kB
- Configs are mounted as a file in the container filesystem. The default location is /<config-name> in the container
- Configs can be added or removed from a service at any time
This is a short and simple example on how to build a proper Keycloak cluster, using JDBC_PING
as discovery protocol and an NGINX server as reverse proxy.
As this is for legacy Keycloak version (Wildfly based, up until version 17), you can find an example for more current and uptodate versions at this gist here: https://gist.github.com/dasniko/3a57913047af3ca1b6b0a83b294dc1a1
Please see also my video about Keycloak Clustering: http://www.youtube.com/watch?v=P96VQkBBNxU
This file contains 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
# Keycloak containers doesn't come with curl or wget in it, this forces the users to use alternative mechanisms to realise | |
# health check for the keycloak standard containers. This example leverages the capability of modern Java to dynamically | |
# compile a *.java source file and execute it on the fly using the `java` command. The HealthCheck class uses | |
# java.net.URL to open a connection to the `health/live` endpoint of keycloak and exits the process with a non-zero status | |
# if the http status is not `Ok` | |
version: '3' | |
services: | |
############################ | |
# Keycloak service | |
############################ |