Skip to content

Instantly share code, notes, and snippets.

Avatar

Francesco Pira pirafrank

View GitHub Profile
@pirafrank
pirafrank / ephemeral.html
Last active Oct 20, 2020
ephemeral text editor. content lives only in your browser, until you refresh the page.
View ephemeral.html
<!DOCTYPE html>
<!--
You curious :P
-->
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ephemeral Text Editor</title>
<style>
@pirafrank
pirafrank / ephemeral
Created Oct 19, 2020
an ephemeral text editor in your browser. create a new bookmark and paste the raw content of this gist inside in the url field. enjoy!
View ephemeral
data:text/html;base64,PCFET0NUWVBFIGh0bWw+DQo8IS0tDQogIFlvdSBjdXJpb3VzIDpQDQogLS0+DQo8aHRtbCBsYW5nPSJlbiI+DQo8aGVhZD4NCiAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLjAiPg0KICA8dGl0bGU+RXBoZW1lcmFsIFRleHQgRWRpdG9yPC90aXRsZT4NCiAgPHN0eWxlPg0KICAgIGJvZHkgew0KICAgICAgdGV4dC1hbGlnbjogY2VudGVyOw0KICAgICAgZm9udC1mYW1pbHk6IEFyaWFsLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWY7DQogICAgfQ0KICAgIC5iZWNvb2wgew0KICAgICAgbGluZS1oZWlnaHQ6MS41Ow0KICAgICAgZm9udC1zaXplOjE4cHg7DQogICAgICBmb250LWZhbWlseTogbW9ub3NwYWNlOw0KICAgICAgbWluLWhlaWdodDogMTBlbTsNCiAgICAgIHBhZGRpbmc6IDE1cHg7DQogICAgICBib3JkZXI6IDJweCBzb2xpZCAjMzMzMzMzOw0KICAgICAgYm9yZGVyLXJhZGl1czogNXB4Ow0KICAgICAgbWFyZ2luLWxlZnQ6IDN2dzsNCiAgICAgIG1hcmdpbi1yaWdodDogM3Z3Ow0KICAgICAgdGV4dC1hbGlnbjogbGVmdDsNCiAgICB9DQogICAgLmZvb3RlciB7DQogICAgICBwYWRkaW5nLXRvcDogMTBweDsNCiAgICAgIGZvbnQtc2l6ZTogMC45ZW07DQogICAgfQ0KICA8L3N0eWxlPg0KPC9oZWFkPg0KPGJvZHk+DQogIDxkaXYgY2xhc3M9InRvcCI+DQogICAgPHA+DQogICAgICBKdXN0IGEgcHJldHRpZXIgPGNvZGU+Y29udGVudGVkaXRhYm
@pirafrank
pirafrank / hetzner.sh
Created Oct 18, 2020 — forked from Knight1/hetzner.sh
Hetzner Cloud create temporary Windows Servers
View hetzner.sh
#!/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 Oct 4, 2020
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.
View s3_kms_docker_registry_policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
@pirafrank
pirafrank / cloudflareDoH.mobileconfig
Last active Oct 7, 2020
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
View cloudflareDoH.mobileconfig
<?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 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
You can’t perform that action at this time.