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
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
@nitaku
nitaku / README.md
Last active July 3, 2024 19:37
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 May 31, 2024 14:19
Freehand drawing

A simple freehand drawing application, based on Bostock's Line Drawing gist.

Use your stylus, fingers or mouse to draw. The color of the line can be changed by interacting with the color palette, and the canvas can be cleared by clicking the trash in the upper-right corner of the UI.

The application uses two stacked SVG elements, one for the UI and one for the canvas. This is used to disable drawing when interacting with UI elements.

Unlike Bostock's example, this application maintains a DOM-independent object to store all the drawing's data (just look at the JavaScript console each time you complete a line).

Colors are from Colorbrewer's Dark2 palette.

@nitaku
nitaku / README.md
Last active May 10, 2024 22:47
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 23, 2024 09:25
Leaflet with ESRI satellite tiles

An example that shows an ESRI's satellite layer with Leaflet.js. A lot of different tile services are compatible with Leaflet: click here for a list with live previews.

@nitaku
nitaku / README.md
Last active October 18, 2023 12:17
Three.js isometric camera
@nitaku
nitaku / README.md
Last active September 17, 2023 11:05
Boolean operations on 2D shapes

This example shows the results (orange) of performing four different boolean operations (union, difference, xor and intersection) on two 2D shapes (blue). Thanks to the powerful clipper.js library, the computation is performed in client-side Javascript.

The example is almost entirely taken from this clipper.js demo.

@nitaku
nitaku / README.md
Last active July 27, 2023 11:54
Fuzzy graph

A visualization experiment for displaying fuzzy graphs (Rosenfeld 1975, in Fuzzy Sets and Their Applications to Cognitive and Decision Processes, page 77). Each node has a degree of membership to the set of graph nodes, encoded with its area (in red). The maximum degree of membership (i.e., 1) is represented as a gray circle of unit area. Links have a degree as well, linearly encoded with their thickness (dark gray). The maximum degree for links is limited by the minimum value between the degrees of the nodes it connnects, and is represented with a light gray line, while the unconstrained maximum degree (i.e., 1) is shown as a dotted, empty line.

@nitaku
nitaku / README.md
Last active June 25, 2023 19:14
Hilbert spiral (L-system)

A Lindenmayer system that draws a sequence of growing Hilbert curves following a spiral layout.

Like in the previous experiment, a repetition rule is added to the Hilbert rules (A and B) to obtain the sequence. In order to produce the spiral layout, the rule contains some turns and different repetitions of the Hilbert rules A and B.

The objective is to find a layout that starts from a central point and grows spiraling away from it. The layout is intended to be used for creating a jigsaw treemap, so a naive spiral layout (like this one) is out of the question because of the elongated regions it would produce.

By leveraging the locality properties of the Hilbert curve, the layout presented in this example should somehow manage to both spiral away from a central point and have regions with good as

@nitaku
nitaku / README.md
Last active June 17, 2023 08:24
Multidimensional Scaling

An example of Multidimensional Scaling (almost completely taken from this article by Ben Frederickson).

A matrix of distances between cities is fed into a simple javascript function (again, by Ben Frederickson) that uses numeric.js to compute the cities' position. Rotation and mirroring (manually adjusted in this example) are free.

Click on a city to see an indication of the distance errors.