Skip to content

Instantly share code, notes, and snippets.

@gchait
gchait / clean-previous-images.sh
Created December 13, 2025 12:22
Keep only a specific tag from a Docker repository
# shellcheck disable=SC2086
docker images -q "${DOCKER_REPO_FULL}" | \
grep -v "$(docker images -q ${DOCKER_IMAGE})" | \
xargs --no-run-if-empty docker rmi -f
@gchait
gchait / Dockerfile
Created December 13, 2025 12:19
Extend Flink Operator with plugins
FROM ghcr.io/apache/flink-kubernetes-operator:xxxxx
ARG PLUGINS="flink-s3-fs-hadoop flink-s3-fs-presto"
ENV FLINK_PLUGINS_DIR=/opt/flink/plugins
ENV BASE_PLUGIN_JARS_URL=https://repo1.maven.org/maven2/org/apache/flink
RUN cd ${FLINK_PLUGINS_DIR} \
&& flink_version=$(ls ./flink-metrics-prometheus | cut -d"-" -f4 | sed "s/.jar//") \
&& for plugin in ${PLUGINS}; \
@gchait
gchait / run-ecs-task.sh
Created December 13, 2025 12:14
Treat an ECS task as a job
# shellcheck disable=SC2086
set -o allexport
source .env
set +o allexport
cluster_args="--cluster ${ECS_CLUSTER} --region ${REGION}"
net_config="{\"awsvpcConfiguration\":{\"assignPublicIp\":\"XXX\",\"subnets\":[\"${SUBNET_ID}\"]}}"
task_arn=$(aws ecs run-task ${cluster_args} \
--task-definition "${ECS_TASK_DEF_ARN}" --launch-type FARGATE \
@gchait
gchait / log-date-fmt.sh
Created December 13, 2025 12:10
Align date and time while streaming logs
# shellcheck disable=SC2154
"${tail_command[@]}" | while read -r datetime rest; do
new_datetime=$("${DATEUTIL}" -d "${datetime} UTC" +"%d/%m/%y %H:%M:%S")
echo "${new_datetime} ${rest}"
done
@gchait
gchait / jenkins_lambda.py
Created December 13, 2025 12:05
Trigger a Jenkins job from an AWS Lambda
"""
This simply functions as a reverse-proxy to a Jenkins job.
It allows granting the source access only to this specific action,
instead of requiring direct network access to the Jenkins server.
"""
from os import getenv
from urllib.parse import quote
from urllib.request import Request, urlopen
@gchait
gchait / steam_inventory.py
Created December 13, 2025 11:54
Fetch a Steam inventory as JSON
#!/usr/bin/env python3
"""
Steam inventory dumper with JSON output.
Output formats:
- Default: Pretty-printed JSON with nested structure
- --flat: JSONL (one item per line) for streaming/grep
Examples:
./steam_inventory.py <steamid64>