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 / restore-mediawiki-dump.sh
Last active Nov 10, 2019
Restore MediaWiki dump (example)
View restore-mediawiki-dump.sh
#!/bin/bash -ex
# https://dumps.wikimedia.org/backup-index.html
dump="https://dumps.wikimedia.org/nowiktionary/20191101/nowiktionary-20191101-pages-articles-multistream.xml.bz2"
# https://www.mediawiki.org/wiki/Extension:Scribunto
scribunto="https://extdist.wmflabs.org/dist/extensions/Scribunto-REL1_33-8328acb.tar.gz"
pod="wiktionary"
mysql=$(podman volume create)
@frafra
frafra / stubby-onoff.sh
Last active Oct 22, 2019
Enable/Disable DNS-over-TLS on Fedora
View stubby-onoff.sh
#!/bin/bash
# mkdir -p $HOME/bin && cd $_ && wget https://gist.githubusercontent.com/frafra/a1ca3d5eff81e6c6aebd8fab12b00695/raw/stubby-onoff.sh -O stubby-onoff && chmod +x $_ && cd -
set -ex
[ $USER == "root" ] || exec sudo $0
pkgs="getdns-stubby crudini"
rpm -q $pkgs || dnf install -y $pkgs
conf=/etc/NetworkManager/NetworkManager.conf
@frafra
frafra / chromecast-and-linux.md
Last active Sep 22, 2019
Tricks to use Chromecast on GNU/Linux systems
View chromecast-and-linux.md

No weird or unmaintained softwares or libraries are involved in this guide, just VLC, Avahi and youtube-dl.

VLC + Chromecast

VLC supports Chromecast since version 3.0.0 (2018-02-09). Just go to Playback -> Renderer.

vlc --sout "#chromecast" --sout-chromecast-ip=$IP --demux-filter=demux_chromecast "$input"
@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 ',')
You can’t perform that action at this time.