In the past, I made an overview of CDs I own, and which CDs I was missing from my top artists.
Today I wanted to have a little test using above code and some additional script to get a little website which enables me to quick start playing an album using LMS.
This server was running nginx
drwxrwx---. 2 root apache 6 Jan 3 18:19 wsdlcache
drwxrwx---. 2 root apache 16384 Jan 3 18:19 session
drwxrwx---. 2 root apache 6 Jan 3 18:19 opcache
fixed with:
chown root:nginx /var/lib/php/session
chown root:nginx /var/lib/php/opcache
chown root:nginx /var/lib/php/wsdlcache
Other things to check (Generic)
Really slow storage can cause problems, check with iotop
Check selinux! (temporary test with : setenforce 0 )
Behind a reverse proxy? remove these options in your config.php and check a local connection. This is a test for: reverseproxy, firewall and proxy settings in config.php. Need to test a localhost connection with your browser? ssh -L8080:localhost:80 nextcloudserver (and connect to http://localhost:8080 with your browser
Check your services! .. memcache, nginx, apache, mysql/mariadb
A world map generator in php. This php script selects randomly 3 cities from a CSV file and draws these on a worldmap. No cities wil be choosen which have could cause a drawing overlap. Every player can see the same generated worldmap with a countdown timer.
CSV example with places and coordinates (cities.csv)
London,905,412
Amsterdam,929,414
Wellington,1722,867
Costa Rica,524,640
New Delhi,1270,514
New York,567,477
Tokio,1548,500
Loads of stuff on my main fileserver. (Graph is a great tool called DUC) https://duc.zevv.nl/
Besides a search engine, i have a file finder. Due to the massive amount of data, i like to find things by other means than knowing the directory structure.
I can find files by filename, but also by contents.
I’ll talk about find by contents first.
I’ve got loads of documents in Pdf, HTML, txt, doc, sheets , wordperfect etcetera. Those documents i can find using a tool named Namazu. This is quite a old tool, but i’m using it for a long time and it still works great. I didn’t find a better replacement yet. (But i’ve been looking into : elasticsearch, Solr, Lucene)
http://www.namazu.org/ is easy to install, but if you want the tool to scrape different kinds of documents you have to add some additional software.
My multipurpose printer can scan pages in pdf. Those are only embedded jpg’s in a pdf container. I will talk about how i handle these later.
My current start page : This index contains 267,763 documents and 14,036,762 keywords.
Search example of namazu
Some things to consider when implementing namazu:
tweak the file types to scrape, it makes no sense to scrape binaries
you can set a parameter in the config for search only, this disables downloading the found link in the results!
Before Namazu i used HtDig.
Screenshot htdig
HtDIg also can scrape remote websites, Namazu can’t.
Preparing PDF for indexing:
I’ve written some scripts to make PDFs containing scanned text scrape-able. ( https://gitlab.com/fash/inotify-scanner-parser ) What it does:
My scanner puts a scanned pdf on my fileserver in a certain directory
Inotify detects a written file
it will copy the file, run OCR on it (tesseract) and writes a txt file (scapeable)
After that the text will be embedded (overlay) on the PDF, so now it becomes searchable/scrapeable
When certain keywords are found, it will sort documents in subdirs
Example from a scanned jpg, i can find OCR words! (note .. the overlay is exact on the found words)
Finding files by name:
For finding files a made a little webpage like this:
It is a simple webpage grabbing through a list of files. It takes the first keyword and does a grep, it takes a second keyword to match also. I can select different file databases to search. (This case is private) Between search and private i can give the number of entries to print. So i can do Search “ansible” NOT “tower” 50 entries from the public fileset
For my home automation i’m using Home Assistant and Domoticz. All 433Mhz Temperature/Humidity are connected to a RFXcom device on two domoticx instances. (Master slave construction)
I’ve made a php script and a bash script to draw all sensors on a floorplan in realtime.
There is also a cron running which takes a snapshot of the generated image every 5 minutes. These images are being converted to MP4 and animated GIF to have a timelapse with all temperatures displayed on a floorplan.
An obfuscated view of the floorplan
The circles are where sensors are placed. Colors are from blue till red, representing the heat. In the center is the measured temperature value.
The (shortened) PHP script: (index.php)
<?php
header('Content-type: image/png');
// This is the floorplan empty ..
$png_image = imagecreatefrompng('plattegrondenmerge.png');
$white = ImageColorAllocate($png_image, 0, 0, 0);
$max = 40;
$min = -10;
// living
// getstate is a bash script (see below which gets the values from domoticz using curl)
// 840 is the domoticz idx
$temp840 = shell_exec('./getstate 840');
// A gray circle will be drawn if the temperature age is > 500 seconds
$age = shell_exec('./new.sh 18 840 500 >/dev/null || echo gray');
// location of circle
$start_x = 950;
$start_y = 760;
$line = $temp840 + 10;
// get x-th line from colors
$colorfromlist = shell_exec("tail --lines=$line ./colors2 | head -1");
if(strpos($age, "gray") !== false){
$colorfromlist = "128,128,128";
};
$colors = explode(",", $colorfromlist);
$color = imagecolorallocatealpha($png_image, $colors[0], $colors[1], $colors[2], 50);
// draw circle
imagefilledellipse ($png_image, $start_x, $start_y, 175, 175, $color);
$start_x = $start_x - 70;
$start_y = $start_y + 15;
// add text
imagettftext($png_image, 24, 0, $start_x, $start_y, $white, './verdana.ttf', $temp840);
// winecellar
$temp840 = shell_exec('./getstate 839');
$age = shell_exec('./new.sh 18 839 700 >/dev/null || echo gray');
$start_x = 560;
$start_y = 840;
$line = $temp840 + 10;
$colorfromlist = shell_exec("tail --lines=$line ./colors2 | head -1");
if(strpos($age, "gray") !== false){
$colorfromlist = "128,128,128";
};
$colors = explode(",", $colorfromlist);
$color = imagecolorallocatealpha($png_image, $colors[0], $colors[1], $colors[2], 50);
imagefilledellipse ($png_image, $start_x, $start_y, 175, 175, $color);
$start_x = $start_x - 70;
$start_y = $start_y + 15;
imagettftext($png_image, 24, 0, $start_x, $start_y, $white, './verdana.ttf', $temp840);
// ETC ETC
imagesavealpha($png_image, TRUE);
imagepng($png_image);
imagedestroy($png_image);
?>
getstate bash script (gets the temperature from domoticz instance1 given an idx)
It uses canvas to draw lines and text, but thats only interesting for static stuff. ( https://www.w3schools.com/graphics/canvas_drawing.asp ) My example uses a php script to load information from a csv file. And loops though those entries and draw lens info.
Vincent showed me a very beautiful “pruts” he made. It was the Boardgame from Jumanji. He asked someone from work to write software for the center display.
I really liked the idea, so i made my own version.
Vincents Jumanji Board, there is a Laptop behind the little glass circle
The second page should play a mp3 sound sample, but there is a autoplay issue with some browsers. (I have fixed this on other projects, i will fix this later.
"If something is worth doing, it's worth overdoing."