This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# first step takes about 1h 45m on my 4core VM and produces about 300MB output file. The second step is about 2.5m | |
# it counts housenumbers ending in a number and a single letter (e.g. '42b') and outputs frequency of those letters a-f | |
# for testing https://github.com/streetcomplete/StreetComplete/issues/5479#issuecomment-1937812748 | |
time pv -ptebar planet-240205.osm.bz2 | pbzip2 -dc | ag -F 'addr:housenumber' | zstd > housenumbers.xml.zstd | |
time pv housenumbers.xml.zstd | zstdmt -dc | perl -nE 'if (/^\s*<tag k="addr:housenumber"\sv="(.*?)\s*".*$/) { $n=$1; $a++ if $n=~/\da$/i; $b++ if $n=~/\db$/i; $c++ if $n=~/\dc$/i; $d++ if $n=~/\dd$/i; $e++ if $n=~/\de$/i; $f++ if $n=~/\df$/i;} END { say "a=$a\nb=$b\nc=$c\nd=$d\ne=$e\nf=$f\n" }' | |
# result: | |
#a=4593803 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Detecting StreetComplete AddShoulder corruption from SC/Zazolc 45.0-alpha1 | |
### or: using hacky shell commands for (rapid, but noncompliant XML) fun and profit | |
### See https://github.com/streetcomplete/StreetComplete/issues/4170 | |
% time pbzip2 -dc changesets-220815.osm.bz2 | env -i LC_ALL=C grep -B1 -A2 'StreetComplete:quest_type.*AddShoulder' > shoulder_quest.txt | |
pbzip2 -dc changesets-220815.osm.bz2 1579.50s user 14.95s system 379% cpu 7:00.41 total | |
env -i LC_ALL=C grep -B1 -A2 'StreetComplete:quest_type.*AddShoulder' > 47.80s user 10.19s system 13% cpu 7:00.40 total | |
% fgrep -c changeset shoulder_quest.txt | |
23333 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# by Matija Nalis <[email protected]> GPLv3+ 20211112 | |
# automatically kludge cdc_acm.ko for IrToy /dev/ttyACM0 usage "old-way" | |
# | |
#echo script: $0 | |
#echo params: "$@" | |
#echo env: | |
#env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /lib/modules/`uname -r`/kernel/drivers && \ | |
mv -n media/rc/ir_toy.ko media/rc/ir_toy.ko.DISABLED && \ | |
mv -n usb/class/cdc-acm.ko usb/class/cdc-acm.ko.DISABLED && \ | |
env -i sed -e 's/\xd8\x04\x08\xfd/\xff\x04\x08\xfd/' < usb/class/cdc-acm.ko.DISABLED > usb/class/cdc-acm.ko && \ | |
depmod -a | |
# reboot after doing the change. | |
# | |
# This changes blacklisting of USB ID `04d8:fd08` in cdc-acm, so IrToy gets recognized | |
# as it was in previous kernel versions, and `/dev/ttyACM0` gets created for it instead of `/dev/lirc0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -nE '$c.=$_; if (/^-----END/) { say "* file: $ARGV"; say `echo "$c" | openssl x509 -noout -subject -issuer -dates`; $c=""}' domain.crt zimbra_chain.crt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Matija Nalis 2021-02-25, MIT license | |
# Compares StreetComplete building descriptions to iD tag presets | |
# see https://github.com/streetcomplete/StreetComplete/issues/2588 | |
wget -q -N https://github.com/streetcomplete/StreetComplete/raw/master/app/src/main/java/de/westnordost/streetcomplete/quests/building_type/BuildingType.kt | |
fgrep '"building' BuildingType.kt | cut -f4 -d\" | sort -u > sc.tags | |
curl -s https://raw.githubusercontent.com/openstreetmap/id-tagging-schema/main/dist/presets.json | grep '"building": "[a-z]' | cut -f4 -d\"| sort -u > id.tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
matches=$(git diff --cached | grep -E '\+.*?FIXME') | |
if [ "$matches" != "" ] | |
then | |
echo "'FIXME' tag is detected." | |
echo "Please fix it before committing." | |
echo " ${matches}" | |
exit 1 |