Skip to content

Instantly share code, notes, and snippets.

Francesco Pira pirafrank

View GitHub Profile
@pirafrank
pirafrank / ssh_host_key_digest_calculator.sh
Created Jun 3, 2020
Script that calculates digest of SSH host keys (different algorithms, output in HEX and Base64) and generates SSHFP DNS entries
View ssh_host_key_digest_calculator.sh
#!/bin/bash
# available as gist at https://gist.github.com/pirafrank/df40b2b082b91ed79036b328a3f010da
# keep it in this order to match SSHFP numbers
keylist="/etc/ssh/ssh_host_rsa_key.pub /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ed25519_key.pub"
SSHFP=0
algolist="sha256 sha1 md5"
@pirafrank
pirafrank / jwtBody.js
Created May 25, 2020
extract jwt body with no validation
View jwtBody.js
# sometimes you only need to get JWT body data without validating it
# WARNING: use this only if you have already validated the token in earlier steps in the chain
const jwt = "eyJ0eX...";
const jwtBodyJson = JSON.parse(Buffer.from(jwt.split(".")[1], "base64").toString());
@pirafrank
pirafrank / httpserver.py
Created May 21, 2020
python3 -m http.server PORT for a CORS world
View httpserver.py
#!/usr/bin/env python3
# It's python3 -m http.server PORT for a CORS world
from http.server import HTTPServer, SimpleHTTPRequestHandler
import sys
class CORSRequestHandler(SimpleHTTPRequestHandler):
@pirafrank
pirafrank / scaleway.py
Last active Apr 22, 2020
dummy script to create, list and delete VMs on scaleway. differently from scaleway_pythonista.py, this is meant to be run on PC
View scaleway.py
#! python2
#import console
#import dialogs
import urllib2
import json
import requests
import time
api_token = "aaabbb11-9087-5678-1234-000000aaaaaa"
View tinyproxy.conf
##
## tinyproxy.conf -- tinyproxy daemon configuration file
##
## This example tinyproxy.conf file contains example settings
## with explanations in comments. For decriptions of all
## parameters, see the tinproxy.conf(5) manual page.
##
#
# User/Group: This allows you to set the user and group that will be
@pirafrank
pirafrank / SauceCode_NerdFont.css
Created Jan 15, 2020
Sauce Code NerdFont packed for Blink Shell iOS. Actual font is embedded in CSS file. Font downloaded from nerdfonts.com, credits to them.
View SauceCode_NerdFont.css
This file has been truncated, but you can view the full file.
@font-face {
font-family: "Sauce Code Nerdfont";
font-style: normal;
font-weight: 400;
@pirafrank
pirafrank / DejaVuSansMono_NerdFont_Mono.css
Created Jan 15, 2020
DejaVuSansMono NerdFont Mono packed for Blink Shell iOS. Actual font is embedded in CSS file. DejaVuSansMono NerdFont Mono downloaded from nerdfonts.com. Credits to them.
View DejaVuSansMono_NerdFont_Mono.css
This file has been truncated, but you can view the full file.
@font-face {
font-family: "DejaVuSansMono NerdFont Mono";
font-style: normal;
font-weight: normal;
@pirafrank
pirafrank / JetBrainsMono.css
Created Jan 15, 2020
JetBrainsMono.css font for Blink Shell. Credits to JetBrains. https://www.jetbrains.com/lp/mono/
View JetBrainsMono.css
This file has been truncated, but you can view the full file.
@font-face {
font-family: "JetBrainsMono";
font-style: italic;
font-weight: bold;
@pirafrank
pirafrank / nordvpn_download.sh
Created Jan 7, 2020
download .ovpn files per country from nordvpn website
View nordvpn_download.sh
#!/bin/bash
country="$1"
# e.g. fr, it, de, etc.
mkdir -p "$country/UDP"
cd $country/UDP
curl -sSL https://nordvpn.com/ovpn | grep -E "\/$country[0-9]*.nordvpn.com" | grep 'UDP' | cut -d'"' -f2 | xargs wget
cd ..
mkdir TCP
@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')
You can’t perform that action at this time.