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 / hetzner.sh
Created October 18, 2020 19:12 — forked from Knight1/hetzner.sh
Hetzner Cloud create temporary Windows Servers
#!/bin/bash
ID=`hcloud server list | tail -1 | grep Windoof | awk '{print $1;}'`
CONTEXT=`hcloud context active`
if [ "$CONTEXT" != "testing" ]; then
echo "[CRIT] Aborting, wrong context"
exit
fi
@pirafrank
pirafrank / s3_kms_docker_registry_policy.json
Created October 4, 2020 17:41
AWS policy to host a private docker registry on an AWS-KMS encrypted S3 bucket. Attach it to a new IAM user to get Access and Secret keys that only allow access to the given bucket.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
@pirafrank
pirafrank / cloudflareDoH.mobileconfig
Last active October 24, 2025 07:01
iOS, iPadOS and tvOS 14 support MDM profile to set encrypted DNS requests (DNS-over-HTTPS and DNS-over-TLS) on cellular and Wi-Fi connection. To install, open this page from your device and click ‘Raw’ on the one of your choice in the GitHub page. Then continue installation in Settings app. Browse https://1.1.1.1/help after installing to check it
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>DNSSettings</key>
<dict>
<key>DNSProtocol</key>
@pirafrank
pirafrank / ssh_host_key_digest_calculator.sh
Created June 3, 2020 09:37
Script that calculates digest of SSH host keys (different algorithms, output in HEX and Base64) and generates SSHFP DNS entries
#!/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 09:16
extract jwt body with no validation
# 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 08:44
python3 -m http.server PORT for a CORS world
#!/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 April 22, 2020 22:03
dummy script to create, list and delete VMs on scaleway. differently from scaleway_pythonista.py, this is meant to be run on PC
#! python2
#import console
#import dialogs
import urllib2
import json
import requests
import time
api_token = "aaabbb11-9087-5678-1234-000000aaaaaa"
@pirafrank
pirafrank / tinyproxy.conf
Created February 11, 2020 19:37
tinyproxy config
##
## 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 January 15, 2020 22:39
Sauce Code NerdFont packed for Blink Shell iOS. Actual font is embedded in CSS file. Font downloaded from nerdfonts.com, credits to them.
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;
src: url(data:font/ttf;charset-utf-8;base64,AAEAAAAUAQAABABAQkFTRWTMXPQACOiUAAAAiEZGVE17kQBGAAjpHAAAABxHREVGtYO/sAAIuHAAAADcR1BPU8xN2KoACMvEAAAczkdTVULlN7qHAAi5TAAAEnZPUy8ylbzYWQAAAcgAAABgUGZFZOQYPKsACOk4AAACSGNtYXBys1X3AAAthAAAFoJjdnQgAL8LcQAARcAAAAAiZnBnbQZZnDcAAEQIAAABc2dhc3D//wADAAi4aAAAAAhnbHlmvhW2HQAAcwgAB8UEaGVhZAj5rPwAAAFMAAAANmhoZWEGNAxQAAABhAAAACRobXR4XJBgDAAAAigAACtcbG9jYSX9zZAAAEXkAAAtJG1heHANuQl8AAABqAAAACBuYW1lghWwRwAIOAwAABMdcG9zdFKjBGIACEssAABtO3ByZXD6NsDEAABFfAAAAEIAAQAAAAICj4Wih6hfDzz1AB8D6AAAAADRwcdKAAAAANWqn9X8fP5wBd0D+AAAAAgAAgABAAAAAAABAAAD2P7vAAAFFPx8/eYF3QABAAAAAAAAAAAAAAAAAAAKZgABAAALSAg8AFwAcgAGAAEAAAAAAAoAAAIAAMsABAACAAMCtAGQAAUAAAKKAlgAAABLAooCWAAAAV4AMgEgAAACCwUJAwQDAgIEIAAC9wIAOAMAAAAAAAAAAEFEQk8AQAAA//8C7v8GAAAD2AERYAABnwAAAAAB4AKUAAAAIAAOAlgAPgAAAAABTQAAAAAAAAJYAAACWAAAAlgA4wJYAIMCWABXAlgAVQJYABwCWAAqAlgA9QJYANACWAB6AlgAVAJYAFUCWADFAlgAVQJYANsCWABjAlgARwJYAGMCWABFAlgAOQJYACcCW
@pirafrank
pirafrank / DejaVuSansMono_NerdFont_Mono.css
Created January 15, 2020 22:37
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.
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;
src: url(data:font/ttf;charset-utf-8;base64,AAEAAAATAQAABAAwRkZUTYBIN6kAEbloAAAAHEdERUao7cMcABF/KAAAAK5HUE9TqOx1fAARg9QAADWSR1NVQj+MXZEAEX/YAAAD/E9TLzKLYoqyAAABuAAAAFZQZkVk5Bo8qQARuYQAAAJIY21hcHyhIrwAAFtwAAAaQmN2dCDplwcMAAB9fAAAAjBmcGdtWwJr3wAAdbQAAACsZ2FzcAAHAAcAEX8cAAAADGdseWYSXEKFAADtOAAPN3xoZWFkDc25kQAAATwAAAA2aGhlYQjnFE4AAAF0AAAAJGhtdHic5NegAAACEAAAWV5sb2NhvbgUnAAAf6wAAG2MbWF4cCE5Cv4AAAGYAAAAIG5hbWUYkZA2ABAktAAAIstwb3N0+uK9LwAQR4AAATebcHJlcDrHwAcAAHZgAAAHGwABAAAAAl64K4AfU18PPPUCnwgAAAAAANPCKRAAAAAA1uHnkPuJ/QEF7gg6AAAACAAAAAEAAAAAAAEAAAdt/h0AAAXu+4n+9QXuAAEAAAAAAAAAAAAAAAAAABFNAAEAABtiCOMAXABrAAYAAgAQAJkACAAABVcBEQAFAAQAAQTRAZAABQAABTMFmQAAAR4FMwWZAAAD1wBmAhIAAAILBgkDCAQCAgTnACb/0gD5+wIAACgAAAAAUGZFZABAACD//wYU/hQAAAdtAeNgAAHf/98AAAAABNEAaATRAAAE0QAABNEAAATRAgQE0QFSBNEAAgTRAL4E0QAhBNEAOQTRAhAE0QGqBNEBXATRAKYE0QBYBNEBkwTRAWQE0QHpBNEAZgTRAIUE0QD2BNEAmATRAIkE0QBmBNEAjwTRAIUE0QCLBNEAgwTRAH8E0QHpB