Skip to content

Instantly share code, notes, and snippets.

@hbenali
hbenali / updateavatars.sh
Created December 24, 2025 17:46
eXo Platform Avatar Update Script
#!/bin/bash
# ============================================================================
# BULK AVATAR UPDATER SCRIPT
# ============================================================================
#
# PURPOSE:
# This script automates the process of updating user avatars in an eXo Platform
# instance by uploading image files from the current directory. Each image file's
# name (without extension) is treated as a username, and the image is set as
@hbenali
hbenali / convertxmltoproperties.sh
Last active June 28, 2024 12:56
Convert Java XML to Properties files and support long lines using yq https://github.com/mikefarah/yq
currentDir=$PWD
find -type d -name 'locale' | while read folder; do
cd $currentDir
echo $folder
cd $folder
find -name '*.xml' | while read file; do
tmpfile=$(echo $file | sed -E 's/.xml$/.tmp/g')
propfile=$(echo $file | sed -E 's/.xml$/.properties/g')
yq --xml-skip-directives --xml-skip-proc-inst -p=xml -o=properties --properties-separator="=" --xml-strict-mode $file | sed 's/[^.]*.//' >$tmpfile
@hbenali
hbenali / connectdb.sh
Created May 13, 2024 10:19
Connect to mysql db docker
#!/bin/bash -eu
function getContainerEnv() {
docker inspect -f '{{range $index, $value := .Config.Env}}{{println $value}}{{end}}' $1 | grep $2 | cut -d "=" -f2
}
dbUser=$(getContainerEnv mysql MYSQL_USER)
dbPassword=$(getContainerEnv mysql MYSQL_PASSWORD)
dbRootPassword=$(getContainerEnv mysql MYSQL_ROOT_PASSWORD)
dbName=$(getContainerEnv mysql MYSQL_DATABASE)
if [ "${1:-}" = "--root" ] || [ "${1:-}" = "-r" ]; then
@hbenali
hbenali / 404-error-cogwheels-gsap.markdown
Created January 26, 2022 12:24
404 Error Cogwheels(GSAP)