Skip to content

Instantly share code, notes, and snippets.

@CorentinGC
CorentinGC / gist:19b20057edfa15b9536c07c8a4a03dd8
Last active November 18, 2024 22:11
Send mail when no more disk space left (msmtp)
#!/bin/bash
# Purpose: Monitor Linux disk space and send an email alert to $ADMIN
DIRNAME=$(dirname "$0")
ALERT=90 # alert level
ADMIN="[email protected]"
MAIL_CONTENT="Subject:[$(uname -n)] No more space left\\r\\n"
df -H | grep -vE '^Filesystem|tmpfs|cdrom|udev|efivars' | awk '{ print $5 " " $1 }' | {
# 7z archive
7z -mx=0 a /home/user/archive.7z /folder/to/zip
# 7z archive in 1g parts
7z -mx=0 -v1g a /home/user/archive.7z /folder/to/zip
# Copy / rsync
sudo rsync -ah --progress SOURCE DEST
# rsync ssh
@CorentinGC
CorentinGC / gist:571fe1db56643d557db195756b105b7e
Created November 11, 2023 16:13
sed replace accents (YAML)
#!/bin/bash
sed -e "s/é/\\\00E9/g" \
-e "s/è/\\\00E8/g" \
-e "s/ê/\\\00EA/g" \
-e "s/ë/\\\00EB/g" \
-e "s/É/\\\00C9/g" \
-e "s/È/\\\00C8/g" \
-e "s/Ê/\\\00CA/g" \
-e "s/Ë/\\\00CB/g" \
@CorentinGC
CorentinGC / kameto.user.js
Last active April 3, 2022 16:33
Reddit Place - Armée de Kameto
// ==UserScript==
// @name Reddit Place - Armée de Kameto
// @namespace http://tampermonkey.net/
// @version 0.3
// @description On va récuperer ce qui nous est dû de droit.
// @author Adcoss95
// @match https://hot-potato.reddit.com/embed*
// @icon https://styles.redditmedia.com/t5_4eiiz1/styles/communityIcon_ojy24r8j90o81.jpg
// @grant none
// @downloadURL https://gist.githubusercontent.com/CorentinGC/900a7b7c55b608a77bdfc8cb3a26a88a/raw/kameto.user.js?v=0.3