Skip to content

Instantly share code, notes, and snippets.

@sruf
sruf / overpass.ql
Created January 6, 2023 08:02
Administrative boundaries for SSD from OpenStreetMap
[out:json]
[timeout:90]
;
( area[name="South Sudan"]; )->.searchArea;
relation
["admin_level"~"^[2,4,5]$"]
["type"="boundary"]
(area.searchArea);
(._;>;);
/**
* Geocode address using Google Maps
*
* @param address the address to geocode
* @return the geocoded address (possibly approximate)
*/
function GEOCODE(address) {
var location = Maps.newGeocoder().geocode(address).results[0].geometry.location;
return [[location.lat, location.lng]];
}
@sruf
sruf / Country lookup by country code
Last active May 11, 2024 03:24
Country lookup by country code
=IF(ISNA(VLOOKUP(LEFT(A1,8),'Country codes'!A:B,2,FALSE)),
IF(ISNA(VLOOKUP(LEFT(A1,7),'Country codes'!A:B,2,FALSE)),
IF(ISNA(VLOOKUP(LEFT(A1,6),'Country codes'!A:B,2,FALSE)),
IF(ISNA(VLOOKUP(LEFT(A1,5),'Country codes'!A:B,2,FALSE)),
IF(ISNA(VLOOKUP(LEFT(A1,4),'Country codes'!A:B,2,FALSE)),
IF(ISNA(VLOOKUP(LEFT(A1,3),'Country codes'!A:B,2,FALSE)),
IF(ISNA(VLOOKUP(LEFT(A1,2),'Country codes'!A:B,2,FALSE)),,
VLOOKUP(LEFT(A1,2),'Country codes'!A:B,2,FALSE)),
VLOOKUP(LEFT(A1,3),'Country codes'!A:B,2,FALSE)),
VLOOKUP(LEFT(A1,4),'Country codes'!A:B,2,FALSE)),
@sruf
sruf / uberspace-firstsetup.sh
Last active May 26, 2018 17:23
Uberspace first setup
git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
~/.bash_it/install.sh
ln -s /var/www/virtual/${USER} ~/virtual
uberspace-setup-svscan
uberspace-setup-mongodb
@sruf
sruf / uberspace-redis.sh
Last active January 18, 2017 21:03
Persönliche Uberspace Einstellungen
uberspace-setup-redis
@sruf
sruf / ezmlm.sh
Last active December 17, 2016 14:07
ezmlm-idx Konfiguration bei Uberspace
# ezmlm Mailing Liste auf Uberspace anlegen. Mit Infos auf Deutsch. Nachrichten von fremden E-Mails werden moderiert, solche von Subscribern durchgelassen.
cd ~
mkdir ezmlm
ezmlm-make -dghijSum -5 list@domain.tld -C /etc/ezmlm/de ~/ezmlm/list ~/.qmail-list list domain.tld
echo '[SUBJECT PREFIX]' > ~/ezmlm/list/prefix
# Damit Antworten auf Mailinglisten-Emails standardmäßig an die Mailingliste gehen (und nicht an den ursprünglichen Absender) - Achtung: nicht Standardkonform
echo 'reply-to' >> ~/ezmlm/list/headerremove # reply-to header von eingehender Nachricht entfernen
echo 'Reply-To: <#l#>@<#h#>' >> ~/ezmlm/list/headeradd # Mailinglist-Email-Adresse als reply-to header an ausgehende Nachrichten hinzufügen
@sruf
sruf / restore-files-from-sourcemap.js
Created November 7, 2016 20:13
Restore files from Sourcemap contents
/*
I needed a way to restore the actual files from a Sourcemap. This is the easiest way I could come up with.
To use, replace the content of map with your actual sourcemap -- however, be careful to check the paths, as this script might overwrite anything in its way.
*/
/*
MIT License
Copyright (c) 2016 Simon Ruf