Skip to content

Instantly share code, notes, and snippets.

View zdila's full-sized avatar

Martin Ždila zdila

View GitHub Profile
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Martin Ždila",
"label": "Senior Full-stack Developer",
"image": "",
"email": "[email protected]",
"phone": "",
"url": "",
"summary": "I am software professional specialized to ES2016/NodeJS/React/Redux full-stack software design and development and embedded development based on Mongoose OS. I prefer opensource software and technologies. Despite of being senior in Java and Java EE for more than 10 years I no longer prefer this platform.\n\nMy hobby is OpenStreetMap and microcontrollers (Arduino, ESP, Mongoose OS).\n\nI consider myself very agile in learning new technologies and finding solutions to difficult technical problems.\n\nCurrently I am not willing relocate from my hometown - Košice, Slovakia.",
@zdila
zdila / waterway-tags-to-relations.js
Created December 7, 2022 17:43
OSM move waterway tags to parent relations
/*
Overpass QL for the input file (waterway-rels.osm):
```
[out:xml][timeout:90];
{{geocodeArea:slovakia}}->.searchArea;
(
relation["type"="waterway"](area.searchArea);
);
(._;>;);
@zdila
zdila / waterways2relations.js
Created November 29, 2022 17:42
add waterways to relation using scripting plugin
import josm from "josm";
import { RelationBuilder } from "josm/builder";
const byName = {};
const ds = josm.layers.activeLayer.getDataSet();
const ways = ds.getWays();
for (const way of ways) {
@zdila
zdila / index.js
Created November 20, 2022 10:46
mirecnet-false-fords-cleanup
/*
Overpass QL for the input file (mirecnet-false-fords.osm):
```
[out:xml][timeout:600][bbox:{{bbox}}];
(
way[highway]->.w1;
way[waterway]->.w2;
node[!"ford"](w.w1)(w.w2)(user:"Mirecnet");
);
@zdila
zdila / pLimit.ts
Created June 28, 2022 12:15
pLimit for modern Node
export function pLimit(concurrency: number) {
let running = 0;
let resolves: (() => void)[] = [];
return async <T>(fn: () => Promise<T>): Promise<T> => {
if (running >= concurrency) {
await new Promise<void>((resolve) => {
resolves.push(resolve);
});
@zdila
zdila / merge_hgt.ts
Created August 26, 2020 21:25
Merge two HGT files taking nodata (-32768) into account.
const base = Deno.args[0];
const data1 = await Deno.readFile(`in1/${base}.HGT`);
const data2 = await Deno.readFile(`in2/${base}.HGT`);
const buf1 = new DataView(data1.buffer);
const buf2 = new DataView(data2.buffer);
for (let i = 0; i < buf2.byteLength - 1; i += 2) {
const val = buf2.getInt16(i, false);
@zdila
zdila / pyramid.js
Last active June 22, 2020 15:59
Generate TMS pyramid
import * as path from "https://deno.land/std/path/mod.ts";
const encoder = new TextEncoder();
const dot = encoder.encode(".");
const dash = encoder.encode("-");
for (let zz = 18; zz >= 0; zz--) {
const base = `/home/martin/ofmozaika/${zz + 1}`;
@zdila
zdila / links.txt
Created November 2, 2019 09:59
SotM 2019 CZ+SK
@zdila
zdila / extract.sh
Created February 5, 2019 21:13
extract locus sqlitedb tiles
sqlite3 cesty_nlc_2017.sqlitedb "select writefile(z || '/' || x || '/' || y || '.png', image) from tiles"
@zdila
zdila / earthExplorerDownloader.js
Last active September 7, 2018 11:30
earthexplorer.usgs.gov SRTM downloader
const fs = require('fs');
const axios = require('axios');
const parseSetCookie = require('set-cookie-parser');
const querystring = require('querystring');
class Cookies {
constructor() {
this.cookies = {};
}