Skip to content

Instantly share code, notes, and snippets.

@maxerickson
maxerickson / formatphone.sh
Last active February 21, 2022 22:12
Format Phone Number
#!/bin/bash
# use with Clipman
# Pattern: (?!\+1 \d{3} \d{3} \d{4}).{0,9}(\d{3}).{0,5}(\d{3}).{0,5}(\d{4}).{0,5}
# Command: /opt/formatphone.sh "+1 \1 \2 \3"
echo -n $1 | xclip -in -selection clipboard
193
144
Memorial Healthcare
826 West King Street Owosso 48867
Emergency Mismatch (CMS:no)
Memorial Healthcare
1. The Behavioral Center Of Michigan
4050 E 12 Mile Road Warren 48092 (CMS:no)
2.38 Saint John Macomb-Oakland Hospital, Warren
11800 East 12 Mile Road Warren 48093
@maxerickson
maxerickson / max.presets.xml
Created January 17, 2020 21:53
My josm presets file.
<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0">
<chunk id="gnis_cleaner">
<key key="ele" />
<key key="import_uuid" />
<key key="gnis:county_id" />
<key key="gnis:county_name" />
<key key="gnis:created" />
<key key="gnis:edited" />
<key key="gnis:feature_type" />
@maxerickson
maxerickson / USAddress.validator.mapcss
Last active March 7, 2020 14:20
JOSM validation rules for US addresses.
/* JOSM Validator rules for flagging potential issues with US addresses.*/
/* check addr:city for capitalization. */
*["addr:city"]["addr:city"!~/([A-Z][^\s]*)/]{
group: tr("US Address");
throwWarning: tr("Check capitalization of addr:city.");
}
*["addr:city"=~/,/]{
group: tr("US Address");
throwWarning: tr("Check addr:city for extra info.");
@maxerickson
maxerickson / RI.validator.mapcss
Last active June 16, 2019 18:07
Validation rules for surface tagging highways
way[highway=motorway][!surface],
way[highway=motorway_link][!surface],
way[highway=trunk][!surface],
way[highway=trunk_link][!surface],
way[highway=primary][!surface],
way[highway=primary_link][!surface],
way[highway=secondary][!surface],
way[highway=secondary_link][!surface],
way[highway=tertiary][!surface],
@maxerickson
maxerickson / osm_chunker.py
Last active February 5, 2020 01:05
Split an osm xml file into pieces of a given size, outputting reasonably compact, referentially complete chunks.
#!python3
import os.path
import argparse
import collections
import operator
import xml.etree.ElementTree as ElementTree
import geohash_hilbert
1 Fleming Ct
1 Simonton Cir
1 Truman Dr
1 Whitehead Cir
10 Fleming Ct
10 Gables Blvd
10 Key West Ct
10 Simonton Cir
10 Whitehead Cir
100 Bonaventure Blvd
name,phone,addr:housenumber,addr:street,addr:city,addr:state,addr:postcode,operator,isced:level,religion,denomination
Academy of International Studies,+1 313 873 9900,2609,Poland Street,Hamtramck,MI,48212,,0;1;2,,
Academy of Sacred Heart,+1 248 646 8900,1250,Kensington Rd,Bloomfield Hills,MI,48304,,0;1;2;3,christian,roman_catholic
Acton Academy Ann Arbor (A2),+1 734 788 2768,4115,Jackson Rd,Ann Arbor,MI,48103,,1,,
Ada Christian School,+1 616 676 1289,6206,Ada Dr Se,Ada,MI,49301,,0;1;2,christian,
Adams Christian School,+1 616 531 0748,5539,Byron Center Ave Sw,Wyoming,MI,49519,,0;1;2;3,,
Adelphian Junior Academy,+1 248 634 9481,740,Academy Rd,Holly,MI,48442,,0;1;2;3,christian,seventh_day_adventist
Aim High School,+1 248 702 6922,29230,12 Mile Road,Farmington Hills,MI,48334,,2;3,,
"Alderbrook School, Inc.",+1 248 731 7725,1050,E Square Lake Rd,Bloomfield Hills,MI,48304,,1;2;3,,
Al-Furqan Quran Academy,+1 313 584 4464,4430,Saint James St,Detroit,MI,48210,,0;1;2,,
Names:
Tractor Supply Company 312
Tractor Supply Co 28
Tractor Supply 46
Tractor Supply Co. 85
Tractor Supply Addition 1
Tractor Supply Company Distribution Center 1
Tractor Supply - Trailers 1
----------
Combinations:
Sweet Frog
('amenity', 'fast_food') 18
('amenity', 'ice_cream') 15
('amenity', 'restaurant') 15
('amenity', 'cafe') 3
sweetfrog frozen yogurt
('amenity', 'ice_cream') 1
SweetFrog
('amenity', 'cafe') 7
('amenity', 'fast_food') 7