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 typesense | |
def init_client(): | |
client = typesense.Client({ | |
'nodes': [{ | |
'host': 'localhost', | |
'port': '8108', | |
'protocol': 'http' | |
}], |
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
kubectl patch deployment X --patch '{"spec": {"template": {"spec": {"containers": [{"name": "Y","livenessProbe": {"httpGet":{"path": "health", "port":8080, "scheme": "HTTP"}, "periodSeconds": 3, "initialDelaySeconds": 3, "timeoutSeconds": 50}}]}}}}' | |
kubectl patch deployment X --patch '{"spec": {"template": {"spec": {"containers": [{"name": "Y","livenessProbe": null}]}}}}' |
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
docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --no-pull -c -e --interval 10 --cleanup --rolling-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
[supervisord] | |
nodaemon=true | |
user = root | |
[program:launcher] | |
command=python3 -u launcher.py | |
autostart = true | |
autorestart = true | |
stdout_logfile=/var/log/launcher.log | |
stderr_logfile=/var/log/launcher.log |
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
echo 'reg/image:tag' 'reg/image:tag' 'reg/image:tag' | xargs -n 1 docker push |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: fluent-bit-config | |
namespace: logging | |
labels: | |
k8s-app: fluent-bit | |
data: | |
fluent-bit.conf: | |
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
# @brief | |
# Performs file upload validation for django. The original version implemented | |
# by dokterbob had some problems with determining the correct mimetype and | |
# determining the size of the file uploaded (at least within my Django application | |
# that is). | |
# @author dokterbob | |
# @author jrosebr1 | |
import mimetypes |
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
# ---- Base python ---- | |
FROM python:3.6 AS base | |
# Create app directory | |
WORKDIR /app | |
# ---- Dependencies ---- | |
FROM base AS dependencies | |
COPY gunicorn_app/requirements.txt ./ | |
# install app dependencies | |
RUN pip install -r requirements.txt |
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 re | |
def replace(string, substitutions): | |
substrings = sorted(substitutions, key=len, reverse=True) | |
regex = re.compile('|'.join(map(re.escape, substrings))) | |
return regex.sub(lambda match: substitutions[match.group(0)], string) |