Skip to content

Instantly share code, notes, and snippets.

View frafra's full-sized avatar

Francesco Frassinelli frafra

View GitHub Profile
@frafra
frafra / restore-mediawiki-dump.sh
Last active November 10, 2019 12:03
Restore MediaWiki dump (example)
#!/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 October 22, 2019 20:25
Enable/Disable DNS-over-TLS on Fedora
#!/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 September 22, 2019 11:16
Tricks to use Chromecast on GNU/Linux systems

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 January 21, 2019 14:03
Like `ls -1` but marks path modified by a specific author or a company
#!/bin/bash
#regex="@nina.no$"
regex="$1"
function check {
git log --format="%ae" "$1" | grep -q "$regex"
}
check '.' && echo " * ." || echo " ."
@frafra
frafra / cheap-vps.md
Last active November 28, 2023 09:24
cheap-vps

VPS cheaper than 5 €/month

Famous/big companies

Linode

Current status (October 2020): better avoid

Starting from 5 $/month.

@frafra
frafra / sotm2018-slides-check.sh
Last active August 18, 2018 10:57
Script for check slides availability for SotM 2018
#!/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 July 13, 2018 17:41
Calibre recipe for "Il Post"
#!/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 July 11, 2018 20:24
su.openstreetmap.it / onosm.org recipes

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 June 28, 2018 18:02
iliad.it basic account information parser
#!/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
@frafra
frafra / osmstats.py
Last active June 28, 2018 17:49
OpenStreetMap "Top 500" from neis-one.org
#!/usr/bin/env python3
import hug # fades
import enum
import html.parser
import json
import urllib.request
class Table(enum.Enum):
STATISTICS = enum.auto()