8000 gquittet’s gists · GitHub
[go: up one dir, main page]

Skip to content

Instantly share code, notes, and snippets.

View gquittet's full-sized avatar
👋
Welcome

Guillaume Quittet gquittet

👋
Welcome
View GitHub Profile

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)
@gquittet
gquittet / .ideavimrc
Last active February 6, 2025 16:50
IdeaVIM config
set NERDTree
set commentary
set highlightedyank
set ideajoin
set surround
Plug 'justinmk/vim-sneak'
" set scrolloff=5 sidescrolloff=10
" Line number
@gquittet
gquittet / docker-sum-images-size.sh
Created October 16, 2023 12:29
Docker sum images size
#!/usr/bin/env bash
docker image ls -a | awk -F ' ' '{ print $7 }' | tail +2 | sed 's/B/i/' | numfmt --from=auto | awk '{n += $1}; END{print n}' | numfmt --to=iec-i
(function () {
'use strict';
const feedContent = document.querySelector('.feed-content')
const feedMain = document.querySelector('.feed-main')
const sidebar = document.querySelector('.feed-right-sidebar')
feedContent.style.maxWidth = "unset"
feedMain.style.maxWidth = "100%"
sidebar.style.maxWidth = "unset"
@gquittet
gquittet / 0-url-json-compress-client-node.js
Last active October 1, 2023 22:30
JSON compression for URL
import zlib from 'node:zlib';
import example from './example.json' assert { type: "json" };
const text = JSON.stringify(example);
const compressed = zlib.gzipSync(text).toString('base64').replace(/\//g, '_').replace(/\+/g, '-').replace(/=/g, '');
// H4sIAAAAAAAAE-3KsQ2AIBCG0V3-GhPu1ObmsJJQkGBhb2fcXRZggy955Suv7q7Y9qTenkshz74u2YfDLMyHU1_i8Xg8Ho_H4_F4PB6Px-PxeDwejzd99Qd5g3u1cRcAAA
0