Skip to content

Instantly share code, notes, and snippets.

View cpecorari's full-sized avatar
🎯
Focusing

Côme Peco cpecorari

🎯
Focusing
View GitHub Profile
@cpecorari
cpecorari / 0-install.sh
Last active July 12, 2022 08:55
Server Disk Space Check & mail notification
#!/bin/sh
apt update && \
apt install postfix mailutils && \
# manually cofigure postfix with "Internet site"
echo "test" | mail your@email.com
@cpecorari
cpecorari / pre-push
Created September 10, 2021 09:26
pre-push protecting git branch
#!/bin/bash
protected_branch='prod'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null