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
pirafrank / firewalld_rules.sh
Last active Oct 10, 2018
basic firewalld rules
View firewalld_rules.sh
# 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
pirafrank / iptables_rules.sh
Last active Apr 2, 2019
basic iptables rules
View iptables_rules.sh
# iptables basic rules to use (in order)
# set default policy to drop
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
# enable ssh on port 22
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
@pirafrank
pirafrank / docker_jessie.sh
Last active May 28, 2018
Install Docker on Debian Jessie (Debian 8.x)
View docker_jessie.sh
#!/bin/bash
# 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 https://download.docker.com/linux/debian/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
@pirafrank
pirafrank / notes.sh
Created Dec 13, 2017
A dummy way to take notes in bash
View notes.sh
#!/bin/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/notes.sh'
# 2) notes (ls|new|del|sync|syncinit) [note title]"
#
@pirafrank
pirafrank / instagram_download.py
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).
View instagram_download.py
#!python2
# this script is for Pythonista 2 and 3
# author: Francesco Pira (fpira.com)
import sys
import requests
from bs4 import BeautifulSoup
import re
import clipboard
@pirafrank
pirafrank / install_couchdb_jessie.sh
Created Mar 4, 2017 — forked from MatthieuLemoine/install_couchdb_jessie.sh
Install CouchDB from source on Debian Jessie
View install_couchdb_jessie.sh
#!/bin/bash
# Inspired by http://verbally.flimzy.com/install-couchdb-1-6-1-debian-8-2-jessie/
# Erlang
echo -e "deb http://packages.erlang-solutions.com/debian jessie contrib" | sudo tee /etc/apt/sources.list.d/erlang-solutions.list
wget -qO - http://packages.erlang-solutions.com/debian/erlang_solutions.asc | sudo apt-key add -
# Update packages
sudo apt-get update
@pirafrank
pirafrank / imagecompress.sh
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.
View imagecompress.sh
#!/bin/bash
WORKDIR="${1%/}"
cd "$WORKDIR"
if [[ ! ./ -ef $WORKDIR ]]; then
echo "Error: cannot open given dir ($WORKDIR). Exiting..."
exit 1
fi
View My Exiftool Cheatsheet.md

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
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'.
@pirafrank
pirafrank / youtube-uploader-cli.sh
Created Nov 14, 2016
Quick script to automate video upload from CLI to YouTube. Replace 'francesco' with your own username.
View youtube-uploader-cli.sh
#!/bin/bash
# Quick script to automate video upload from CLI to YouTube.
# More info and requirements at https://github.com/tokland/youtube-upload
# BEFORE starting: replace 'francesco' with your own username to make it work!
if [[ $# != 3 ]]; then
echo "Error: wrong number of arguments. It should be 3, you put $#."
echo "Usage: ./youtube-uploader-cli.sh [video title] [video path] [public | unlisted | private]"
exit -1
You can’t perform that action at this time.