Skip to content

Instantly share code, notes, and snippets.

View nitaku's full-sized avatar

Matteo Abrate nitaku

  • IIT CNR
  • Pisa, Italy
View GitHub Profile
@nitaku
nitaku / README.md
Last active April 29, 2025 10:51
Sky II (HYG)
@nitaku
nitaku / README.md
Last active April 29, 2025 10:50
Sky

A map of the sky that uses an azimuthal equidistant projection with star data. Longitudes and latitudes for the geo projection are obtained from declination and right ascension respectively (longitude is also inverted, because, unlike the earth globe, the celestial sphere is seen from the inside).

The boreal (northern) sky is shown at left, while the austral (southern) at right. Because right ascension is given in hours, both maps are divided in 24 slices. A circle is shown every 10 degrees of declination.

Star size indicates magnitude. Bigger circles depict brighter stars.

@nitaku
nitaku / README.md
Last active April 3, 2025 20:42
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@nitaku
nitaku / README.md
Last active February 4, 2025 12:47
Peano Hex curve (L-system)
@nitaku
nitaku / README.md
Last active December 30, 2024 06:24
Canonical representation of unordered rooted trees

This example shows a canonical (non-ambiguous) representation of a randomly generated unordered rooted tree. Reload to generate a new one. This is an improvement of a previous example.

Unordered rooted trees are trees (with a root) in which sibling order is not defined. Visualizing such trees often involves showing siblings in arbitrary order.

Serializations of unordered trees are often ordered, therefore, they are not necessarily equal to each other even if they represent the same unordered tree. A particular case is that of randomly generated trees.

If such serializations are fed into a tree layout algorithm, it can yield different representations of the same unordered tree, which is undesirable.

We perform a total ordering of the tree, based solely on topological features, which constrains an order-preserving tree layout algorithm to yield a single representation (barring other layout parameters). The total ordering is used to sort the tree before passing it to th

@nitaku
nitaku / README.md
Last active November 27, 2024 11:23
World cloud intersection II
@nitaku
nitaku / README.md
Last active October 22, 2024 01:56
GosperMaps: boundaries

This example shows two experiments in representing boundaries in GosperMaps. All paths are simplified then smoothed with a cardinal interpolator, while internal boundaries are given varying thickness and colors to help in identifying hierarchy levels. The colored part slighlty covers boundaries that are inside a region, to convey a sense of nesting.

This example island represents all typed instances in a DBpedia dump. Click here for a more complete map.

@nitaku
nitaku / README.md
Last active October 22, 2024 01:50
Space-flling curve layout (Gosper)

A more engineered example of a space-filling curve layout (see also this random fractal map), using the Gosper curve to displace the leaves of a tree (or a sequence) in a compact, 2D representation. Siblings are placed near to each other, so leaves that are "near" according to the hierarchy are also near to each other in this representation. Please note that internal nodes (non-leaf ones) cannot be represented with this technique. Only the sequence of leaves is shown. Therefore, this layout is particularly suited for datasets in which leaves are "more important" than internal nodes.

Visually, the layout is reminiscent of geographical maps. The color of the hexagonal cells indicates the depth of the corresponding leaf, like a sort of elevation map. As it's common for digital maps, you can zoom and pan the view.

This example is different from the previous ones about fractal maps: the layout step (i.e. decide where to place each leaf) ha

@nitaku
nitaku / README.md
Last active September 18, 2024 13:18
Random pronounceable strings

This example uses a predefined syllabary to produce random pronounceable strings. Reload to create new strings.

This file has been truncated, but you can view the full file.
{"children": [{"id": "partition1", "children": [{"id": "v4+v6", "children": [{"id": "ARIN", "children": [{"id": "AU|CA|CH|CO|DE|ES|GB|HK|IN|JM|MX|NG|NL|NZ|SE|TR|US", "children": [{"v4_effective_coverage": 713216, "ipv": "v4+v6", "geo": "AU|CA|CH|CO|DE|ES|GB|HK|IN|JM|MX|NG|NL|NZ|SE|TR|US", "v6_effective_coverage": 237692950706059845912108204032, "partition": 1, "rir": "ARIN", "id": "6461", "label": "ZAYO-6461 - Zayo Bandwidth Inc"}]}, {"id": "AS|AT|AU|BE|BR|CA|CN|CZ|DE|ES|FR|GB|GR|HK|IE|IT|JP|KR|LA|MO|NL|NO|PA|SG|TR|US|VI", "children": [{"v4_effective_coverage": 20762368, "ipv": "v4+v6", "geo": "AS|AT|AU|BE|BR|CA|CN|CZ|DE|ES|FR|GB|GR|HK|IE|IT|JP|KR|LA|MO|NL|NO|PA|SG|TR|US|VI", "v6_effective_coverage": 20609237863299653706886076694542, "partition": 1, "rir": "ARIN", "id": "209", "label": "CENTURYLINK-US-LEGACY-QWEST - Qwest Communications Company, LLC"}]}, {"id": "BR|ES|GB|HK|ID|IN|LS|PL|SG|TH|UA|US", "children": [{"v4_effective_coverage": 16232, "ipv": "v4+v6", "geo": "BR|ES|GB|HK|ID|IN|LS|PL|SG|TH|UA|US", "v6