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
# Enable health endpoint. | |
ENV KC_HEALTH_ENABLED=true | |
# Copies the docker-healthcheck.sh file into the /opt/keycloak directory. | |
COPY --chown=keycloak:keycloak \ | |
./docker-healthcheck.sh \ | |
/opt/keycloak/bin/docker-healthcheck.sh | |
# Add healthcheck to execute a shell command as the health check | |
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ |
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
def is_valid_polygon( | |
data: list | |
) -> list: | |
"""" | |
Check if the polygons in the data are valid and closed. | |
Args: | |
data: A list containing polygon data in the format: | |
{'polygons': [{'coordinates': [{'latitude': float, |
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
UPDATE {{ table_name }} | |
SET {{ column_name }} CASE WHEN {{ value}} IS NOT NULL THEN {{ value }} ELSE {{column_name }} END | |
WHERE {{ column_name }} = {{ value }} |
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://www.postgresql.org/docs/current/dml-returning.html | |
-- Use of RETURNING avoids performing an extra database query to collect the | |
-- data, and is especially valuable when it would otherwise be difficult to | |
-- identify the modified rows reliably. The allowed contents of a RETURNING | |
-- clause are the same as a SELECT command's output list (see Section 7.3). | |
-- It can contain column names of the command's target table, or value | |
-- expressions using those columns. A common shorthand is RETURNING *, which | |
-- selects all columns of the target table in order. |
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
def is_valid_email( | |
email_str: str | |
) -> bool: | |
""" | |
Check if a string is a valid email address. The regular expression checks | |
that the email address conforms to the syntax rules specified in RFC 5322. | |
Parameters: | |
email_str (str): The string to check. |
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 flask import ( | |
request | |
) | |
required_fields: [ | |
# Add list of required field names. | |
] | |
# Parse request data as JSON. | |
data = request.get_json() |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
func secretaryProblem(n, cutoff int) int { | |
// Generate a slice of candidates from 1 to n. | |
candidates := make([]int, n) |
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
def mask_string( | |
string: str, | |
end: int = 4 | |
) -> str: | |
""" | |
Mask a string by replacing all but the last number of characters with asterisks(*). | |
Parameters: | |
string (str): The string to be masked. |
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
# Set the DOMAIN variable to the desired domain name | |
DOMAIN={{ domain }} | |
# Use the openssl utility to verify the SSL/TLS certificate | |
# located at /etc/letsencrypt/live/${DOMAIN}/cert.pem | |
# The -CAfile flag specifies a file containing trusted CA certificates | |
# The -untrusted flag specifies a file containing additional, untrusted certificates | |
# that will also be used in the verification process |
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 random | |
# Set the length of the string | |
length = 8 | |
# Set the characters that the string can contain | |
characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
# Set the required characters | |
required_characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |