Perl: File Locking

A good function to use to force one instance of a script to run. Flock

Code snippet


use Fcntl ":flock";   # allow only one instance to run
open(my $self, "<", $0) ||
        die("001 : Cannot open myself : $!.\n");
flock($self, LOCK_EX|LOCK_NB) ||
        die("002 : Another user is running the tool.\n ");


Facebook Scraper-clear cache

If you want to control how your data looks after posting to Facebook. You will want to use the scraper debug tool.

This tool came in handy after a user wanted a particular image to show instead of a random image. The debugger allowed us to see what exactly facebook was pulling. The tool also advise us on some warning and issues we have within our codebase.

We had to edit the functions.php file and had the below snippet .Thanks to https://wordpress.org/support/topic/change-the-og-image-property


add_filter('wpseo_pre_analysis_post_content', 'mysite_opengraph_content');
function mysite_opengraph_content($val) {
return preg_replace("/<img[^>]+>/i", "", $val);
}

We also needed to edit the header.php file and add the below snippet

<meta property="og:image" content="http://example.com/hmm.jpg" />

**of course changing the values to match our website*

After making the needed changes, you can request a rescrape using the scraper tool. This can also be down via the linux command line with curl. You will need access token for this to work.

Example

curl -F access_token="<token>" -F id="cnn" -F scrape=true https://graph.facebook.com

https://developers.facebook.com/tools-and-support/

API Docs

Some of the warning we received were related to Open Graph protocol
Open Graph protocol

Kodi :: Accessing Exodus

Connect the device per the device instuctions. Connect the hdmi cord to the TV and your device. Connect the power adapter. Then change your Television to the correct HDMI Input source.

Android box
First use
First setup your wifi connection > settings > network > wifi
Then click on the kodi icon
To access the movie section , click on movies > video-ons – Exodus or Phoenix
From there you can search for the movie you would like to watch or click on the icon
To go back to the main screen , click the back arrow on the remote

Fire Stick
First use
First setup your wifi connection and sign in with your amazon account id. If you do not have a amazon id , you can register for free.
Then click on the kodi under apps
To access the movie section , click on movies > video-ons – Exodus or Phoenix
From there you can search for the movie you would like to watch or click on the icon
To go back to the main screen , click the back arrow on the remote

Computer , server issues and solutions