Skip to content

Instantly share code, notes, and snippets.

floreo

Block or report user

Report or block floreo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@floreo
floreo / LE_ocsp.sh
Created Feb 28, 2018
Bash script to generate OCSP for HAProy
View LE_ocsp.sh
#!/usr/bin/env bash
# Generate OCSP file for every pem
# http://www.jinnko.org/2015/03/ocsp-stapling-with-haproxy.html
# Set a cron every few hours or dayli
## CONFIGURATION ##
_LE_ROOT_DIR="/root/LE/"
_LE_CONF_DIR="${_LE_ROOT_DIR}conf/"
@floreo
floreo / backup.sh
Last active Jan 7, 2018
Server backup script using Duplicity and GnuPG
View backup.sh
#!/usr/bin/env bash
_FTP_PASSWORD=""
_FTP_USER=""
_FTP_HOST=""
_FTP_DIRECTORY=""
_GPG_KEY=""
_BACKUP_OUTPUT="$( mktemp )"
_BACKUP_EMAIL=""
_BACKUP_TYPE="incremental"
@floreo
floreo / index.php
Last active Aug 16, 2018
Philips HUE reverse proxy
View index.php
<?php
/*
* Activate proxy_module and proxy_http_module
*/
ignore_user_abort(true);
$mac_address = [ '<mac address of the real bridge>', '<your fake Philips HUE mac address>' ];
$ip_hue = [ '<ip of the real bridge>', '<ip of your PI>' ];
$bridge_id = [ '<the real bridge id>', '<faked id bridge>' ];
@floreo
floreo / alert.sh
Created Sep 24, 2017
Philips HUE alert for GMAIL // make blink a lamp when finding emails
View alert.sh
#!/usr/bin/env bash
_mail="" # without the @gmail.com
_password=""
_mailcount="$( curl -u ${_mail}:${_password} --silent "https://mail.google.com/mail/feed/atom" | sed -re 's@.*<fullcount>([0-9]+)</fullcount>.*@\1@' )"
if [ -n "${_mailcount}" ] && [ "${_mailcount}" -gt 0 ] ; then
curl -X PUT -d '{ "alert": "select" }' http://<hub IP>/api/<api key>/lights/<light number>/state &>/dev/null
fi
@floreo
floreo / calendar_astreinte.sh
Created Jul 12, 2017
Bash script to import ICS into Radicale
View calendar_astreinte.sh
#!/usr/bin/env bash
# This script import an ics calendar into Radicale
#TODO: check if the current calendar is up to date before to import it, I tried downloading it and comparing checksums but events ain't in the same order :(
declare -r _RADICALE_CALENDAR_URL="<URL of you Radicale calendar"
declare -r _ICS_CALENDAR_URL="<URL of your ICS calendar>"
declare -r _USERPASSWD="<user>:<password>"
_TEMPORARY_ICS="$(mktemp)"
@floreo
floreo / network-graphviz.sh
Created Jul 6, 2017
Funny script to make a graph of the current connections
View network-graphviz.sh
#!/usr/bin/env bash
# requires graphviz
dot -Tpng -o network-$(date +%Y-%m-%d-%H-%M-%S).png < <(sudo netstat -ntu | awk 'BEGIN \
{
print "digraph network {\n\tsize=\"35\" node [shape = circle, style=filled];\n\tratio = fill;\n\trankdir=LR;"; \
} \
/^(ud|tc)p.+/ \
{
@floreo
floreo / pid.sh
Created May 2, 2017
Simple pid script
View pid.sh
#!/usr/bin/env bash
_pid="$HOME/$0.pid"
while :
do
if [ ! -s "${_pid}" ] ; then
echo $$ >"${_pid}"
echo "Doing real stuff"
rm "${_pid}"
@floreo
floreo / spoof.php
Last active Mar 10, 2017
Mail Spoofing Gmail like
View spoof.php
<?php
// howto: php -c <(echo "mail.add_x_header=0") mail.php
$to = "";
$from = "User <real from>";
$spoof="fake mail";
$headers = "Reply-To: $spoof\r\n" .
"Content-type: text/plain; charset=utf-8\r\n".
@floreo
floreo / LE.sh
Last active Mar 12, 2017
bash script to generate Let's Encrypt certificates through Acme Tiny
View LE.sh
#!/usr/bin/env bash
## README ##
#
# * Whats does it require ?
# To download or clone https://github.com/diafygi/acme-tiny inside _LE_ACME_DIR
#
# * How to write a correct conf file ?
# Write a file named myname.conf inside _LE_CONF_DIR
# hHre's the content:
@floreo
floreo / mysqldump.sh
Created Jan 23, 2017
mysqldump script using pt-show-grants
View mysqldump.sh
#!/usr/bin/env bash
# wget percona.com/get/percona-toolkit.deb
declare -r \
_BACKUP_DIR="/root/backup/" \
_OCCURRENCES=24
# Get the real number of backup occurrences and delete the old ones
function delete () {
You can’t perform that action at this time.