HOWTO: show all hidden files and folder on your macOS file explorer ‘FInder’

I found the trick on this collection from Tom’s guide. It worked for me (Apple M2, Ventura) without further annoyances. Jus open a terminal and type:

user@mac ~ $ > defaults write com.apple.finder AppleShowAllFiles -bool TRUE
user@mac ~ $ > killall Finder

This will kill the Finder and open it again, this time showing all the hidden files. You’ll be surprised how many #$@ you’ll find! Specially if you install certain scientific software..

Tactical RMM: Open Source remote monitoring and management

If I ever have full control over the network, I’d like to install something like this. For the moment I have only partial control – a subnet – so all these network-scraping solutions will not be welcomed in my neighbourhood. But you need to hear about this. Here you have the official documentation. If you click on the LIVE DEMO you will see the power of it. And here you have a condensed user guide. I took the above picture from it. As you see, it’s one web to control it all! Windows, Linux, mac, you name it. With grafana integration and a big community. You get plugins for everything! Pity that I’m not the network administrator. Well, no-one is perfect… ๐Ÿ˜›

HOW TO: Install Homebrew on M2 MacBook running macOS 13.1 Ventura

In case you don’t know homebrew, it’s a macOS package manager. Some kind of yum or apt-get. I had it on my previous mac, now I need it on my new one. Luckily for me to install it was not complicated. I did just follow the instructions written on this post for Monterey.

  1. Open terminal and run:ย /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Type your password and wait
  3. Add brew to your path
export PATH=/opt/homebrew/bin:$PATH
export PATH=/opt/homebrew/sbin:$PATH

That’s it. Now I can continue and install sshpass to avoid typing ssh passwords with sshpass onย macOS. Yes it’s getting tedious.

A LimeSurvey in a docker: make it a quick and dirty

You may need to ask your colleagues about something at one point, I’m sure about it. But I’m sure about also that you don’t have time, neither hardware, to program an entire survey or to install the software in a specific server. Since I’m lazy also, as you know, I looked for a docker solution until I found one that does the job. The basic principles of a lime survey you get on this post. This will work if your docker station has a mysql database – you will be asked to connect to the database. If you don’t have, or you don’t want to use it, we need a compose with a mysql docker.

It is worth to mention all the docker images I found. I hope it saves you googling time! ๐Ÿ˜๐Ÿ˜. So here you have the crramirez limesurvey image, with a pseudo-docker compose. And here you have the martialblog limesurvey, with a lot of possible customisations. Me, I’m a simple person. I don’t want to play with customisation, I want to download a compose file and get the thing working out of the box. This goal you can achieve with the acspri limesurvey. In short (or TLTR) ๐Ÿ˜๐Ÿ˜๐Ÿ˜: make a folder and copy this into a docker-compose.yml file.

version: '2'
services:
limesurvey:
image: acspri/limesurvey
ports:
- 8082:80
environment:
LIMESURVEY_DB_PASSWORD: example
LIMESURVEY_ADMIN_USER: admin
LIMESURVEY_ADMIN_PASSWORD: password
LIMESURVEY_ADMIN_NAME: Lime Administrator
LIMESURVEY_ADMIN_EMAIL: lime@lime.lime
volumes:
- ./plugins:/var/www/html/plugins
- ./upload:/var/www/html/upload
- ./config:/var/www/html/application/config
mysql:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: example

As usual, careful with the formattingย if you cut’n’paste from above. Once you have this file in a folder in the computer with dockers up and running, just type

docker-compose up -d

And access to:

Frontend (what you send to the people)

http://localhost:8082/

Backend (to create the survey)

http://localhost:8082/index.php/admin

I’m not going to dig more, since now it’s time to write the survey. Don’t forget to check how to configure the default answers and how to export the results. If anyone is interested, that is not always the case ๐Ÿ˜ฉ๐Ÿ˜ฉ๐Ÿ˜ฉ.

HOWTO: Get client OS and browser version with PHP

The OS, one after the other. Image taken from here.

You never know when you need to know more about your users. In that context, I’m now concerned about how to find out what runs on the client using a PHP page. I have implemented a version based on this stackoverflow post. I will not teach you how to modify the code – you should investigate that – but I want to do further remarks.

