Skip to content

Instantly share code, notes, and snippets.

View smola's full-sized avatar

Santiago M. Mola smola

View GitHub Profile
@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 / 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
@smola
smola / sdkman_oracle_jdk.sh
Last active June 26, 2024 11:56
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 / install_ibm_db2.sh
Last active February 2, 2021 10:21
Run IBM DB2 Express-C with Docker
#!/bin/bash
set -eux
#
# Just give up on using packages from IBM.com and their nighmare setup process.
#
# Use Docker: https://hub.docker.com/r/ibmcom/db2
#
CONTAINER=mydb2
@smola
smola / run_attachme
Created November 4, 2020 16:49
AttachMe helper script
#!/bin/bash
# run_attachme
#
# See https://github.com/JetBrains/attachme
ATTACHME_CONF="$HOME/.attachme/conf.sh"
if [[ ! -f $ATTACHME_CONF ]]; then
echo "$ATTACHME_CONF not found."
echo "See https://github.com/JetBrains/attachme"
@smola
smola / linguist_cross_validation.rb
Last active July 4, 2021 18:33
Cross validation for github/linguist
require 'parallel'
require 'linguist'
include Linguist
all = false
if ARGV[0] == '--all'
all = true
ARGV.shift
end
@smola
smola / PHP-EOL.md
Created July 25, 2020 22:49
PHP End of Life Schedule

PHP End of Life Schedule

This table summarizes End of Life (EOL) dates of PHP versions, including commercial vendors and Linux distributions.

Vendor Table

Version PHP Zend RHEL Ubuntu LTS Ubuntu ESM
7.4 2022-11-28
7.3 2021-12-06 LTS¹ 2025-04⁵
@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 / run.groovy
Created July 8, 2020 09:15
Run a command in Groovy
def run(cmd) {
// author: Bob Herrmann
// source: https://stackoverflow.com/a/159270
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = cmd.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"
}