[tarent-useful-scripts SCM] {mirkarte} branch master updated. a4f2db1706b5daabbea18edd73c9dfd1053b83a9

mirabilos at evolvis.org mirabilos at evolvis.org
Wed Aug 20 00:44:04 CEST 2014 • <20140819224404.159B24A24EF@evolvis.org>


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MirKarte source code repository".

The branch, master has been updated
       via  a4f2db1706b5daabbea18edd73c9dfd1053b83a9 (commit)
       via  6c9a5b8902063bdda408f325809fe8926a8b917f (commit)
      from  d30f345f03c641b9814c977bc89b3864386931a6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a4f2db1706b5daabbea18edd73c9dfd1053b83a9
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Aug 19 22:44:17 2014 +0000

    wiki links for the graticules

commit 6c9a5b8902063bdda408f325809fe8926a8b917f
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Tue Aug 19 22:18:45 2014 +0000

    fix -0 vs 0

-----------------------------------------------------------------------

Summary of changes:
 geohashing.cgi |  328 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 xkcd2js.sh     |   93 ++++++++++++++++
 2 files changed, 407 insertions(+), 14 deletions(-)
 create mode 100644 xkcd2js.sh

diff --git a/geohashing.cgi b/geohashing.cgi
index 458bc0b..420c7fa 100755
--- a/geohashing.cgi
+++ b/geohashing.cgi
@@ -176,6 +176,8 @@ function mjd_implode {
 
 # end magic from mirtime.c
 
+# force hash to use Central European Time (possibly with DST)
+# for calculation, and always apply the 30W rule
 set -A d -- $(TZ=Europe/Berlin date +'%Y %m %d %F')
 set -A t -- $(mjd_implode 0 0 0 ${d[2]} $((d[1] - 1)) $((d[0] - 1900)))
 set -A t -- $(mjd_explode $((t[0] - 1)) 0)
@@ -200,7 +202,7 @@ Content-type: text/html; charset=utf-8
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="copyright" content="see mirkarte.js" />
- <title>MirKarte for xkcd Geo Hashing (Beta)</title>
+ <title>MirKarte for xkcd Geo Hashing in Central Europe (Beta)</title>
  <link rel="stylesheet" type="text/css" href="leaflet/leaflet.css" />
  <style type="text/css"><!--/*--><![CDATA[/*><!--*/
   #nomap {
@@ -245,28 +247,326 @@ Content-type: text/html; charset=utf-8
  <script type="text/javascript" src="zip.js/WebContent/zip.js"></script>
  <script type="text/javascript"><!--//--><![CDATA[//><!--
   zip.workerScriptsPath = "zip.js/WebContent/";
-  var geohashing_points = [
+  var graticules = [
+	/* BEGIN generated file from xkcd2js.sh */
+	["42", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Ponferrada,_Spain\">Ponferrada, Spain</a>"],
+	["42", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Le%C3%B3n,_Spain\">León, Spain</a>"],
+	["42", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Palencia,_Spain\">Palencia, Spain</a>"],
+	["42", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Burgos,_Spain\">Burgos, Spain</a>"],
+	["42", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Vitoria-Gasteiz,_Spain\">Vitoria-Gasteiz, Spain</a>"],
+	["42", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Pamplona,_Spain\">Pamplona, Spain</a>"],
+	["42", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Huesca,_Spain\">Huesca, Spain</a>"],
+	["42", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Barbastro,_Spain\">Barbastro, Spain</a>"],
+	["42", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Andorra\">Andorra</a>"],
+	["42", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Perpignan,_France\">Perpignan, France</a>"],
+	["42", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Roses,_Spain\">Roses, Spain</a>"],
+	["42", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Mediterranean_Sea_42,_4\">Mediterranean Sea 42, 4</a>"],
+	["42", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Mediterranean_Sea_42,_5\">Mediterranean Sea 42, 5</a>"],
+	["42", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Porquerolles,_France\">Porquerolles, France</a>"],
+	["42", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Mediterranean_Sea_42,_7\">Mediterranean Sea 42, 7</a>"],
+	["42", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Calvi,_France\">Calvi, France</a>"],
+	["42", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Bastia,_France\">Bastia, France</a>"],
+	["42", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Piombino,_Italy\">Piombino, Italy</a>"],
+	["42", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Grosseto,_Italy\">Grosseto, Italy</a>"],
+	["42", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Terni,_Italy\">Terni, Italy</a>"],
+	["43", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Vald%C3%A9s,_Spain\">Valdés, Spain</a>"],
+	["43", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Gij%C3%B3n,_Spain\">Gijón, Spain</a>"],
+	["43", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Torrelavega,_Spain\">Torrelavega, Spain</a>"],
+	["43", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Santander,_Spain\">Santander, Spain</a>"],
+	["43", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Bilbao,_Spain\">Bilbao, Spain</a>"],
+	["43", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Bayonne,_France\">Bayonne, France</a>"],
+	["43", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Pau,_France\">Pau, France</a>"],
+	["43", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Tarbes,_France\">Tarbes, France</a>"],
+	["43", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Toulouse,_France\">Toulouse, France</a>"],
+	["43", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Carcassonne,_France\">Carcassonne, France</a>"],
+	["43", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Montpellier,_France\">Montpellier, France</a>"],
+	["43", "4", "<a href=\"http://wiki.xkcd.com/geohashing/N%C3%AEmes,_France\">Nîmes, France</a>"],
+	["43", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Marseille,_France\">Marseille, France</a>"],
+	["43", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Draguignan,_France\">Draguignan, France</a>"],
+	["43", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Nice,_France\">Nice, France</a>"],
+	["43", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Imperia,_Italy\">Imperia, Italy</a>"],
+	["43", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Capraia,_Italy\">Capraia, Italy</a>"],
+	["43", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Livorno,_Italy\">Livorno, Italy</a>"],
+	["43", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Firenze,_Italy\">Firenze, Italy</a>"],
+	["43", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Perugia,_Italy\">Perugia, Italy</a>"],
+	["44", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_44,_-6\">Bay of Biscay 44, -6</a>"],
+	["44", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_44,_-5\">Bay of Biscay 44, -5</a>"],
+	["44", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_44,_-4\">Bay of Biscay 44, -4</a>"],
+	["44", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_44,_-3\">Bay of Biscay 44, -3</a>"],
+	["44", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_44,_-2\">Bay of Biscay 44, -2</a>"],
+	["44", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Arcachon,_France\">Arcachon, France</a>"],
+	["44", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Bordeaux,_France\">Bordeaux, France</a>"],
+	["44", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Bergerac,_France\">Bergerac, France</a>"],
+	["44", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Montauban,_France\">Montauban, France</a>"],
+	["44", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Aurillac,_France\">Aurillac, France</a>"],
+	["44", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Millau,_France\">Millau, France</a>"],
+	["44", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Valence,_France\">Valence, France</a>"],
+	["44", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Carpentras,_France\">Carpentras, France</a>"],
+	["44", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Gap,_France\">Gap, France</a>"],
+	["44", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Cuneo,_Italy\">Cuneo, Italy</a>"],
+	["44", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Genova,_Italy\">Genova, Italy</a>"],
+	["44", "9", "<a href=\"http://wiki.xkcd.com/geohashing/La_Spezia,_Italy\">La Spezia, Italy</a>"],
+	["44", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Parma,_Italy\">Parma, Italy</a>"],
+	["44", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Bologna,_Italy\">Bologna, Italy</a>"],
+	["44", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Ravenna,_Italy\">Ravenna, Italy</a>"],
+	["45", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_45,_-6\">Atlantic Ocean 45, -6</a>"],
+	["45", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_45,_-5\">Bay of Biscay 45, -5</a>"],
+	["45", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_45,_-4\">Bay of Biscay 45, -4</a>"],
+	["45", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_45,_-3\">Bay of Biscay 45, -3</a>"],
+	["45", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_45,_-2\">Bay of Biscay 45, -2</a>"],
+	["45", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Royan,_France\">Royan, France</a>"],
+	["45", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Saintes,_France\">Saintes, France</a>"],
+	["45", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Angoul%C3%AAme,_France\">Angoulême, France</a>"],
+	["45", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Limoges,_France\">Limoges, France</a>"],
+	["45", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Ussel,_France\">Ussel, France</a>"],
+	["45", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Clermont-Ferrand,_France\">Clermont-Ferrand, France</a>"],
+	["45", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Lyon,_France\">Lyon, France</a>"],
+	["45", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Grenoble,_France\">Grenoble, France</a>"],
+	["45", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Annecy,_France\">Annecy, France</a>"],
+	["45", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Torino,_Italy\">Torino, Italy</a>"],
+	["45", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Novara,_Italy\">Novara, Italy</a>"],
+	["45", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Milano,_Italy\">Milano, Italy</a>"],
+	["45", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Verona,_Italy\">Verona, Italy</a>"],
+	["45", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Padova,_Italy\">Padova, Italy</a>"],
+	["45", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Venezia,_Italy\">Venezia, Italy</a>"],
+	["46", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_46,_-6\">Atlantic Ocean 46, -6</a>"],
+	["46", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_46,_-5\">Bay of Biscay 46, -5</a>"],
+	["46", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_46,_-4\">Bay of Biscay 46, -4</a>"],
+	["46", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Bay_of_Biscay_46,_-3\">Bay of Biscay 46, -3</a>"],
+	["46", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/L%27%C3%8Ele-d%27Yeu,_France\">L'Île-d'Yeu, France</a>"],
+	["46", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/La_Roche-sur-Yon,_France\">La Roche-sur-Yon, France</a>"],
+	["46", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Niort,_France\">Niort, France</a>"],
+	["46", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Poitiers,_France\">Poitiers, France</a>"],
+	["46", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Ch%C3%A2teauroux,_France\">Châteauroux, France</a>"],
+	["46", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Montlu%C3%A7on,_France\">Montluçon, France</a>"],
+	["46", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Nevers,_France\">Nevers, France</a>"],
+	["46", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Chalon-sur-Sa%C3%B4ne,_France\">Chalon-sur-Saône, France</a>"],
+	["46", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Bourg-en-Bresse,_France\">Bourg-en-Bresse, France</a>"],
+	["46", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Gen%C3%A8ve,_Switzerland\">Genève, Switzerland</a>"],
+	["46", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Bern,_Switzerland\">Bern, Switzerland</a>"],
+	["46", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Lugano,_Switzerland\">Lugano, Switzerland</a>"],
+	["46", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Chur,_Switzerland\">Chur, Switzerland</a>"],
+	["46", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Livigno,_Italy\">Livigno, Italy</a>"],
+	["46", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Trento,_Italy\">Trento, Italy</a>"],
+	["46", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Belluno,_Italy\">Belluno, Italy</a>"],
+	["47", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_47,_-6\">Atlantic Ocean 47, -6</a>"],
+	["47", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_47,_-5\">Atlantic Ocean 47, -5</a>"],
+	["47", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Quimper,_France\">Quimper, France</a>"],
+	["47", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Lorient,_France\">Lorient, France</a>"],
+	["47", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Vannes,_France\">Vannes, France</a>"],
+	["47", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Nantes,_France\">Nantes, France</a>"],
+	["47", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Angers,_France\">Angers, France</a>"],
+	["47", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Tours,_France\">Tours, France</a>"],
+	["47", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Orl%C3%A9ans,_France\">Orléans, France</a>"],
+	["47", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Bourges,_France\">Bourges, France</a>"],
+	["47", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Auxerre,_France\">Auxerre, France</a>"],
+	["47", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Beaune,_France\">Beaune, France</a>"],
+	["47", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Dijon,_France\">Dijon, France</a>"],
+	["47", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Besan%C3%A7on,_France\">Besançon, France</a>"],
+	["47", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Basel,_Switzerland\">Basel, Switzerland</a>"],
+	["47", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Z%C3%BCrich,_Switzerland\">Zürich, Switzerland</a>"],
+	["47", "9", "<a href=\"http://wiki.xkcd.com/geohashing/St._Gallen,_Switzerland\">St. Gallen, Switzerland</a>"],
+	["47", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Kempten,_Germany\">Kempten, Germany</a>"],
+	["47", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Innsbruck,_Austria\">Innsbruck, Austria</a>"],
+	["47", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Rosenheim,_Germany\">Rosenheim, Germany</a>"],
+	["48", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_48,_-6\">Atlantic Ocean 48, -6</a>"],
+	["48", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Ouessant,_France\">Ouessant, France</a>"],
+	["48", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Brest,_France\">Brest, France</a>"],
+	["48", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Lannion,_France\">Lannion, France</a>"],
+	["48", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Saint-Brieuc,_France\">Saint-Brieuc, France</a>"],
+	["48", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Rennes,_France\">Rennes, France</a>"],
+	["48", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Laval,_France\">Laval, France</a>"],
+	["48", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Le_Mans,_France\">Le Mans, France</a>"],
+	["48", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Chartres,_France\">Chartres, France</a>"],
+	["48", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Paris,_France\">Paris, France</a>"],
+	["48", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Sens,_France\">Sens, France</a>"],
+	["48", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Troyes,_France\">Troyes, France</a>"],
+	["48", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Chaumont,_France\">Chaumont, France</a>"],
+	["48", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Nancy,_France\">Nancy, France</a>"],
+	["48", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Strasbourg,_France\">Strasbourg, France</a>"],
+	["48", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Pforzheim,_Germany\">Pforzheim, Germany</a>"],
+	["48", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Stuttgart,_Germany\">Stuttgart, Germany</a>"],
+	["48", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Augsburg,_Germany\">Augsburg, Germany</a>"],
+	["48", "11", "<a href=\"http://wiki.xkcd.com/geohashing/M%C3%BCnchen,_Germany\">München, Germany</a>"],
+	["48", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Landshut,_Germany\">Landshut, Germany</a>"],
+	["49", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Isles_of_Scilly,_United_Kingdom\">Isles of Scilly, United Kingdom</a>"],
+	["49", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Lizard_Point,_United_Kingdom\">Lizard Point, United Kingdom</a>"],
+	["49", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/English_Channel_49,_-4\">English Channel 49, -4</a>"],
+	["49", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/English_Channel_49,_-3\">English Channel 49, -3</a>"],
+	["49", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Channel_Islands\">Channel Islands</a>"],
+	["49", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Cherbourg,_France\">Cherbourg, France</a>"],
+	["49", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Caen,_France\">Caen, France</a>"],
+	["49", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Le_Havre,_France\">Le Havre, France</a>"],
+	["49", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Rouen,_France\">Rouen, France</a>"],
+	["49", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Amiens,_France\">Amiens, France</a>"],
+	["49", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Saint-Quentin,_France\">Saint-Quentin, France</a>"],
+	["49", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Reims,_France\">Reims, France</a>"],
+	["49", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Verdun,_France\">Verdun, France</a>"],
+	["49", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Luxembourg,_Luxembourg\">Luxembourg, Luxembourg</a>"],
+	["49", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Kaiserslautern,_Germany\">Kaiserslautern, Germany</a>"],
+	["49", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Mannheim,_Germany\">Mannheim, Germany</a>"],
+	["49", "9", "<a href=\"http://wiki.xkcd.com/geohashing/W%C3%BCrzburg,_Germany\">Würzburg, Germany</a>"],
+	["49", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Bamberg,_Germany\">Bamberg, Germany</a>"],
+	["49", "11", "<a href=\"http://wiki.xkcd.com/geohashing/N%C3%BCrnberg,_Germany\">Nürnberg, Germany</a>"],
+	["49", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Regensburg,_Germany\">Regensburg, Germany</a>"],
+	["50", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_50,_-6\">Atlantic Ocean 50, -6</a>"],
+	["50", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Camborne,_United_Kingdom\">Camborne, United Kingdom</a>"],
+	["50", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Plymouth,_United_Kingdom\">Plymouth, United Kingdom</a>"],
+	["50", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Exeter,_United_Kingdom\">Exeter, United Kingdom</a>"],
+	["50", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Weymouth,_United_Kingdom\">Weymouth, United Kingdom</a>"],
+	["50", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Southampton,_United_Kingdom\">Southampton, United Kingdom</a>"],
+	["50", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Brighton,_United_Kingdom\">Brighton, United Kingdom</a>"],
+	["50", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Eastbourne,_United_Kingdom\">Eastbourne, United Kingdom</a>"],
+	["50", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Calais,_France\">Calais, France</a>"],
+	["50", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Arras,_France\">Arras, France</a>"],
+	["50", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Lille,_France\">Lille, France</a>"],
+	["50", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Bruxelles,_Belgium\">Bruxelles, Belgium</a>"],
+	["50", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Li%C3%A8ge,_Belgium\">Liège, Belgium</a>"],
+	["50", "6", "<a href=\"http://wiki.xkcd.com/geohashing/K%C3%B6ln,_Germany\">Köln, Germany</a>"],
+	["50", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Bonn,_Germany\">Bonn, Germany</a>"],
+	["50", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Frankfurt_am_Main,_Germany\">Frankfurt am Main, Germany</a>"],
+	["50", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Fulda,_Germany\">Fulda, Germany</a>"],
+	["50", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Schweinfurt,_Germany\">Schweinfurt, Germany</a>"],
+	["50", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Erfurt,_Germany\">Erfurt, Germany</a>"],
+	["50", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Chemnitz,_Germany\">Chemnitz, Germany</a>"],
+	["51", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Atlantic_Ocean_51,_-6\">Atlantic Ocean 51, -6</a>"],
+	["51", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Milford_Haven,_United_Kingdom\">Milford Haven, United Kingdom</a>"],
+	["51", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Barnstaple,_United_Kingdom\">Barnstaple, United Kingdom</a>"],
+	["51", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Cardiff,_United_Kingdom\">Cardiff, United Kingdom</a>"],
+	["51", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Bristol,_United_Kingdom\">Bristol, United Kingdom</a>"],
+	["51", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Swindon,_United_Kingdom\">Swindon, United Kingdom</a>"],
+	["51", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/London_West,_United_Kingdom\">London West, United Kingdom</a>"],
+	["51", "0", "<a href=\"http://wiki.xkcd.com/geohashing/London_East,_United_Kingdom\">London East, United Kingdom</a>"],
+	["51", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Canterbury,_United_Kingdom\">Canterbury, United Kingdom</a>"],
+	["51", "2", "<a href=\"http://wiki.xkcd.com/geohashing/Dunkerque,_France\">Dunkerque, France</a>"],
+	["51", "3", "<a href=\"http://wiki.xkcd.com/geohashing/Gent,_Belgium\">Gent, Belgium</a>"],
+	["51", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Rotterdam,_Netherlands\">Rotterdam, Netherlands</a>"],
+	["51", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Eindhoven,_Netherlands\">Eindhoven, Netherlands</a>"],
+	["51", "6", "<a href=\"http://wiki.xkcd.com/geohashing/D%C3%BCsseldorf,_Germany\">Düsseldorf, Germany</a>"],
+	["51", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Dortmund,_Germany\">Dortmund, Germany</a>"],
+	["51", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Paderborn,_Germany\">Paderborn, Germany</a>"],
+	["51", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Kassel,_Germany\">Kassel, Germany</a>"],
+	["51", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Nordhausen,_Germany\">Nordhausen, Germany</a>"],
+	["51", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Halle_(Saale),_Germany\">Halle (Saale), Germany</a>"],
+	["51", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Leipzig,_Germany\">Leipzig, Germany</a>"],
+	["52", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Carlow,_Ireland\">Carlow, Ireland</a>"],
+	["52", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Fishguard,_United_Kingdom\">Fishguard, United Kingdom</a>"],
+	["52", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Aberystwyth,_United_Kingdom\">Aberystwyth, United Kingdom</a>"],
+	["52", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Mid_Wales,_United_Kingdom\">Mid Wales, United Kingdom</a>"],
+	["52", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Shrewsbury,_United_Kingdom\">Shrewsbury, United Kingdom</a>"],
+	["52", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Birmingham,_United_Kingdom\">Birmingham, United Kingdom</a>"],
+	["52", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Northampton,_United_Kingdom\">Northampton, United Kingdom</a>"],
+	["52", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Cambridge,_United_Kingdom\">Cambridge, United Kingdom</a>"],
+	["52", "1", "<a href=\"http://wiki.xkcd.com/geohashing/Norwich,_United_Kingdom\">Norwich, United Kingdom</a>"],
+	["52", "2", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_52,_2\">North Sea 52, 2</a>"],
+	["52", "3", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_52,_3\">North Sea 52, 3</a>"],
+	["52", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Amsterdam,_Netherlands\">Amsterdam, Netherlands</a>"],
+	["52", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Utrecht,_Netherlands\">Utrecht, Netherlands</a>"],
+	["52", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Enschede,_Netherlands\">Enschede, Netherlands</a>"],
+	["52", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Rheine,_Germany\">Rheine, Germany</a>"],
+	["52", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Bielefeld,_Germany\">Bielefeld, Germany</a>"],
+	["52", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Hannover,_Germany\">Hannover, Germany</a>"],
+	["52", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Braunschweig,_Germany\">Braunschweig, Germany</a>"],
+	["52", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Magdeburg,_Germany\">Magdeburg, Germany</a>"],
+	["52", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Brandenburg,_Germany\">Brandenburg, Germany</a>"],
+	["53", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Dublin,_Ireland\">Dublin, Ireland</a>"],
+	["53", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Irish_Sea_53,_-5\">Irish Sea 53, -5</a>"],
+	["53", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Anglesey,_United_Kingdom\">Anglesey, United Kingdom</a>"],
+	["53", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Blackpool,_United_Kingdom\">Blackpool, United Kingdom</a>"],
+	["53", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Manchester,_United_Kingdom\">Manchester, United Kingdom</a>"],
+	["53", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Sheffield,_United_Kingdom\">Sheffield, United Kingdom</a>"],
+	["53", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Hull,_United_Kingdom\">Hull, United Kingdom</a>"],
+	["53", "0", "<a href=\"http://wiki.xkcd.com/geohashing/Skegness,_United_Kingdom\">Skegness, United Kingdom</a>"],
+	["53", "1", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_53,_1\">North Sea 53, 1</a>"],
+	["53", "2", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_53,_2\">North Sea 53, 2</a>"],
+	["53", "3", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_53,_3\">North Sea 53, 3</a>"],
+	["53", "4", "<a href=\"http://wiki.xkcd.com/geohashing/Texel,_Netherlands\">Texel, Netherlands</a>"],
+	["53", "5", "<a href=\"http://wiki.xkcd.com/geohashing/Leeuwarden,_Netherlands\">Leeuwarden, Netherlands</a>"],
+	["53", "6", "<a href=\"http://wiki.xkcd.com/geohashing/Groningen,_Netherlands\">Groningen, Netherlands</a>"],
+	["53", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Emden,_Germany\">Emden, Germany</a>"],
+	["53", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Bremen,_Germany\">Bremen, Germany</a>"],
+	["53", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Hamburg_(West),_Germany\">Hamburg (West), Germany</a>"],
+	["53", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Hamburg_(East),_Germany\">Hamburg (East), Germany</a>"],
+	["53", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Schwerin,_Germany\">Schwerin, Germany</a>"],
+	["53", "12", "<a href=\"http://wiki.xkcd.com/geohashing/G%C3%BCstrow,_Germany\">Güstrow, Germany</a>"],
+	["54", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Lisburn,_United_Kingdom\">Lisburn, United Kingdom</a>"],
+	["54", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Belfast,_United_Kingdom\">Belfast, United Kingdom</a>"],
+	["54", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Isle_of_Man\">Isle of Man</a>"],
+	["54", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Barrow-in-Furness,_United_Kingdom\">Barrow-in-Furness, United Kingdom</a>"],
+	["54", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Carlisle,_United_Kingdom\">Carlisle, United Kingdom</a>"],
+	["54", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Middlesbrough,_United_Kingdom\">Middlesbrough, United Kingdom</a>"],
+	["54", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/Scarborough,_United_Kingdom\">Scarborough, United Kingdom</a>"],
+	["54", "0", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_0\">North Sea 54, 0</a>"],
+	["54", "1", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_1\">North Sea 54, 1</a>"],
+	["54", "2", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_2\">North Sea 54, 2</a>"],
+	["54", "3", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_3\">North Sea 54, 3</a>"],
+	["54", "4", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_4\">North Sea 54, 4</a>"],
+	["54", "5", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_5\">North Sea 54, 5</a>"],
+	["54", "6", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_54,_6\">North Sea 54, 6</a>"],
+	["54", "7", "<a href=\"http://wiki.xkcd.com/geohashing/Helgoland,_Germany\">Helgoland, Germany</a>"],
+	["54", "8", "<a href=\"http://wiki.xkcd.com/geohashing/T%C3%B8nder,_Denmark\">Tønder, Denmark</a>"],
+	["54", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Flensburg,_Germany\">Flensburg, Germany</a>"],
+	["54", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Kiel,_Germany\">Kiel, Germany</a>"],
+	["54", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Nyk%C3%B8bing_Falster,_Denmark\">Nykøbing Falster, Denmark</a>"],
+	["54", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Rostock,_Germany\">Rostock, Germany</a>"],
+	["55", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Coleraine,_United_Kingdom\">Coleraine, United Kingdom</a>"],
+	["55", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Campbeltown,_United_Kingdom\">Campbeltown, United Kingdom</a>"],
+	["55", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Glasgow,_United_Kingdom\">Glasgow, United Kingdom</a>"],
+	["55", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Edinburgh,_United_Kingdom\">Edinburgh, United Kingdom</a>"],
+	["55", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Jedburgh,_United_Kingdom\">Jedburgh, United Kingdom</a>"],
+	["55", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/Blyth,_United_Kingdom\">Blyth, United Kingdom</a>"],
+	["55", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_-0\">North Sea 55, -0</a>"],
+	["55", "0", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_0\">North Sea 55, 0</a>"],
+	["55", "1", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_1\">North Sea 55, 1</a>"],
+	["55", "2", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_2\">North Sea 55, 2</a>"],
+	["55", "3", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_3\">North Sea 55, 3</a>"],
+	["55", "4", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_4\">North Sea 55, 4</a>"],
+	["55", "5", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_5\">North Sea 55, 5</a>"],
+	["55", "6", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_6\">North Sea 55, 6</a>"],
+	["55", "7", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_55,_7\">North Sea 55, 7</a>"],
+	["55", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Esbjerg,_Denmark\">Esbjerg, Denmark</a>"],
+	["55", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Kolding,_Denmark\">Kolding, Denmark</a>"],
+	["55", "10", "<a href=\"http://wiki.xkcd.com/geohashing/Odense,_Denmark\">Odense, Denmark</a>"],
+	["55", "11", "<a href=\"http://wiki.xkcd.com/geohashing/N%C3%A6stved,_Denmark\">Næstved, Denmark</a>"],
+	["55", "12", "<a href=\"http://wiki.xkcd.com/geohashing/K%C3%B8benhavn,_Denmark\">København, Denmark</a>"],
+	["56", "-6", "<a href=\"http://wiki.xkcd.com/geohashing/Tobermory,_United_Kingdom\">Tobermory, United Kingdom</a>"],
+	["56", "-5", "<a href=\"http://wiki.xkcd.com/geohashing/Oban,_United_Kingdom\">Oban, United Kingdom</a>"],
+	["56", "-4", "<a href=\"http://wiki.xkcd.com/geohashing/Helensburgh,_United_Kingdom\">Helensburgh, United Kingdom</a>"],
+	["56", "-3", "<a href=\"http://wiki.xkcd.com/geohashing/Perth,_United_Kingdom\">Perth, United Kingdom</a>"],
+	["56", "-2", "<a href=\"http://wiki.xkcd.com/geohashing/Dundee,_United_Kingdom\">Dundee, United Kingdom</a>"],
+	["56", "-1", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_-1\">North Sea 56, -1</a>"],
+	["56", "-0", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_-0\">North Sea 56, -0</a>"],
+	["56", "0", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_0\">North Sea 56, 0</a>"],
+	["56", "1", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_1\">North Sea 56, 1</a>"],
+	["56", "2", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_2\">North Sea 56, 2</a>"],
+	["56", "3", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_3\">North Sea 56, 3</a>"],
+	["56", "4", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_4\">North Sea 56, 4</a>"],
+	["56", "5", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_5\">North Sea 56, 5</a>"],
+	["56", "6", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_6\">North Sea 56, 6</a>"],
+	["56", "7", "<a href=\"http://wiki.xkcd.com/geohashing/North_Sea_56,_7\">North Sea 56, 7</a>"],
+	["56", "8", "<a href=\"http://wiki.xkcd.com/geohashing/Herning,_Denmark\">Herning, Denmark</a>"],
+	["56", "9", "<a href=\"http://wiki.xkcd.com/geohashing/Silkeborg,_Denmark\">Silkeborg, Denmark</a>"],
+	["56", "10", "<a href=\"http://wiki.xkcd.com/geohashing/%C3%85rhus,_Denmark\">Århus, Denmark</a>"],
+	["56", "11", "<a href=\"http://wiki.xkcd.com/geohashing/Anholt,_Denmark\">Anholt, Denmark</a>"],
+	["56", "12", "<a href=\"http://wiki.xkcd.com/geohashing/Helsingborg,_Sweden\">Helsingborg, Sweden</a>"],
+	["666", "666", ""]
+	/* END generated file from xkcd2js.sh */
+  ];
 EOF
-
-for lat in 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56; do
-	for lon in -6 -5 -4 -3 -2 -1 -0 1 2 3 4 5 6 7 8 9 10 11 12; do
-		print "	[${lat}${latlon[0]}, ${lon}${latlon[1]}],"
-	done
-done
-
+print "  var geohashing_offset = [\"${latlon[0]}\", \"${latlon[1]}\"];"
 cat <<'EOF'
-	[0, 0] // to please strict syntax, and sentinel
-  ];
 
   function mirkarte_hookfn(map) {
 	var i = 0;
 
-	while (geohashing_points[i][0] || geohashing_points[i][1]) {
-		var ghmarker = L.marker(geohashing_points[i], {
+	while (graticules[i][0] != "666") {
+		var ghlat = parseFloat(graticules[i][0] + geohashing_offset[0]);
+		var ghlon = parseFloat(graticules[i][1] + geohashing_offset[1]);
+		var ghmarker = L.marker([ghlat, ghlon], {
 			"draggable": false
 		    }).addTo(map);
 		marker_popup(ghmarker,
-		    'Geo Hashing Point<br />°N<br />°E');
+		    'Geo Hashing Point<br />' + graticules[i][2] + '<br />°N<br />°E');
 		i++;
 	}
   }
diff --git a/xkcd2js.sh b/xkcd2js.sh
new file mode 100644
index 0000000..382ae39
--- /dev/null
+++ b/xkcd2js.sh
@@ -0,0 +1,93 @@
+# $MirOS: src/share/misc/licence.template,v 1.28 2008/11/14 15:33:44 tg Rel $
+#-
+# Copyright © 2014
+#	Thorsten Glaser <tg at mirbsd.org>
+#
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un‐
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person’s immediate fault when using the work as intended.
+#-
+# Helper script to download and convert data
+
+# escape XHTML characters (three mandatory XML ones plus double quotes,
+# the latter in an XML safe fashion numerically though)
+function xhtml_escape {
+	if (( $# )); then
+		print -nr -- "$@"
+	else
+		cat
+	fi | sed \
+	    -e 's&\&g' \
+	    -e 's<\<g' \
+	    -e 's>\>g' \
+	    -e 's"\"g'
+}
+
+# escape string into JSON string (with surrounding quotes)
+function json_escape {
+	[[ -o utf8-mode ]]; local u=$?
+	set -U
+	local o=\" s
+	if (( $# )); then
+		read -raN-1 s <<<"$*"
+		unset s[${#s[*]}-1]
+	else
+		read -raN-1 s
+	fi
+	local -i i=0 n=${#s[*]} wc
+	local -Uui16 -Z7 x
+	local -i1 ch
+
+	while (( i < n )); do
+		(( ch = x = wc = s[i++] ))
+		case $wc {
+		(8) o+=\\b ;;
+		(9) o+=\\t ;;
+		(10) o+=\\n ;;
+		(12) o+=\\f ;;
+		(13) o+=\\r ;;
+		(34) o+=\\\" ;;
+		(92) o+=\\\\ ;;
+		(*)
+			if (( wc < 0x20 || wc > 0xFFFD || \
+			    (wc >= 0xD800 && wc <= 0xDFFF) || \
+			    (wc > 0x7E && wc < 0xA0) )); then
+				o+=\\u${x#16#}
+			else
+				o+=${ch#1#}
+			fi
+			;;
+		}
+	done
+	(( u )) && set +U
+	print -nr -- "$o\""
+}
+
+exec >xkcd2js.out
+
+# we always apply the 30W rule, so the code would need to be
+# changed, both here and in the CGI, to go further west… but
+# that would not scale either, anyway, plus we calculate all
+# points using CET/CEST, so we don’t do that
+
+for lat in 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56; do
+	for lon in -6 -5 -4 -3 -2 -1 -0 0 1 2 3 4 5 6 7 8 9 10 11 12; do
+		x=$(ftp -o - http://carabiner.peeron.com/xkcd/map/data/loc/$lat,$lon)
+		x=$(xhtml_escape "$x")
+		[[ $x = *'!/'* ]] && x="<a href=\"http://wiki.xkcd.com/${x##*'!/'}\">${x%'!/'*}</a>"
+		print "	[\"$lat\", \"$lon\", $(json_escape "$x")],"
+	done
+done
+print "	[\"666\", \"666\", \"\"]"
+ls -la xkcd2js.out >&2


hooks/post-receive
-- 
MirKarte source code repository
(Evolvis project useful-scripts repository mirkarte)


More information about the useful-scripts-commits mailing list