Skip to content

Instantly share code, notes, and snippets.


fab fabriziosalmi

View GitHub Profile
fabriziosalmi / covid19_stats.php
Last active Mar 6, 2020
COVID19 stats php script
View covid19_stats.php
// use: http(s)://PHP_HOST/covid19_stats.php?date=03-03-2020
// data source:
$url = "".$_GET["date"].".csv";
$data = file_get_contents($url);
file_put_contents("last.csv", $data);
$csv = array_map('str_getcsv', file('last.csv'));
foreach($csv as $row) {
while IFS= read -r website
echo "$website" >> $output
openssl s_client -servername $website -connect $website:443 2>/dev/null | openssl x509 -noout -dates | grep After | cut -d"=" -f2 >> $output
done < "$input"
fabriziosalmi /
Created Oct 27, 2019 — forked from cgmartin/
Bash SSL Certificate Expiration Check
echo "checking if $TARGET expires in less than $DAYS days";
expirationdate=$(date -d "$(: | openssl s_client -connect $TARGET:443 -servername $TARGET 2>/dev/null \
| openssl x509 -text \
| grep 'Not After' \
|awk '{print $4,$5,$7}')" '+%s');
in7days=$(($(date +%s) + (86400*$DAYS)));
View png
for i in `find path/pngfiles/ -type f -name "*.png"`; do optipng -preserve -strip all $i; done
View nginx php-fpm
# nginx conf
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/XXXX/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/XXXX/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
fabriziosalmi /
Created Dec 9, 2017 — forked from bennylope/
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.