MATE desktop fixes (updated)

Last week I upgraded my Linux Mint 18 MATE desktop distro to 18.3. With the massive progresses GNU/Linux has done in the desktop, those kind of upgrades use to be simple tasks and no more hassle is to be expected. Except this time where I had several a GUI-related annoyances.

1. MATE panel transparency

I recently became addicted to /r/unixporn and made myself a shiny modern desktop made of MATE and rofi. This desktop use the Arc-Darker theme which used to work nicely with mate-panel version 1.14 but was messing transparency with version 1.18, the one shipped with Mint 18.3.

Webcam streaming with ffmpeg

I’m a bit of a stressed person, and when I’m not home, I like to have a webcam streaming what’s going on, mainly to see how my dog is doing. At my main house, I use the fabulous motion project, which has a ton of cool features like recording images and videos when there’s movement, playing a sound, handling many cameras and so on.

As I said before, I acquired an apartment destined for rental, and it has really poor Internet access, as it is located on the mountainside, only weak ADSL was possible to get.
Another point, I own a MacBook Pro for music purposes, and when I come crash here, this is the computer I take with me so I can compose if inspiration comes ;) So when I get out the apartment, this will be the machine streaming what’s happening in the house.

date over HTTP

I always manage to get myself into weird issues… I have this (pretty old) wrt54g router that works well with dd-wrt v3.0-r34311 vpn release. This router is installed in an apartment intended for rental where I happen to crash every now and then. It connects to an OpenVPN hub of mine so I can monit it and be sure guests renting the apartment have working Internet access.

The apartment is located on a small mountain and electricity is not exactly stable, from times to times power goes down and comes back up. And I noticed the openvpn link sometimes fails to reconnect.

Fetch RSVPs from Meetup for further processing

I’m running a couple of demos on how and why to use AWS Athena on a Meetup event tonight here at my hometown of Valencia. Before you start arguing about AWS services being closed source, note that Athena is “just” an hosted version of Apache Hive. Like pretty much every AWS service is a hosted version of a famous FOSS project.
One of the demos is about fetching the RSVP list and process it from a JSON source to a basic \t separated text file to be further read by Athena.
First thing is to get your Meetup API key in order to interact with Meetup’s API. Once done, you can proceed using, for example, curl:

Running Debian from an USB stick on a MacBook Pro

Yeah well, it happened. In my last post I was excited to get back to a BSD UNIX (FreeBSD) for my laptop, I thought I had fought the worse when rebuilding kernel and world in order to have a working DRM module for the Intel Iris 6100 that is bundled with this MacBook Pro generation. But I was wrong. None of the BSDs around had support for the BCM43602 chip that provides WiFi to the laptop. What’s the point of a laptop without WiFi…

Running FreeBSD from an USB stick on a MacBook Pro

It is possible to run FreeBSD on a MacBook Pro from an USB drive. To achieve this, we will first prepare the USB drive from a GNU/Linux machine and make it UEFI friendly:

# apt-get install parted
# parted /dev/sdc
(parted) mklabel gpt
(parted) mkpart ESP fat32 1MiB 513MiB
(parted) set 1 boot on
(parted) quit

From there, install FreeBSD as you would for exmaple using the kvm virtual machine hypervisor on the GNU/Linux machine. Answer “yes” when the installer suggests to create a freebsd-boot partition.

Cash monitoring

I’m kind of back in the mining arena. Like everyone else nowadays, I’m mining Ethereum with a couple of R9 290 & 290X graphic cards I bought second-hand.
So far everything works as intended, but as a proper control freak, I need to know what’s happening in real-time, what’s my firepower, how’s the mining doing etc…
Like many, I use a mining pool, ethermine to be precise, and those guys had the good taste of exposing a JSON API.
Using collectd-python capabilities, I was able to write a short python script that feeds:

Launch the AWS Console from the CLI or a mobile phone

At ${DAYJOB} I happen to manipulate quite a few AWS accounts for different customers, and I find it really annoying to log out from one web console, to log into a new one, with the right credentials, account ids and MFA.

Here you can read a good blog post on how to enable cross account access for third parties and use a basic script to open a web browser to switch from one account to the other.
I liked this idea so I pushed it a bit further and wrote this small piece of code which allows you not only to switch accounts, but also to simply open any AWS account from the command line.

Tricking bash HISTTIMEFORMAT

While trying to find a clean method to remove line numbers from the history command, I found an interesting trick by using the HISTTIMEFORMAT environment variable. Here’s what bash’s man says:

       HISTTIMEFORMAT
              If  this  variable  is  set and not null, its value is used as a
              format string for strftime(3) to print the time stamp associated
              with  each  history  entry displayed by the history builtin.  If
              this variable is set, time stamps are  written  to  the  history
              file  so they may be preserved across shell sessions.  This uses
              the history comment character  to  distinguish  timestamps  from
              other history lines.

But it turns out you can actually put pretty much anything in there, and for example, an ANSI escape sequence that does a line feed and erases the current line: