Skip to content

Instantly share code, notes, and snippets.

View smola's full-sized avatar

Santiago M. Mola smola

View GitHub Profile
@smola
smola / sdkman_oracle_jdk.sh
Last active June 18, 2026 16:33
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 / README.md
Last active February 10, 2026 21:14
Quick notes on installing Ubuntu with LUKS+LVM2

Quick notes on installing Ubuntu with LUKS+LVM2

These are just some quick notes about installing Ubuntu to an encrypted partition (LUKS) with LVM2 on top of it. The installer GUI has an advanced option to do this, but it is only available if you select the Erase disk and install Ubuntu option. I wanted to use this setup while preserving dual boot with Windows.

You should probably follow the following guide, instead of my instructions: https://help.ubuntu.com/community/Full_Disk_Encryption_Howto_2019

TODO

  • Encrypt /boot partition (see the linked guide above).
  • Fix Windows boot loader, removed from GRUB after last update-grub.
@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 / 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 / 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 / poswap.py
Created September 17, 2013 21:18
A Python script for swaping source and target language on a Gettext PO file.
#!/usr/bin/env python
# poswap.py
#
# Copyright (C) 2013 Santiago M. Mola
# Released under the terms of the MIT License.
#
"""
Swaps the source and target language in a Gettext PO file.
Learn more at http://mola.io/2013/09/17/swapping-languages-in-gettext-po-file
@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 / 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()