Skip to content

Instantly share code, notes, and snippets.

View pioz's full-sized avatar
🧙‍♂️
[object Object]

Enrico pioz

🧙‍♂️
[object Object]
View GitHub Profile
@pioz
pioz / rename
Created August 8, 2017 13:29
Rename file in batch
ls * | cat -n | while read i f; do mv "$f" `printf "%04d.${f#*.}" "$i"`; done
ls * | cat -n | while read i f; do mv "$f" `printf "$(basename $f .${f#*.})_%04d.${f#*.}" "$i"`; done
https://stackoverflow.com/a/45569550/302005
@pioz
pioz / doc-to-gh-pages
Created July 19, 2017 17:14
Push content of doc directory in master branch to gh-pages branch
#!/bin/bash
set -e
current_dir=$PWD
die() { cd $current_dir; echo $* >&2; exit 1; }
if [ $# != 1 ]; then
die "Usage: $0 REPO_PATH"
@pioz
pioz / deep_search.js
Created February 17, 2017 15:16
Deep recursively search object by id from object
const deep_search = (obj, id) => {
if (obj) {
if (obj.constructor === Object) {
if (obj.id === id) {
return obj
} else {
const keys = Object.keys(obj)
for(let i = 0; i < keys.length; i++) {
let r = deep_search(obj[keys[i]], id)
if (r) return r
@pioz
pioz / wowpvpstats.rb
Last active January 11, 2022 17:00
Grab some pvp stats in World of Warcraft
require 'net/http'
require 'json'
require 'tty-progressbar'
SPECID_MAP = {
250 => 'Death Knight Blood',
251 => 'Death Knight Frost',
252 => 'Death Knight Unholy',
577 => 'Demon Hunter Havoc',
@pioz
pioz / tiramisù.md
Last active January 11, 2022 17:00
Ricetta Tiramisù

Tiramisù

(thick cream)

  • 500g mascarpone
  • 4 eggs
  • 80g sugar

(the original one)

@pioz
pioz / iptables.txt
Created September 23, 2016 10:12
Drop a range of ports except for localhost
iptables -A INPUT -p tcp --match multiport --dports 3000:6000 -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --match multiport --dports 3000:6000 -j DROP
# to remove this rules
iptables -D INPUT -p tcp --match multiport --dports 3000:6000 -s 127.0.0.1 -j ACCEPT
iptables -D INPUT -p tcp --match multiport --dports 3000:6000 -j DROP
# Use iptables-persist to make this rules persistant
@pioz
pioz / megiston.html
Created July 8, 2016 15:50
Megiston logo
<html>
<head>
<style>
h1.megiston {
font-family: helvetica;
font-weight: normal;
font-size: 100px;
line-height: 80%;
}
h1.megiston span {
@pioz
pioz / rename
Created June 13, 2016 09:31
Rename image files based on date taken
jhead -autorot -nf%Y-%m-%d_%H-%M-%S *.jpg
@pioz
pioz / muffin.txt
Last active November 30, 2024 10:10
Ricetta Muffin con gocce di cioccolato
Ricetta per 36 muffin
* 375g di burro
* 800g di farina
* 400g di zucchero
* 400g di latte
* 300g di gocce di cioccolato
* 6 uova
* 2 bustine di vanillina
* 2 pizzichi di sale
@pioz
pioz / crema.txt
Last active October 25, 2015 15:19
Ingredienti crema pasticcera
1000ml latte fresco intero
250ml panna liquida
200g zucchero
200g zucchero
100g farina
5 rossi uova