Skip to content

Instantly share code, notes, and snippets.

Avatar

Federico Maggi phretor

View GitHub Profile
@phretor
phretor / wallabag-to-pocket.py
Created May 4, 2020
A simple Wallabag -> Pocket conversion script
View wallabag-to-pocket.py
import time
import io
import csv
import sys
from datetime import datetime
csv.field_size_limit(sys.maxsize)
print("""<!DOCTYPE html>
<html>
@phretor
phretor / README.md
Last active Jan 4, 2021
Periodic off-site replication with FreeBSD, duplicacy and B2
View README.md

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 / What we know (technically) about EyePyramid.md
Last active Jan 12, 2017
What we know (technically) about EyePyramid
View What we know (technically) about EyePyramid.md
@phretor
phretor / dig.py
Created Nov 30, 2016
Python pathlib2-based recursive directory iterator with depth limits
View dig.py
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 Oct 17, 2016
My Son's First Typed Strings (17 months)
View gist:879ac99e45d6d83497d8febf88c238d8
/m nm nmbbvvc ,cxcc
rnf vc .cx.x /x/ /,,,,,?/////////////////////////////////////////////////////////////////////////////////////
View keybase.md

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:

View xnu-builder.sh
#!/bin/sh
# Download and build OS X Mavericks XNU Source
if [ ! -d "dtrace-118" ]; then
curl -O http://opensource.apple.com/tarballs/dtrace/dtrace-118.tar.gz
tar zxf dtrace-118.tar.gz
rm dtrace-118.tar.gz
fi
if [ ! -d "AvailabilityVersions-6" ]; then
curl -O http://opensource.apple.com/tarballs/AvailabilityVersions/AvailabilityVersions-6.tar.gz
tar zxf AvailabilityVersions-6.tar.gz
View pdffontembed
#! /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 Oct 20, 2011
Visualization of the migration screen of BURN
View migrationChart.as
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 Oct 19, 2011
Packet reflector that reflects packets back to the attacker
View reflector.c
/*-
* 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