Skip to content

Instantly share code, notes, and snippets.

View smola's full-sized avatar

Santiago M. Mola smola

View GitHub Profile
@smola
smola / GLUSTER_SETUP.sh
Created October 18, 2018 09:24
Quick and dirty single-node GlusterFS setup
#
# Instructions for quick gluster server (1 node) setup with a volume on LVM.
# No replication, just using localhost.
#
# See https://docs.gluster.org/en/latest/Administrator%20Guide/Brick%20Naming%20Conventions/
#
# Install GlusterFS
add-apt-repository ppa:gluster/glusterfs-4.0
apt-get install glusterfs-server
@smola
smola / sdkman_oracle_jdk.sh
Last active March 14, 2024 12:07
Install Oracle JDK 8 for use with SDKMAN
#!/bin/bash
#
# Install Oracle JDK 8 for use with SDKMAN
#
set -eu
# This URL can be discovered using https://sites.google.com/view/java-se-download-url-converter
DOWNLOAD_URL="https://javadl.oracle.com/webapps/download/GetFile/1.8.0_331-b09/165374ff4ea84ef0bbd821706e29b123/linux-i586/jdk-8u331-linux-x64.tar.gz"
TARBALL="jdk-8u331-linux-x64.tar.gz"
@smola
smola / git-find-roots
Created January 18, 2017 09:23
Find all initial commits and the commits where they were merged
#!/bin/bash
#
# git-find-roots finds every commit with no parent (initial commits)
# and the commit where they were merged.
#
# Usage:
# git-find-roots [commit-ish]
#
# Example:
# git-find-roots master
@smola
smola / jira_adjust_time_tracking.py
Created May 24, 2016 15:07
jira_adjust_time_tracking.py
#!/usr/bin/env python
# coding: utf-8
"""
Adjusts the time tracking for issues in a given JIRA project.
Requires 'jira' library:
$ pip install jira
JIRA credentials need to be stored in a file '.jira_auth.json'.
Its contents should be:
@smola
smola / k8s-jprofiler-attach.sh
Created March 23, 2018 14:49
Attach JProfiler agent to a JVM running in a Kubernetes pod
#!/bin/bash
set -e
if [[ -z ${K8S_JVM_POD} ]]; then
echo "K8S_JVM_POD not defined"
exit 1
fi
EXEC="kubectl exec ${K8S_JVM_POD}"
CP="kubectl cp ${K8S_JVM_POD}"
@smola
smola / old_openssl.sh
Last active July 12, 2023 17:55
Install old OpenSSL for use with PHPBrew and old PHP versions (e.g. 5.3)
#!/bin/sh
#
# Build old OpenSSL for usage in old PHP builds
# (e.g. PHP 5.3).
#
# This solution was originally found at:
# https://gist.github.com/marulitua/f8932064ec5bfe6a5be9fadac7c5a141
#
# Relevant discussions:
# https://github.com/phpbrew/phpbrew/issues/418
@smola
smola / watchdog_polling_repro.py
Last active June 30, 2023 06:15
Issue with watchdog PollingObserver missing events when removing files
# Reproduction for https://github.com/gorakhargosh/watchdog/issues/992
from tempfile import TemporaryDirectory
import time
import os
import os.path
from multiprocessing import Process, Queue
from pathlib import Path
from watchdog.observers.polling import PollingObserver
@smola
smola / structured_logging.py
Created July 26, 2018 08:47
quick example on structured logging approaches for Python
#!/usr/bin/env python3
import logging
# setting up a JSON formatter for standard library
from pythonjsonlogger import jsonlogger
logger = logging.getLogger()
logHandler = logging.StreamHandler()
@smola
smola / git-cherry-list
Last active March 9, 2022 12:00
git-cherry-list
#!/usr/bin/env bash
set -eu
PROG_NAME="$(basename -- "${BASH_SOURCE[0]}")"
print_usage() {
echo "Usage: $PROG_NAME [-i <ignored pattern>] <SOURCE> <TARGET>"
echo ""
echo "Examples:"
echo " # Compare master to branch v1.x"
@smola
smola / docker-logs-all
Created September 2, 2021 11:43
Continuously tail logs for all Docker containers.
#!/bin/bash
set -eu
_shutdown() {
for pid in $(jobs -p); do
kill $pid || true
done
}
trap _shutdown EXIT