A collection of tips and tricks...

Best Screen Capture for macOS

The best tool out there that I have found is Skitch.

Whats great with Skitch, is that it’s awesome to capture screenshots and annotate them right in the app and being able to just copy paste the annotated screenshot to any other application, be it Skype for Business, e-mail or Microsoft Teams. It just works, and what’s even better, it includes free synchronisation of screen snaps to Evernote.

So if you ever look for a great screen snap/screen shot utility for macOS, look no further!

(This is not a paid advertisement)

Three finger drag! MacOS Trackpad

Hi future me (and anyone else who stumbled upon this page), this is how you turned on three finger drag:

Yes I know, you thought it was under “Trackpad” in Preferences, but Apple hide this setting under Accessibility.

MacOS Terminal UTF-8 Issue

Since I only tend to do this once every time I get a new MacBook, I decided to document the procedure here so I don’t have to google it every time!

  1. Open Terminal
  2. Open Preferences ⌘,
  3. Goto Advanced
  4. Uncheck “Set locale environment variables on startup”

No ports showing in LibreNMS for Fortigate Firewalls

After looking at GitHub for a solution I consulted the very helpful people in #LibreNMS at FreeNode (IRC) and got this solution.

Add this line in you config.php:
$config['os']['fortigate']['empty_ifdescr'] = 1;

And guess what, it works!

Why does LibreNMS behave like this? Well, it’s because LibreNMS assumes that there should be a “ifdescr” in the SNMP answer from the Firewall, while Fortigate has removed this in order to be compliant with an SNMP RFC that says that there should be no ifdescr if there is no description text for the interface. At least that was the information I was able to gather from the conversation on IRC and github/Internet!

Remove all old kernels on your Ubuntu

When you login to your system and /boot is full, don’t panic!

Run this command and lean back, take a cup of coffee and relax, breath!

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

When it’s done, it’s a good idéa to:

apt-get update && apt-get upgrade && apt-get dist-upgrade

Once again, lean back, take a cup of coffee, find your inner zen!

Source: http://askubuntu.com/questions/2793/how-do-i-remove-old-kernel-versions-to-clean-up-the-boot-menu

Backup you VPS to Google Drive

If you only have a small amount of data to backup, Google Drive is actually quite a decent alternative, but you will need to install a few tools to you VPS.

With the tool rclone (rsync for cloud), you can upload your files to Google Drive, Amazon S3, Dropbox and a few more. The procedure is almost the same no matter of the cloud provider you go for.

Just goto: http://rclone.org/

Install rclone as described and then setup a cronjob to sync the files that you want to Backup.

My crontab to backup the automysqlbackup folders:

# m h  dom mon dow   command
  0 *   *   *   *    export PATH=$PATH:/home/siho/bin && rclone -q sync /var/lib/automysqlbackup/ remote:Backup/automysqlbackup

Make your Raspberry Pi Netboot over NFS

When I started using my first Raspberry Pi, I read about people having to change their SD-card every now and then because most (especially cheap) SD-cards are not made for being used as a harddisk replacement. So I googled a bit and setup NFS boot for my Raspberry Pi. Tested on Raspberry Pi Model B, B+ and 2.

This is what your cmdline.txt should look like, of course change the necessary information to correspond with your own environment.

ip=dhcp netboot=nfs boot=NFS= disk=NFS= ssh quiet fastboot

…and of course you need to have a working NFS server with corresponding exports…

This is my /etc/exports

/Users/siho/openelec/storage -mapall=siho:staff

And yes, for observant readers, this is run on an OS X machine, but should work with any other BSD or Linux-system as well 🙂

Fix WordPress Menu Crash

Ever had a WordPress site with a huge amount of items in the Menu? Well I have (not this one), and after adding a menu item one day, the whole menu crashed, and with crashing I mean, it was written out as plain text over the whole page instead of being a neat menu in the header.

So, after some searching online, if found a bunch of people all complaining about this, some even suggesting you should buy a “mega menu plugin” to solve the problem.

Well actually, the problem is not in the WordPress or in the theme. Well, one might argue that it’s the way WordPress saves the menu, while it’s being edited that’s actually the problem, but never the less the problem is actually that there are limitations in PHP for how many input variables you are allowed to post in one transaction, so just login to your webserver, and edit your php.ini.

In my case I edited /etc/php5/apache2/php.ini and added the following on the end of the file:

; WordPress Edit Menu Fix
max_input_vars = 5000