My problem: the OS information comes from the method $_SERVER['HTTP_USER_AGENT']. You can print the call to see what includes but you can’t get additional OS info, like, for example, macOS version (Mojave, Catalina, Monterey, etc). To complement that you could ask the web user to download a program or script, that he/she should run to gather the missing bigs. In Linux, the missing bits can be obtained normally from cat /etc/*release. Sample output:

$ > cat /etc/*release
CentOS Linux release 7.9.2009 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
CentOS Linux release 7.9.2009 (Core)
CentOS Linux release 7.9.2009 (Core)

The user should be able to run a bash wrap over that. In macOS, an option would be sw_vers. My output looks like this:

$ > sw_vers
ProductName: macOS
ProductVersion: 12.6
BuildVersion: 21G115

Also, very easy to wrap in a script. Once you have the info, the script can mail it to the server, you can ask the user to enter it onto another php formulary, or, I don’t know… ๐Ÿ˜”๐Ÿ˜” you can trigger a service call. Let’s hope there’s no need to do that ๐Ÿ˜‰.

Installing python3 on macOS 12.6 Monterey

Yeah I don’t know why I’m doing this, I rarely use python on my mac. I guess it’s just in case. I have followed this guide. I do have brew installed, but just in case, I will copy you the procedure.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Now we install python with brew:

$ brew install python

And that’s it. Note that it took quite some time to complete in my 2017 macbook pro, but maybe because the install triggered quite some brew updates. Please be patient ๐Ÿ˜‰.

A Leginon docker on CentOS 7.X – the leginon tutorial version

The logo, as taken from here.

Long time ago (2018) I started playing around with dockers and I cooked up a docker solution for our web-based EM DAQ system called leginon. I struggled to formulate a leginon container solution and I posted how to create a leginon docker on CentOS 7 also. Unfortunately our leginon expert left and I was no more asked to maintain the setup, so I didn’t have a look back onto it until recently. What changed is, as usual, that I spoke about leginon with someone from outside, so to say, that expressed his interest in my solution. For the records, my solution was no more working, since the base repository was missing, so I googled it just to find out that the original authors of the system, the NYSBC, was already providing a docker solution …since January 2022. And it works like a charm. Let me tell you about my experience. Here it is the docker leginon tutorial repository. I did it in my MacBook Pro, that is my workhorse for a lot of tests. I’ve downloaded docker desktop for macs, and in brief:

admin@macย  ~/Dockers $ > git clone https://github.com/nysbc/leginon-tutorial.git

admin@macย  ~/Dockers $ > cd leginon-tutorialย 

admin@macย  ~/Dockers/leginon-tutorial $ > ./run.shย 

After following the instructions, a fully functional myami web is available. Plus there’s a VNC interface to the docker install. And I’m ashamed of my previous work. Kudos to the NYSBC people. ๐Ÿ˜” ๐Ÿ‘ ๐Ÿ˜ฉ. Too late for me…

Locate your desktop background on macOS

It was weird for me that I was still having a certain background picture even after moving from iCloud it to my permanent photo storage. Then I realised that I don’t really know where macOS stores those pictures anymore. I mean, to add a background is easy, but after that where is the picture going?

There are a couple of places you can look at. One of them is the Library Cache. On a clean desktop, open the Finder folder and select menu Go -> Go to Folder or use the shortcut Shift + Command + G to access to /System/Library/Cache/Desktop Pictures. There you have the default ones, like the one above. My phantom picture is not there, so I go to the next location, /Library/Cache. I’m not sure if this is a different cache, but there it was my file, stored under a somehow random name. If you want to know more, check the StackExchange post about.

In order to find somehow a permanent solution (have we something permanent nowadays?) we can ask our OS to print the desktop picture path like displayed above (original post here). In a nutshell:

$ > cd /Applications/Utilities/
/Applications/Utilities $ > defaults write com.apple.dock
desktop-picture-show-debug-text -bool TRUE;killall Dock

And to remove it:

/Applications/Utilities $ > defaults delete com.apple.dock
desktop-picture-show-debug-text;killall Dock

I hope not to have anymore a phantom background now that I’ve made a post about it. ๐Ÿ˜๐Ÿ˜.

Avoid typing ssh passwords with sshpass on macOS

Again this is a tool that I thought I never needed. But I’m still working at home and I’m getting tired of typing the password each time I have a network connection issue. One second lost is not a lot, but that accumulated over the days can become minutes, specially if you work on different machines and you mistype because of an already hard butterfly keyboard on your MacBook Pro. We can (of course?) script ssh logins with password on Linux with sshpass, so I’ve decided to try the same on my macOS Big Sur 11.4. I have installed brew and I’m ready to use it. Let’s try it out.

user@macbookย  ~ $ > brew install sshpass
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "sshpass".
We won't add sshpass because it makes it too easy
for novice SSH users to

ruin SSH's security.

What a nice guys, caring for my security. Of course we should care. Let’s google it a little. This StackOverflow post suggests to use an unofficial brew. I’m unofficial also, so I try the first one. Unfortunately it doesn’t work. My error reads:

`brew extract` or `brew create` and `brew tap-new` to create 
a formula file in a tap on GitHub instead.:
Invalid usage: Non-checksummed download of sshpass
formula file from an arbitrary URL is unsupported! (UsageError)

Scary. Specially if we consider what we are trying to install. What if we end up installing some kind of password sniffer instead of our tool? Security is not my main field, but this is not meaning I don’t care about. Anyhow. Next brew formula does seems to do the job. This is my output:

user@macbook ~ $ > brew install hudochenkov/sshpass/sshpass
==> Tapping hudochenkov/sshpass
Cloning into
'/usr/local/Homebrew/Library/Taps/hudochenkov/homebrew-sshpass'...
remote: Enumerating objects: 14, done.
remote: Total 14 (delta 0), reused 0 (delta 0), pack-reused 14
Receiving objects: 100% (14/14), done.
Resolving deltas: 100% (3/3), done.
Tapped 1 formula (14 files, 9.2KB).
==> Installing sshpass from hudochenkov/sshpass
==> Downloading https://downloads.sourceforge.net/project/
sshpass/sshpass/1.06/sshpass-1.06.tar.gz
==> Downloading from https://deac-riga.dl.sourceforge.net/project/
sshpass/sshpass/1.06/sshpass-1.06.tar.gz
######################################### 100.0%
==> ./configure --prefix=/usr/local/Cellar/sshpass/1.06
==> make install
๐Ÿบ /usr/local/Cellar/sshpass/1.06: 8 files,
78KB, built in 34 seconds

Now what? Do we have it? It looks like. To end it up, I build a small script “connect_to” per each machine I want to connect. A sample one will look like this:

#!/bin/bash
export SSHPASS='MY-very-SECRET-password'
sshpass -e ssh -Y user@machine.domain.org

We save it, do chmod 777 and test it. There you have it. Better, right? ๐Ÿ˜Š

Notes: MacBook Pro cable less screen mirroring to Fire Stick

AirScreen, Something similar to what I saw – Image credits here.

Short story: search for AirScreen on your Fire Stick, and do screen mirroring from the control center with your MacBook.That’s it. Now please enjoy the long story if you want to have some fun ๐Ÿ˜Š.

On IT, there’s nothing easier than to connect a MacBook Pro with an additional monitor. Provided you have the cables or the adapters, of course, and that you can distinguish between an HDMI and a Display port. I do have all the cables you can imagine (I need them) but since I want to be ready for everything, I’ve decided to investigate how to connect wireless my MacBook with my Samsung TV + Amazon Fire Stick.

I could write another post about our digital ecosystem, but basically at home we have (several) Amazon smart assistants, configured with three languages and with different accounts, a Samsung TV, plus some smart bulbs that are not related. The computers are all macOS, that is, iPads and MacBooks. Not a single PC (or should I say not anymore?) if you exclude VMs. So if I find one way to wireless connect one mac to the TV, I expect it to work for the others.

One of the first blogs you stumble on if you search is this one, the firesticklab. They recommend the first AirScreen, but as I usually don’t trust the first recommendation ๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚I go for the second, AirBeam. You need to install it twice, once on your Fire Stick, and then on your MacBook. Once there and given the right permissions will add an icon on your top bar that is allowing me to screen cast to my Fire Stick. There is a delay of ~ 2 seconds between what you do and what you see on the TV, but it works. The problem is, I was asked to pay if you want to enjoy it more than 15 minutes. With all the respects for the developers, I don’t want to pay for something I can get for free, so I remove it.

After that success I try JustStream. The app gives me an interface very similar to AirBeam, and it’s adding also an icon to the top bar. But it doesn’t detect my TV. Why? I don’t want to waste my time, so I go ahead and I try the next option. All of them were giving me similar result (one icon that doesn’t seem to detect my TV). I need to say that my TV is not connected to the internet, but my Fire Stick is, so maybe in your case it will work. Anyway, I finally give up and go for AirScreen, since I see it recommended in more than one place. I followed this guide. Basically, as I wrote above, look for the app on the Fire Stick, install it, start it as written on the guide, and select Screen Mirroring on your ipad or MacBook control center. They say something about ads at one point, but so far, I was really not bothered with any. Maybe next time?

But now it’s time to enjoy some cable-less quality time โค๏ธโค๏ธโค๏ธ.