Posts

Showing posts from December, 2014

Where is my direction pole?

Image
Somewhere in a village in Tuscany a direction pole has been installed, and while I was looking around I've asked myself how precise are the distances, and also if giving a glance to the direction pole from one side is possible to triangulate the location.

This is essentially a small exercise of spherical geometry for which Python is perfect. First a look at two photos of the direction pole: it has a total of 18 directions of which 8 pairs of cities share the same direction on opposite faces of the arrow, as shown in the following photos:



Continue reading with the details and solution. If you like guessing a place from a picture you can try GeoGuessr that uses Google Street View for creating geographical quizzes.

Sandboxing your scripts in OSX

Sandboxing is a system level feature that allows to limit the capabilities of an application due to security reasons or simply because we are developing the application or the script. Sandboxing is also the starting point for application-level virtualization because the next step of system call interception is system call detour.

OSX provides application level sandboxing since a long-time and it is worth looking at it while developing a new bash script, or simply when we want to perform a command line that involves sensitive data. Let's say we want to perform rsync of our family pictures and we really want be sure that we will not mistakenly impact our files.

The objective is to protect the execution of an executable or script file allowing it to write only on a given path. The idea is to make a shell script as follows:

writethere.sh TARGETPATH CMD ARGS*

The sandbox-exec utility of OSX executes another program using the provided sandboxing configuration file. The configuration file…