Skip to content

Instantly share code, notes, and snippets.

View pirafrank's full-sized avatar
⚙️
building Rusty things for no apparent reason...

Francesco Pira pirafrank

⚙️
building Rusty things for no apparent reason...
View GitHub Profile
@pirafrank
pirafrank / speedtest.sh
Created June 15, 2018 08:38
internet speedtest from command line
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip
@pirafrank
pirafrank / ip6tables_rules.sh
Last active June 12, 2018 06:58
disable IPv6 on iptables
ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT ACCEPT
@pirafrank
pirafrank / firewalld_rules.sh
Last active October 10, 2018 12:32
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
pirafrank / iptables_rules.sh
Last active April 20, 2020 14:19
basic iptables rules
# 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 16:02
Install Docker on Debian Jessie (Debian 8.x)
#!/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 December 13, 2017 18:49
A dummy way to take notes in bash
#!/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
Last active October 27, 2020 08:28
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). Save this file in the 'This Phone' path in Pythonista, then download this shortcut: https://www.icloud.com/shortcuts/d45759eb469b445b943049bf8488e995
#!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 March 4, 2017 16:39 — forked from MatthieuLemoine/install_couchdb_jessie.sh
Install CouchDB from source on Debian Jessie
#!/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 February 17, 2018 15:52
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.
#!/bin/bash
WORKDIR="${1%/}"
cd "$WORKDIR"
if [[ ! ./ -ef $WORKDIR ]]; then
echo "Error: cannot open given dir ($WORKDIR). Exiting..."
exit 1
fi

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