Skip to content

Instantly share code, notes, and snippets.

View checco's full-sized avatar
🐗
I'm always hungry

Francesco Latini checco

🐗
I'm always hungry
View GitHub Profile
@checco
checco / postgres-owner-grants.sql
Last active June 14, 2023 15:19
How to change OWNER for DATABASE, SCHEMA or TABLE on AWS RDS PostgreSQL. An how to REASSIGN owner for all objects on AWS RDS PostgreSQL
--
-- Change database owner
--
ALTER DATABASE "db_name" OWNER TO user;
--
-- List schemas
--
@checco
checco / remove_merged_branches.sh
Created November 7, 2019 10:12
Remove all merged GIT branches
#!/bin/bash
git for-each-ref --format '%(refname:short)' refs/heads | grep -v master | xargs git branch -D
@checco
checco / fusionauth_migration_from_mysql_to_psql.sh
Last active June 7, 2021 13:53
Migrate FusionAuth from MySQL to PostgreSQL on DigitalOcean
# FusionAuth database has tables which don't have primary keys this is a problem from the Digital Ocean perspective,
# because they are using row-based replication with the MySQL engine to provide backups and read replicas.
# We have migrated 2 environments, from MySQL 8 to PostgreSQL 12
# pgloader help
docker run --rm --name pgloader dimitri/pgloader:latest pgloader --help
# run pgloader
docker run --rm --name pgloader dimitri/pgloader:latest pgloader --no-ssl-cert-verification --verbose --debug \
"mysql://odyssey-auth:${mysql_password}@${digitalocean_mysql_host}:25060/odyssey-auth"
@checco
checco / recursive-md5sum.sh
Created October 20, 2023 12:45
Print a md5 checksum for directories recursively
#!/bin/bash
for dir in `find . -type d -not -path '*/.*'`;
do
echo -en "${dir}: ";
find ${dir} -type f -not -path '*/.*' -exec md5sum {} \; | md5sum | awk '{print $1}';
done
@checco
checco / bulk_delete_workouts.js
Created May 1, 2024 10:16
Bulk delete workouts on Garmin connect, via development tool console
function deleteWorkouts() {
const deleteWorkoutElements = document.querySelectorAll('.delete-workout');
if (deleteWorkoutElements.length === 0) {
console.log('No more "delete-workout" elements found.');
return;
}
deleteWorkoutElements[0].click();