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 / basebalance.py
Last active Jul 9, 2019
quick way to check your Coinbase balance for listed currencies
View basebalance.py
import json
from coinbase.wallet.client import Client
with open('app/credentials.json', 'r') as f:
credentials = json.load(f)
client = Client(credentials["api_key"],
credentials["api_secret"],
api_version='2016-03-03')
@pirafrank
pirafrank / scaleway_vm.sh
Created May 23, 2019
creating, starting, listing and killing Scaleway VMs by Python API
View scaleway_vm.sh
#! python2
import console
import dialogs
import urllib2
import json
import requests
import time
api_token = "aaabbb11-9087-5678-1234-000000aaaaaa"
@pirafrank
pirafrank / uninstall_office_2016.sh
Last active May 20, 2019
Uninstall Office 2016 from OS X completely
View uninstall_office_2016.sh
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo -e "
ROOT PRIVILEDGES NEEDED!
You have to run this script as root.
Aborting...
"
exit 1
else
@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 / who_is_logged_in.sh
Last active Jan 9, 2019
List logged users and how many sessions they have opened.
View who_is_logged_in.sh
#!/bin/bash
if [[ $# > 1 ]]; then
echo "Error: wrong number of arguments"
exit -1
else
if [[ $1 == "" ]]; then
while read -r line
do
USER=$(echo $line | awk '{print $2}')
@pirafrank
pirafrank / ovpn_generator.conf
Last active Jan 9, 2019
Generator of .ovpn files with hardened client config and embedded cert, key and ta.key.
View ovpn_generator.conf
client
dev tun
proto udp
remote <SERVER> <PORT>
resolv-retry infinite
nobind
persist-key
persist-tun
key-direction 1 # <-- DO NOT change this! (server.conf must have: tls-auth ta.key 0)
cipher AES-256-CBC
@pirafrank
pirafrank / fpira.com_static_S3_backup_and_deploy.sh
Last active Jan 9, 2019
Backup and deploy to Amazon S3 static resources of my website (fpira.com)
View fpira.com_static_S3_backup_and_deploy.sh
#!/bin/bash
# crontab entry
# 0 0 * * * /bin/bash /home/francesco/fpiracom_static_backup.sh > /dev/null 2>&1
#
# variables
#
ENV_PATH="/home/francesco/Code/awscli_lisa" # path to your virtualenv with awscli module
@pirafrank
pirafrank / git_mirror.sh
Created Dec 17, 2018
mirror your git repos to make a backup
View git_mirror.sh
#!/bin/bash
for url in $(ssh git.example.com ls-urls)
do
echo "Cloning $url ..."
git clone --mirror "$url"
done
@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 / 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
You can’t perform that action at this time.