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
# Define the volume for when the container is created, this will be used to export the realm and users | |
volumes: | |
- ./realms/:/tmp/ | |
# Run the following command from the container shell to export the realm {{ realm }} and include users. | |
$ /opt/keycloak/bin/kc.sh export --dir /tmp --realm {{{ realm }} --users realm_file |
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
sudo apt update | |
sudo apt install python3 python3-venv libaugeas0 | |
sudo python3 -m venv /opt/certbot/ | |
sudo /opt/certbot/bin/pip install --upgrade pip | |
sudo /opt/certbot/bin/pip install certbot | |
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot |
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
DOMAIN={{ domain }} | |
certbot -d "${DOMAIN}" --manual --preferred-challenges dns certonly | |
openssl pkcs12 -export -out "${DOMAIN}.pfx" -inkey "/etc/letsencrypt/live/${DOMAIN}/privkey.pem" -in "/etc/letsencrypt/live/${DOMAIN}/fullchain.pem" |
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
# ~./lookup_timezone.py | |
# https://github.com/mattbornski/tzwhere | |
from tzwhere import tzwhere | |
def lookup_timezone(latitude, longitude): | |
tz = tzwhere.tzwhere(forceTZ=True) | |
return (tz.tzNameAt(latitude, longitude, forceTZ=True)) |
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
# https://github.com/microsoft/OMS-Agent-for-Linux/blob/master/docs/OMS-Agent-for-Linux.md#configuring-the-agent-for-use-with-an-http-proxy-server | |
# Specify (uncomment) the HTTP proxy server, using proxy server and port, or optionally include username and password for authentication. | |
# proxyconf="https://{{ hostname }}:{{ port }}" | |
# proxyconf="https://{{ username }}:{{ password }}@{{ hostname }}:{{ port }}" | |
sudo echo $proxyconf >>/etc/opt/microsoft/omsagent/proxy.conf | |
sudo chown omsagent:omiusers /etc/opt/microsoft/omsagent/proxy.conf | |
sudo chmod 600 /etc/opt/microsoft/omsagent/proxy.conf | |
sudo /opt/microsoft/omsagent/bin/service_control restart |
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
var date_limit = {{ number_of_days }} | |
$("#startDate").on("change", function(e) { | |
var maxDate = new Date($(this).val()) | |
var endDate = new Date($('#endDate').val()) | |
var maxDate = maxDate.setDate(maxDate.getDate() + date_limit) | |
if (endDate > maxDate){ | |
$('#endDate').val(new Date(maxDate).toJSON().slice(0,10)); | |
} |
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
# ~/.bashrc | |
# exported variable for SSH jump host | |
export SSH_JUMPHOST='{{ hostname }}' | |
# Creates a short lived SSH certificate signed by AAD. | |
# Requires public key file creating using the command - ssh-keygen -t rsa -b 4096 | |
alias az_ssh_cert='az ssh cert --public-key-file ~/.ssh/id_rsa.pub --file ~/.ssh/id_rsa-aadcert.pub' | |
# Connects to the target host first by making a connection to the jump host and then establishing |
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
from dateutil import parser | |
from pytz import timezone | |
from datetime import datetime | |
import time | |
def localized_time_to_epoch(timestamp, time_zone): | |
strptime = "%Y-%m-%d %H:%M:%S" | |
timestamp = parser.parse(timestamp) | |
localize = timezone(timezone).localize(datetime.strptime(str(timestamp), strptime)) |
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
// Retrieves the resource element as a mime attachment from the specified input parameter (resourceElement). | |
var content = resourceElement.getContentAsMimeAttachment(); | |
System.debug('The resource element ' + resourceElement.name + ' has been returned with the mime type ' + content.mimeType) | |
content.mimeType = mime; | |
// Sets the mime attachement to the type specifed from the input parameter (mime). | |
resourceElement.setContentFromMimeAttachment(content); | |
System.log('The resource element ' + resourceElement.name + ' mime type type has been set to ' + mime)]] |
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
// Retrieves the resource element as a mime attachment from the specified input parameter (resourceElement). | |
var content = resourceElement.getContentAsMimeAttachment(); | |
System.debug('The resource element ' + resourceElement.name + ' has been returned with the mime type ' + content.mimeType) | |
content.mimeType = mime; | |
// Sets the mime attachement to the type specifed from the input parameter (mime). | |
resourceElement.setContentFromMimeAttachment(content); | |
System.log('The resource element ' + resourceElement.name + ' mime type type has been set to ' + mime) |