Skip to content

Instantly share code, notes, and snippets.

View rcastellotti's full-sized avatar
🐻

Roberto Castellotti rcastellotti

🐻
View GitHub Profile
@rcastellotti
rcastellotti / g13o.sh
Created January 27, 2024 13:05
curl | pup | jq script to fetch recipes from https://giallozafferano.it
#!/usr/bin/env sh
usage() {
cat "Usage: $(basename "$0") <giallozafferano.it URL>"
exit 0
}
[ -z "$1" ] && { usage; }
if ! command -v pup > /dev/null
then
@rcastellotti
rcastellotti / index.html
Created November 13, 2023 19:58
html+tailwind boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>rcastellotti - boilerplate</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css" />
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
<script>
import subprocess
def run_fio_test(machine, filename, iodepth, rw, bs, numjobs):
name = f"{machine}-{rw}-{bs}-{numjobs}-{iodepth}"
command = [
"fio",
"--name=" + name,
"--filename=" + filename,
"--iodepth=" + str(iodepth),
"--rw=" + rw,
@rcastellotti
rcastellotti / rpdl.py
Created November 21, 2022 15:42
A simple rayplay.it python downloader with no external dependencies
from urllib.request import urlopen
import subprocess
import json
import argparse
def download(url):
with urlopen(url.replace(".html", ".json")) as response:
body = response.read()
payload = json.loads(body)
@rcastellotti
rcastellotti / app.py
Created September 4, 2022 11:38
flask jinja+sqlalchemy iterate through entire table
@app.route("/orders", methods=["GET", "POST"])
def orders():
orders = Order.query.all()
return render_template("orders.html", orders=orders)
@rcastellotti
rcastellotti / rcs-sane-rankings.user.js
Last active March 20, 2022 13:16
RCS sane rankings
// ==UserScript==
// @name RCS sane rankings
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show full rankings on RCS websites
// @author @rcastellotti
// @match https://www.milanosanremo.it/*
// @match https://www.ilombardia.it/*
// @match https://www.strade-bianche.it/*
// @match https://www.tirrenoadriatico.it/*
@rcastellotti
rcastellotti / hac.sh
Created November 20, 2021 12:12
Download every HAC (Handbook of Applied Cryptography) chapter
#!/bin/bash
url="https://cacr.uwaterloo.ca/hac/about/"
mkdir hac
cd hac
wget -O "00 TOC.pdf" "${url}toc3.pdf"
wget -O "01 Overview of cryptograpy.pdf" "${url}chap1.pdf"
wget -O "02 Mathematics Background.pdf" "${url}chap2.pdf"
wget -O "03 Number-Theoretic Reference Problems.pdf" "${url}chap3.pdf"
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body {
color: #444;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
@rcastellotti
rcastellotti / icons.sh
Last active November 29, 2021 17:19
A simple bash script to create icons for your website/PWA
#!/usr/bin/env bash
if [ $# == 0 ]; then
echo "Usage: $0 param1 [param2]"
echo "* param1: png image (best 512x512)"
echo "* param2: folder for images, default: static/"
exit
fi
#check if imagemagick is installed and fail otherwise
@rcastellotti
rcastellotti / OSTEP.sh
Last active April 24, 2023 22:25 — forked from theagoliveira/OSTEP.sh
Download every OSTEP (Operating Systems: Three Easy Pieces) chapter
#!/bin/bash
url="http://pages.cs.wisc.edu/~remzi/OSTEP/"
mkdir ostep
cd ostep
wget -O "00a Preface.pdf" "${url}preface.pdf"
wget -O "00b TOC.pdf" "${url}toc.pdf"
wget -O "01 Dialogue.pdf" "${url}dialogue-threeeasy.pdf"
wget -O "02 Introduction.pdf" "${url}intro.pdf"