Skip to content

Instantly share code, notes, and snippets.

Francesco Pira pirafrank

Block or report user

Report or block pirafrank

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
pirafrank /
Last active Jun 12, 2018
disable IPv6 on iptables
ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT ACCEPT
pirafrank /
Last active Oct 10, 2018
basic firewalld rules
# basic firewalld rules and commands
# check if running
# systemctl status firewalld
# firewall-cmd --state
# list ports
# firewall-cmd --list-all
# firewall-cmd --list-all --zone=public
# firewall-cmd --list-all --zone=public --permanent
pirafrank /
Last active Apr 2, 2019
basic iptables rules
# iptables basic rules to use (in order)
# set default policy to drop
iptables -P INPUT DROP
# enable ssh on port 22
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
pirafrank /
Last active May 28, 2018
Install Docker on Debian Jessie (Debian 8.x)
# install latest docker-ce release on debian jessie (debian 8.x) or newer
# you need to run this script as root
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
pirafrank /
Created Dec 13, 2017
A dummy way to take notes in bash
# @Description: A simple notetaking solution in your CLI
# @Author: Francesco Pira (dev[at]fpira[dot]com)
# Usage:
# 1) set an alias like this in your .zshrc or .bashrc:
# alias notes='bash /where/your-script-is/'
# 2) notes (ls|new|del|sync|syncinit) [note title]"
pirafrank /
Created Jun 8, 2017
Use Pythonista to download an image from Instagram. Usage via the share extension or run it straight from your home screen (in this case it will get the url from the iOS clipboard).
# this script is for Pythonista 2 and 3
# author: Francesco Pira (
import sys
import requests
from bs4 import BeautifulSoup
import re
import clipboard
pirafrank /
Created Mar 4, 2017 — forked from MatthieuLemoine/
Install CouchDB from source on Debian Jessie
# Inspired by
# Erlang
echo -e "deb jessie contrib" | sudo tee /etc/apt/sources.list.d/erlang-solutions.list
wget -qO - | sudo apt-key add -
# Update packages
sudo apt-get update
pirafrank /
Last active Feb 17, 2018
compress images to 85% quality (great quality/size ratio) using image_magick. Great to add DSLR pics to iCloud Photo Sync or similar services and save space.
if [[ ! ./ -ef $WORKDIR ]]; then
echo "Error: cannot open given dir ($WORKDIR). Exiting..."
exit 1
View My Exiftool

Last updated: 2015-08-11

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

pirafrank / .lftp.mockup.rc
Created Dec 10, 2016 — forked from gaubert/.lftp.mockup.rc
~/.lftp.rc parameters detailed
View .lftp.mockup.rc
########## SETTINGS
# On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and 'set' commands
# there. Some people prefer to see full protocol debug, use 'debug' to turn the debug on.
# Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount
# (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g.
# 5h30m or 5.5h. Also the interval can be 'infinity', 'inf', 'never', 'forever' - it means infinite interval. E.g.
# 'sleep forever' or 'set dns:cache-expire never'.
You can’t perform that action at this time.