Skip to content

Instantly share code, notes, and snippets.

View DavidMoraisFerreira's full-sized avatar
🐢

David Morais Ferreira DavidMoraisFerreira

🐢
View GitHub Profile
dmlu@errol:~/luxaddr$ cat /home/dmlu/luxaddr/update-addr-findings.sh
psql -A -F"," -P "footer=off" -d luxaddr > '/home/dmlu/public_html/luxaddr/no-match.csv' << EOF
COPY (
WITH osm_potential_addresses AS (
SELECT osm_id, tags->'osm_user' as osm_user, tags->'osm_uid' as osm_uid, tags->'osm_version' as osm_version, tags->'osm_timestamp' as osm_timestamp, concat('https://osm.org/way/' , osm_id) as url, "addr:housenumber", "addr:place", "addr:street", "addr:postcode", "addr:city", "addr:country", "ref:caclr", "note", "note:caclr", "fixme", way
FROM planet_osm_polygon
WHERE
"addr:housenumber" IS NOT NULL
AND "addr:street" IS NOT NULL
-- AND "addr:postcode" IS NOT NULL
@DavidMoraisFerreira
DavidMoraisFerreira / luxembourgish_citizen_without_familyname.sparql
Last active September 15, 2022 21:13
Find Luxembourgish citizens on Wikidata without a family name
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?human ?humanLabel (group_concat(?givennameLabel;separator=', ') as ?givenNames)
WHERE
{
?human wdt:P31 wd:Q5 ;
wdt:P27 wd:Q32 .
?human wdt:P735 ?givenname .
@DavidMoraisFerreira
DavidMoraisFerreira / extract-otp-codes-from-freeotp-export.sh
Last active January 27, 2022 21:11
Extract OTP codes and visualise them as QR codes from an encrypted FreeOTP ADB export
#!/bin/zsh
adb start-server
adb backup -f android-org.fedorahosted.freeotp.adb org.fedorahosted.freeotp
git clone https://github.com/nelenkov/android-backup-extractor.git
cd android-backup-extractor
./gradlew
export $ABE_PASSWD=<yourPasswordHereWithoutBrackets>
java -jar build/libs/abe-all.jar unpack android-org.fedorahosted.freeotp.adb android-org.fedorahosted.freeotp.tar
cd ..
git clone https://github.com/viljoviitanen/freeotp-export.git
@DavidMoraisFerreira
DavidMoraisFerreira / LuxembourgPaddedBoundary.geojson
Created January 28, 2022 11:28
Padded boundary of Luxembourg in GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DavidMoraisFerreira
DavidMoraisFerreira / osm-tools-setup.sh
Last active May 23, 2022 20:12
required packages for running osm-revert-scripts
git clone https://github.com/woodpeck/osm-revert-scripts.git
cd osm-revert-scripts
sudo zypper install perl perl-libwww-perl perl-File-HomeDir perl-LWP-Protocol-https
xargs -a nodes.txt -I{} -d'\n' perl redaction.pl apply XXX node {} "XXX"
@DavidMoraisFerreira
DavidMoraisFerreira / setup.sh
Last active July 31, 2022 09:25
quick notes
sudo zypper install git php7 nano zsh php-composer2 php7-dom php7-xmlwriter php7-tokenizer
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wget https://raw.githubusercontent.com/rupa/z/master/z.sh
chmod 755 z.sh
echo ". ~/z.sh" >> .zshrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install --lts
@DavidMoraisFerreira
DavidMoraisFerreira / luxembourgish_citizens_first_names_gender.sparql
Last active September 15, 2022 20:16
Retrieves a list of first names and gender for Luxembourgish citizens on Wikidata
#For a list of family names, change SELECT and GROUP BY
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?givenNameLabel ?genderLabel #?familyNameLabel
WHERE
{
?human wdt:P31 wd:Q5 ;
wdt:P27 wd:Q32 .