Laur IVAN

Monitor ethOS Distro with Elastic Search – 2

Posted by in IT, Software, Tutorial

Following the previous post, we are now in position to install the monitoring code on the monitoried machine, of course. The easiest way is to download the code on the machine in /home/ethos. Following steps will assume you have the unpacked code in

Once you have downloaded the code, you need to add the location of the ElasticSearch server to the local.conf:

Dissecting the scripts The scripts are written in PHP, like ethOS‘s own scripts. I did that for two reasons: Take advantage of the already written code…read more

Show What’s on Swap in Linux

Posted by in IT, Tutorial

If you find your machine running sluggish, it might be the case that you have too many things running and it’s hitting the swap. You can check how bad (or good) things are with htop, but it won’t tell you which process is sitting on swap. To find out, I’ve cooked up a tiny script:

It will look in /proc/[PID]/status and get the VmSwap field. Then, it’ll print it out along with the PID and the command line (from ps -ax). Note: This is a rather crude script and…read more

Outlook VBA: Write to a file

Posted by in Software, Tutorial

Note: This is a post transferred from Laurii for historical and consolidation purposes. I’m not a master in VB (I hate it actually) not in VBA, but it;s quicker to write something like a hack in VBA for outlook than in C#. So, here’s a tiny snapshot on how to write to a file in Outlook (my version is 2003):

This is nice and funny, but you need to pass this as a parameter to functions to ensure that writing is done properly (sometimes at least)… You can do…read more

Use XPath in PL/PGSQL for Batch Processing

Posted by in Software, Tutorial

A while ago I had to process XML loaded in a PostgreSQL database. The task was to extract references from a publication structure. Fortunately, PostgreSQL allows you to use XPath in plpgsql, but there are some things you need to be aware. First, you need to note all namespaces:

Then, you can use the xpath() function:

…but that’s no fun, particularly when you are almost guaranteed to get multiple hits. It’s better to use:

A full implementation looks like this:

It gets all XML documents stored…read more

Generate Amazon Underground Launcher Icons

Posted by in Software

TL;DR: Use (adapt) the script below to automatically generate the Amazon Underground application launcher icons. I was toying with the idea to build an Amazon Underground version of one of my applications. According to their rules, you need to: Repackage your app Name custom permissions (Lollipop) Apply Amazon Underground branding Migrate API (if necessary) Initially I looked for a way to automatically generate the launcher images through gradle. However, I could not find any way and I figured it’s easier to build a shell script. Assumptions and results The script…read more