Instantly share code, notes, and snippets.

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 ',')
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/"]
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
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
View osmstats.py
#!/usr/bin/env python3
import hug # fades
import enum
import html.parser
import json
import urllib.request
class Table(enum.Enum):
STATISTICS = enum.auto()
View fake-usb-tester.py
#!/usr/bin/env python3
#
# WARNING: This program will OVERWRITE the entire device and
# you may LOSE DATA. Use it carefully.
# How to create a test block device:
# $ dd if=/dev/zero of=fake bs=1M count=100
# # mknod fake b 7 200
# # losetup /dev/fake fake
View tags.json
[{
"sectionname": "addresses",
"sectiondescription": "addresses",
"forms": [{
"formname": "address",
"formitems": [{
"key": "addr:street",
"value": "",
"type": "string",
"mandatory": "no"
View gpap-notes2osm.sql
/*
Description:
This query allows to convert notes from GeoPaparazzi into a OSM XML
file that can be imported into JOSM.
Usage:
$ sqlite3 geopaparazzi.gpap < gpap-notes2osm.sql > geopaparazzi.osm
Made by:
Francesco Frassinelli - https://frafra.eu
*/
with body as (
View gpap-notes2geojson.sql
/*
Description:
This query allows to convert notes from GeoPaparazzi into a GeoJSON
file that can be imported into JOSM.
Usage:
$ sqlite3 geopaparazzi.gpap < gpap-notes2geojson.sql > geopaparazzi.geojson
Made by:
Francesco Frassinelli - https://frafra.eu
*/
with osm as (
View schiena-dritta.py
#!/usr/bin/env python3
#
# License: GPLv3
# Author: Francesco Frassinelli (fraph24@gmail.com)
# Copyright: Francesco Frassinelli 2018
import gi
gi.require_version('Notify', '0.7')
from gi.repository import GLib, Notify