OSX Sandboxing for include file interference during build

A while a go I posted about the use of the OSX built-in sandbox for protecting against unwanted file or network accesses.

Sometime I perform Windows cross-compilation by using Docker (e.g. dockercros) or more typically directly using cmake under OSX.

In both cases there is the chance that the cmake scripts of a library are not behaving correctly in the lookup of dependencies and create interference with the system include files (e.g. /usr/include and /usr/local/include). The OSX sandbox comes handy allowing to block the access to one or more directories.

This is the OSX sandboxing script I am using:

(version 1)
(deny default)
(allow sysctl-read)
(allow signal)
(allow process-exec)
(allow process-fork)
(allow mach* sysctl-read)
(allow file-read* (regex "^.*"))
(deny file-read* (regex "^/usr/local/include.*") (regex "^/usr/include.*"))
(allow file-write* (regex (string-append "^/tmp/.*")) (regex (string-append "^" (regex-quote (param "target…

Space-time possibly fractal dimensions in arts and books

I was reading a collection of stories from John Barrow (100 things..., 2014) and among maths and arts stories there was one (#58) about the dimensionality in space and time of artistic production. He argues about the fact that basic arts can be mapped to spatial dimensionality in 1,2 and three dimensions from lines to sculpture. And then it time dimension can be easily added to each of them as SNT.

In this short post I am providing some other examples and variation of this idea and making an example of connection between this spatial dimensionality and use in Machine Learning.

[script] Extract and Modify mp4 frame durations

In a recent data acquisition project we used an embedded board that was producing mp4 videos with a variable video acquisition rate. While the video is nominally at 30 FPS the effective rate is around 29.5 FPS with some jitters.

The general suggestion when processing videos with OpenCV VideoCapture is to save the frame time (CV_CAP_PROP_POS_MSEC) so that each frame is associated with the real time, an important step when video annotations are expressed in time units.

The general ffmpeg way to extract durations is the following:

ffprobe -i INPUT -show_frames -show_entries frame=pkt_pts_time -of csv=p=0

On a decent machine a 30 minutes full-HD mp4 video takes 12min with ffprobe or OpenCV, and this is not acceptable.

Luckly mp4 files are easy to parse and the "stss" atom provides this information in a compact form (RLE encoding). Having not found an online solution I have prepared a Python script that extracts the timings as fast as possible (numpy.fromfile) starting from the m…

JSON bag - bInary multipart JSON response

In a scenario in which I am involved we have an embedded server that answers the status of activities and devices combining structured data (JSON) and medium sided binary data (images). This post and the associated github repository (here) presents a AJAX response that combines JSON data with one or more binary payloads. The objectives are the following: avoid base64 bandwidth and decoding overheadavoid custom encodings such JSONB/MessagePack that are slow in browser decodingreduce number of requests or more complex production logic (if not using HTTP 2.0 Server Push)usable for file serializationgraceful degradation (Content negotiation and JavaScript support)The approach is the following: data encoding, transferred as JavaScript ArrayBuffer, that contains readable header, main JSON and then binary blocks each with a JSON headerprocessing on the client side that patches the JSON replacing stub URIs with the new Blob URIs. server-side generation that can produce both the JSON bag and a …

Holiday Greetings from LOGO Santa Claus

Greetings from Santa Claus ... a little exercise in Three.js (WebGL) based on a LOGO-like custom syntax. Although this could appear as a voxel designed object it is actually generated via a command sequence parsed using Regular Expressions. For example the head is:


The drawing syntax is based on boxes with height 1 size specified by S command, color by C command, write by the dot "." and a bunch of moving terms. Finally hierarchy is provided via anchors A#, while some spatial memory stores are based on the P(ush) and p(op) commands.

The outline effect is based on the interesting postprocessing pipeline from Three.js examples.

Source Code: github
Website: here

Research wise LOGO in 3D can be found in some examples: Paliokas, Ioannis, Christos Arapidis, and Michail Mpimpitsos. "PlayLOGO 3D: A 3D interactive video game for early programming education: Let …

anycat - general decompressor at command line

This is a micro post about a simple command-line utility that is decompresses several file types and sends them to stdout much like cat. Its' called anycat. The rationale is that in some cases we do not now in advance which file we need to decompress, or we want to test different algorithms. Another usage is in the context of flexible networking tools such as socat.

The source code of this script is on git.

The script invokes the correct decompressing tool using the extension of the input file or by means of an argument. Supported compression formats are: gzip,bzip2,xz,lzma,lz4.

anycat can extract a file contained in a tar or zip archive path; in this case compressed tar files are also supported.

Some examples:

anycat some.lz4 

Decompresses some.lz4 identifying it by the extension

cat some.lz4 | anycat -4 -

Decompresses the stdin content to stdout using an argument (-4) to identify the compression type

anycat -a under/someinside.xml

Extracts the file under/someinside.xml fr…

Lone Wolf story graph

Few days ago Joe Daver of the Lone Wolf fame passed away, that a pity, it was an enjoyable type of book when I was a child. Since several years Project Aon is freely publishing his works in a browsable way.

Project Aon provides a graph representation of the books (e.g. here) but I wanted to have my twist as remembrance.

I have prepared a browsable story graph of the first 7 books, highlighting deaths, combats, quiz nodes, looping edges and death probability. In particular I have create also one single view with all these 7 books that gives an impression of the flow at glance.

Legenda Click on the nodes to get to the page.
Orange octagons are fighting situations. Red cut circles are deadly situations.Sommerswerd mention is in magentaStart and End are in green Edges: Looping edges have special arrowEdges are colored by death probability (only DAG graphs)Edge label is the death probability (only DAG graphs)Bold edge means shortest pathDashed edges means subject to random pick