Skip to content

Instantly share code, notes, and snippets.

View frafra's full-sized avatar

Francesco Frassinelli frafra

View GitHub Profile
@frafra
frafra / fake-usb-tester.py
Last active May 11, 2018 20:12
Detect fake USB drives
#!/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
@frafra
frafra / tags.json
Created April 6, 2018 13:19
addr:street/addr:housenumber simple preset for GeoPaparazzi
[{
"sectionname": "addresses",
"sectiondescription": "addresses",
"forms": [{
"formname": "address",
"formitems": [{
"key": "addr:street",
"value": "",
"type": "string",
"mandatory": "no"
@frafra
frafra / gpap-notes2osm.sql
Last active April 6, 2018 20:50
From GeoPaparazzi notes to OpenStreetMap XML
/*
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 (
@frafra
frafra / gpap-notes2geojson.sql
Last active April 6, 2018 20:50
From GeoPaparazzi notes to OpenStreetMap through GeoJSON
/*
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 (
@frafra
frafra / schiena-dritta.py
Last active January 17, 2018 17:10
Simple adaptive notification system
#!/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
@frafra
frafra / inkscape-devel.md
Created December 8, 2017 16:27
inkscape-devel on Fedora 27

How to install Inkscape devel on Fedora 27

Installation

# dnf build-dep inkscape
# dnf install gcc-c++ libsoup-devel gtkmm30-devel
$ git clone -b master https://git.launchpad.net/inkscape --depth 1
$ mkdir -p inkscape/build/conf
$ cd inkscape
@frafra
frafra / poliadventures-17december.md
Last active November 16, 2018 08:08
Quests - December 2017 #PoliMappersAdventures

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 October 8, 2018 07:49
OSM node history to SQLite
#!/usr/bin/env python3
#
# OSM node history to SQLite
import osmium
import sqlite3
import sys
SCHEMA_OBJECT = """
@frafra
frafra / osm-node-history.py
Last active February 23, 2018 10:19
OSM node history (just a test)
#!/usr/bin/env python3
#
# OSM node history to SQLite
import osmium
import sqlite3
import sys
SCHEMA_NODES = """
CREATE TABLE nodes
@frafra
frafra / posta2csv.py
Created October 8, 2017 19:22
posta2csv.py
#!/usr/bin/env python3
#
# Convertitore delle mail del Raspberry Pi di Ugone
# Scritto da Frafra (2017)
import collections
import csv
import glob
messages = glob.glob('messaggi/*.txt')