logging

Sunday, August 21, 2022

Installing and configuring tinyproxy on Ubuntu 22.04

Install and configure tinyproxy (if you want this system to function as a proxy)

In order to use the system as a proxy install and configure tinyproxy:
sudo apt update
sudo apt upgrade
sudo ufw allow 8888
sudo apt install tinyproxy
sudo touch /var/log/tinyproxy/tinyproxy.log
sudo chown tinyproxy:tinyproxy  /var/log/tinyproxy/tinyproxy.log
Add the IP addresses of systems you want to make use of the proxy to /etc/tinyproxy/tinyproxy.conf:
sudo vi /etc/tinyproxy/tinyproxy.conf
Add lines like:
Allow 198.35.34.96
And restart tinyproxy:
sudo systemctl restart tinyproxy.service
sudo systemctl status tinyproxy.service
Status should look like:
 <user>@<hostname>:~$ sudo systemctl status tinyproxy.service   
 ● tinyproxy.service - Tinyproxy lightweight HTTP Proxy
     Loaded: loaded (/lib/systemd/system/tinyproxy.service; enabled; vendor pre>
     Active: active (running) since Thu 2022-07-14 12:44:52 UTC; 6s ago
       Docs: man:tinyproxy(8)
             man:tinyproxy.conf(5)
    Process: 2523 ExecStart=/usr/bin/tinyproxy $FLAGS (code=exited, status=0/SU>
   Main PID: 2525 (tinyproxy)
      Tasks: 1 (limit: 956)
     Memory: 1.1M
        CPU: 6ms
     CGroup: /system.slice/tinyproxy.service
             └─2525 /usr/bin/tinyproxy

Jul 14 12:44:52 t2202 systemd[1]: Starting Tinyproxy lightweight HTTP Proxy...
Jul 14 12:44:52 t2202 systemd[1]: tinyproxy.service: Can't open PID file /run/tinyproxy/tinyproxy.pid (yet?) after start: Operation not permitted
Jul 14 12:44:52 t2202 systemd[1]: Started Tinyproxy lightweight HTTP Proxy.
(I do not care about the message 'tinyproxy.service: Can't open PID file /run/tinyproxy/tinyproxy.pid' as long as the proxy works...)

Monday, August 1, 2022

Paterson's Worms in Scalable Vector Graphics

Paterson's worms are cellular automata devised in 1971 by Mike Paterson and John Horton Conway.

They model the behavior and feeding patterns of certain prehistoric worms.  These worms fed upon sediment at the bottom of ponds and avoided retracing paths they had already travelled because food would be scarce there.

This behaviour was mathematically modelled by Mike Paterson as described by Michael Beeler (MIT) in 1973.

Ever since I read Martin Gardners feature in Scientific American on Paterson's worms in November 1973, they have fascinated me. For decades I procrastinated writing a turtle graphics program to draw them. I remember making an attempt in Logo long ago... Now I made an implementation in Scalable Vector Graphics (SVG).

The worms crawl a regular pattern along an isometric grid avoiding areas already visited. The grid consists of 'nodes' connected by 'segments', where I use coordinates as follows:



The direction the worm crawls is numbered as follows:



The encoding for worm type I used for the worm type is described by Ben Chaffin and Ed Pegg Jr.. Chaffin created a list of all known types of worms which I incorporated in a drop down menu to select a type.

Nodes I store in an object called field which is actually an associative array (of lines) holding associative arrays (of points on the 'perpendicular' lines). A construct I learned from an article by Peter-Paul Koch. The worm crawls from node to node and line segments are appended to the SVG.

I added colouring: the Worms 'head' will always appear yellow, the end of its 'tail' red.


Some things remain to be done, my wish list:
  • Make a version with possibly multiple worms
  • Increase code efficiency (use typed arrays?)
  • It would be great if you could 'pan' also on the negative side of axes(why doesn't SVG support that...)
  • Add color like here (pworms.wordpress.com)
  • Simple things like adjustable speed and pause
  • ...
Links:

Introduction to OpenLayers

Introduction What is 'OpenLayers'? Openlayers is an open-source JavaScript library for displaying maps and map data in web brow...