Skip to content

Instantly share code, notes, and snippets.

Francesco Frassinelli frafra

Block or report user

Report or block frafra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View systemd-containers.md

systemd containers

Assumptions

This how-to uses mybox as container name, mkosi in order to create containers (it works for multiple distributions and has more features compared to dnf --installroot), and crudini for configurations file (you can use your preferred text editor instead).

How to create a container with mkosi

# mkosi --cache /var/cache/mkosi -d fedora -t directory -o /var/lib/machines/mybox
@frafra
frafra / ls-contributed-to.sh
Created Jan 21, 2019
Like `ls -1` but marks path modified by a specific author or a company
View ls-contributed-to.sh
#!/bin/bash
#regex="@nina.no$"
regex="$1"
function check {
git log --format="%ae" "$1" | grep -q "$regex"
}
check '.' && echo " * ." || echo " ."
View cheap-vps.md

VPS cheaper than 5 €/month

Hetzner

Starting from 2.50 €/month (CX11).

Pro:

  • Custom operating systems via recovery mode
  • Good reputation
@frafra
frafra / poliadventures-17december.md
Last active Nov 16, 2018
Quests - December 2017 #PoliMappersAdventures
View poliadventures-17december.md

Quests - December 2017 #PoliMappersAdventures

  1. Learn something you didn't know about OpenStreetMap https://learnosm.org/
  2. Install StreetComplete (for Android) or Go Maps (for iOS) https://github.com/westnordost/StreetComplete#download or https://itunes.apple.com/app/id592990211
  3. Map a bench https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dbench
  4. Find a bench and add the backrest tag https://wiki.openstreetmap.org/wiki/Key:backrest
  5. Map a picnic table https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dpicnic_table
  6. Find a bench or a picnic table and add the material tag https://wiki.openstreetmap.org/wiki/Key:material
  7. Map a trash bin (unsorted waste only) https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dwaste_basket
  8. Map a container for recycling of used goods https://wiki.openstreetmap.org/wiki/Tag:amenity%3Drecycling
@frafra
frafra / osh2sqlite.py
Last active Oct 8, 2018
OSM node history to SQLite
View osh2sqlite.py
#!/usr/bin/env python3
#
# OSM node history to SQLite
import osmium
import sqlite3
import sys
SCHEMA_OBJECT = """
@frafra
frafra / mbox2html.py
Last active Sep 13, 2018
Mailbox to HTML conversion using Python 3 + Jinja2 in less than 100 lines (including GPLv3 license)
View mbox2html.py
#!/usr/bin/env python3
#
# Copyright (C) 2016 - Francesco Frassinelli
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@frafra
frafra / sotm2018-slides-check.sh
Last active Aug 18, 2018
Script for check slides availability for SotM 2018
View sotm2018-slides-check.sh
#!/bin/bash
#
# Run this script inside the openstreetmap/stateofthemap-2018 repository
rm -f slides.csv
(for talk in _posts/schedule/*.md; do
slide=$(basename $talk .md | cut -d'-' -f4-)
echo -n $slide
for field in "time" "room" "authors"; do
echo -n ,$(sed -nr "s/$field: \"(.*)\"/\1/p" $talk | tr -d ',')
@frafra
frafra / ilpost.recipe
Created Jul 13, 2018
Calibre recipe for "Il Post"
View ilpost.recipe
#!/usr/bin/env python2
from calibre.ebooks.BeautifulSoup import BeautifulSoup
from calibre.web.feeds.news import BasicNewsRecipe
class IlPost(BasicNewsRecipe):
title = "Il Post"
language = "it"
tags = "news"
#feeds = ["https://www.ilpost.it/feed/"]
@frafra
frafra / su.openstreetmap.it-recipes.md
Last active Jul 11, 2018
su.openstreetmap.it / onosm.org recipes
View su.openstreetmap.it-recipes.md

su.openstreetmap.it / onosm.org recipes

These recipes are for su.openstreetmap.it, but they can be used for onosm.org (replace the URL where necessary).

Note: jq can be required by some recipes.

Get the first 100 unresolved notes (geojson)

curl 'https://api.openstreetmap.org/api/0.6/notes/search.json?q=su.openstreetmap.it&limit=100&closed=0' -o notes.geojson
@frafra
frafra / iliad.py
Created Jun 28, 2018
iliad.it basic account information parser
View iliad.py
#!/usr/bin/env python3
import bs4 # fades beautifulsoup4
import hug # fades
import humanfriendly # fades
import requests # fades
import datetime
import string
# https://github.com/xolox/python-humanfriendly/issues/29
You can’t perform that action at this time.