Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View phretor's full-sized avatar

Federico Maggi phretor

View GitHub Profile
@phretor
phretor / keybase.md
Created July 15, 2021 10:49
keybase.md

Keybase proof

I hereby claim:

  • I am phretor on github.
  • I am federicomaggi (https://keybase.io/federicomaggi) on keybase.
  • I have a public key whose fingerprint is 1F80 C968 F718 D6A1 BC7B 30EA BA2E DAFB 4F24 86BC

To claim this, I am signing this object:

@phretor
phretor / README.md
Last active January 4, 2021 10:04
Periodic off-site replication with FreeBSD, duplicacy and B2

Periodic off-site replication with FreeBSD, duplicacy and B2

I've recently discovered duplicacy, and I've decided to use it with an B2 backend to keep a mirrored offsite replication of the main directories of my home NAS.

I use the periodic system, which offers a nice abstraction over crontab for periodic tasks, and duplicacy to perform the actual backup. To setup duplicacy, I've followed the guide. In simple words, for each directory that I want to replicate, I setup duplicacy in it, which in turns means that you'll have to have a .duplicacy subdirectory in it.

FreeBSD's Periodic

First off, I've added the following to /etc/defaults/periodic.conf. The prefix, 666, is on purpose.

@phretor
phretor / wallabag-to-pocket.py
Created May 4, 2020 06:53
A simple Wallabag -> Pocket conversion script
import time
import io
import csv
import sys
from datetime import datetime
csv.field_size_limit(sys.maxsize)
print("""<!DOCTYPE html>
<html>
@phretor
phretor / What we know (technically) about EyePyramid.md
Last active January 12, 2017 11:31
What we know (technically) about EyePyramid
@phretor
phretor / dig.py
Created November 30, 2016 11:46
Python pathlib2-based recursive directory iterator with depth limits
def _dig(p, max_depth, depth=1):
for sp in p.iterdir():
if sp.is_file():
yield sp
elif sp.is_dir() and depth <= max_depth:
depth += 1
for ssp in _dig(sp, max_depth, depth):
yield ssp
@phretor
phretor / gist:879ac99e45d6d83497d8febf88c238d8
Last active October 17, 2016 14:59
My Son's First Typed Strings (17 months)
/m nm nmbbvvc ,cxcc
rnf vc .cx.x /x/ /,,,,,?/////////////////////////////////////////////////////////////////////////////////////

Keybase proof

I hereby claim:

  • I am phretor on github.
  • I am phretor (https://keybase.io/phretor) on keybase.
  • I have a public key ASAv54h27oSEKgN5zwbiNjbuSGIqQM1FYsSYYvLAm7wCgQo

To claim this, I am signing this object:

#! /usr/bin/env python
import sys
import argparse
import subprocess
import shlex
def main():
parser = argparse.ArgumentParser(
description='Takes a PDF and attempts to embed the fonts.')
@phretor
phretor / migrationChart.as
Created October 20, 2011 14:18
Visualization of the migration screen of BURN
package DetailsPanel.MigrationChart
{
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
import flash.display.Sprite;
import flash.events.Event;
public class MigrationEdge extends Sprite
@phretor
phretor / reflector.c
Created October 19, 2011 15:08
Packet reflector that reflects packets back to the attacker
/*-
* Copyright (c) 2008
* Federico Maggi <fmaggi@elet.polimi.it>, Politecnico di Milano. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright