Skip to content

Instantly share code, notes, and snippets.

View gquittet's full-sized avatar
👋
Welcome

Guillaume Quittet gquittet

👋
Welcome
View GitHub Profile

Convert it to readable text file

mysqlbinlog -vv --base64-output=decode-rows binlog.190611 > binlog.190611.txt

Count occurences of database modifications

cat binlog.190611.txt |grep -i 'update\|insert\|delete\|replace\|alter' | tr ‘[A-Z]’ ‘[a-z]’|sed -e '/*/d' | sort | uniq -c | sort -n
@gquittet
gquittet / IntelliJ insert current date live template.md
Created June 6, 2025 09:58
IntelliJ insert current date live template

IntelliJ insert current date live template

  1. Go to Settings -> Editor -> Live Tempalates
  2. Click on "+" icon
  3. Name the abbreviation date
  4. Add description: Insert current date using RFC 8601
  5. Write following template text: $date$ image
  6. Edit variable and write date and the following expression: date("yyyy-MM-dd'T'HH:mm:ss.SSSZ") image

VPS

Locale

Edit /etc/locale.conf to change LANG to en_US.UTF-8

LANG=en_US.UTF-8
@gquittet
gquittet / clean_private_registry_images.sh
Last active May 21, 2025 15:28
Docker private registry cleaning script
#!/usr/bin/env sh
install_missing_dep() {
if ! command -v "$1" > /dev/null 2>&1; then
echo "Installing $1..."
apk add "$1"
fi
}
DEPS="curl jq"

NGinx Proxy Manager

  • Forward request IP: proxy_set_header X-Forwarded-For $remote_addr;
@gquittet
gquittet / docker_full_network_usage.sh
Created November 14, 2024 12:26
Small one-liner to see full network usage of running/all containers
printf "
\e[1mDocker Network Usage\e[0m
\e[3mRunning containers (I/O):\e[0m $(docker stats --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f1 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec) / $(docker stats --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f2 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec)
\e[3mAll containers (I/O):\e[0m $(docker stats --all --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f1 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec) / $(docker stats --all --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f2 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec)
"

Disable lid suspend

  1. Create a file sudo vim /etc/systemd/logind.conf.d/00-laptop.conf
  2. Append this content in it
    [Login]
    HandleLidSwitch=ignore
    HandleLidSwitchExternalPower=ignore
    HandleLidSwitchDocked=ignore                         
@gquittet
gquittet / Overpass API - Find near location recycling center
Created August 20, 2024 22:37
Overpass API - Find near location recycling center
/*
This has been generated by the overpass-turbo wizard.
The original search was:
“aminity=*”
*/
[out:json];
// gather results
(
// query part for: “aminity=*”
node["amenity"="recycling"]["recycling_type"="centre"]["ownership"!="private"](around:10000,lat,lon);
@gquittet
gquittet / mysql_tables_size.sql
Last active July 25, 2024 08:04
List MySQL tables sizes
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = 'my_database'
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;

Replace Docker Desktop with Colima

  1. Install required dependencies
brew install colima docker docker-credential-helper docker-buildx docker-compose docker-completion
  1. Edit the docker configuration to use extensions and credentials helper (otherwise everything will be stored in clear)