- Go to https://www.openstreetmap.org/export#map=11/48.6129/38.2221
- Choose your area for export
- Put export bounding box longitude and latitude into
calc_tiles.py
and run it to calculate which tiles to has to be downloaded - Create
tiles
directory - Put calculated coordinates into
download_tiles.js
and run it do download tiles (couldn't make downloading work in Python) - Put calculated coordinates into
stitch_tiles.py
and run it - The output will be stored in
map.png
file
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
const r = require("raylib/drm/index"); | |
const net = require("net"); | |
const path = require("path"); | |
const { pexec } = require("./utils"); | |
const renderer = require("./renderer"); | |
function getScreenSize() { | |
return pexec(`fbset -s | grep "geometry" | awk '{print $2" "$3}'`).then((r) => | |
r.split(" ").map((s) => parseInt(s, 10)) | |
); |
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
(defn part-1 [input] | |
(->> input | |
str/split-lines | |
(map seq) | |
(apply map list) | |
(map #(vals (into (sorted-map) (set/map-invert (frequencies %))))) | |
(apply map list) | |
(map (comp #(Integer/parseInt % 2) str/join)) | |
(apply *))) |
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
(defn parse-input [input] | |
(->> input | |
(str/split-lines) | |
(map #(let [[v n] (str/split % #" ")] | |
[v (Integer/parseInt n)])))) | |
(defn part-1 [input] | |
(->> (parse-input input) | |
(reduce (fn [[h d] [v n]] | |
(case v |
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
(defn part-1 [input] | |
(->> input | |
(partition 2 1) | |
(filter #(apply < %)) | |
count)) | |
(defn part-2 [input] | |
(->> input | |
(partition 3 1) | |
(map #(apply + %)) |
This example illustrates an intersting side effect of Clojure's lazy sequences when used in re-frame subscriptions. The behaviour described below takes place only on initial subscribe call
(reg-sub :test/x-2
(constantly [])
(fn [_ _]
(prn "evaluating body of " :test/x-2)
(map #(do (prn "evaluating lazy seq returned from " :test/x-2) (inc %)) (range 3))))
(reg-sub :test/x-1
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
(ns analyze.core | |
(:require [clj-kondo.core :as clj-kondo] | |
[clojure.set :as set])) | |
;; checks re-frame's :<- syntax | |
;; to mark dependency subscriptions as used | |
(def analyze-reg-sub | |
"(require '[clj-kondo.hooks-api :as api]) | |
(fn [{node :node}] | |
(let [[_ kw & children] (:children node) |
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
(->> (clojure.string/split (slurp "input_02") #"\n") | |
(map #(re-find #"(\d+)-(\d+) (\w): (\w+)" %)) | |
(filter (fn [[_ min max char string]] | |
(>= (Integer/parseInt max) | |
(count (re-seq (re-pattern char) string)) | |
(Integer/parseInt min)))) | |
count) | |
(->> (clojure.string/split (slurp "input_02") #"\n") | |
(map #(re-find #"(\d+)-(\d+) (\w): (\w+)" %)) |
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
(def nums | |
(->> (str/split (slurp "input_01") #"\n") | |
(map #(Integer/parseInt %)))) | |
(->> (for [x nums | |
y nums | |
:when (= 2020 (+ x y))] | |
(* x y)) | |
(some identity)) |
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
(ns utils.re-frame | |
(:require [cljs.compiler :as cljsc])) | |
(defn- anonymous-function-declaration? [form] | |
(and (list? form) | |
(= 'fn (first form)) | |
(vector? (second form)))) | |
(defn- query-id->js-fn-name [query-id] | |
(let [ns-part (when-let [ns-part (namespace query-id)] |
NewerOlder