Converting spreadsheets to text files with ssconvert

ssconvert is a utility shipped with Gnumeric, a command-line spreadsheet converter. It is useful when you have data in a spreadsheet and want to parse it from a script.

ssconvert -O 'separator=;' spreadsheet.ods spreadsheet.csv

This converts an ODS file to CSV using a semicolon as separator. sscon[……]

Read more

Firefox – prevent websites from refreshing

Fed up with websites and tabs continuously reloading themselves and using resources unnecessarily? Me too!

In Firefox, you can disable this from the about:config page. Type about:config in the address bar, accept the warning, and search for:

accessibility.blockautorefresh

Set it to true. Problem s[……]

Read more

How to update all docker base images with one command

To pull the latest version of all your Docker images at once:

for docker in $(docker images | awk '{print $1,$2}' | sed 's/ /:/g' | grep -v REPOSITORY); do docker pull $docker; done

This lists all images, extracts repository and tag, formats as repository:tag, and pulls each one.

After updating, o[……]

Read more

How to update all pip python packages with one command

To update all your pip-installed Python packages at once:

sudo pip install -U `pip list -o | cut -d ' ' -f1 | tr '\n' ' '`

This lists outdated packages with pip list -o, extracts their names, joins them with spaces and passes them to pip install -U. A one-liner that saves you from updating each pa[……]

Read more

Proxmox – Passthrough card/device to openVz container

I wanted to passthrough a dual tuner TV card (Hauppauge WinTV Nova-T-500) to an openVz container in order to use tvHeadEnd. The procedure should be the same for any PCI device.

First, identify the device you want to passthrough:

tree /dev/dvb/

This shows the device nodes under /dev/dvb/. Then moun[……]

Read more

Use Remmina to satisfy all your remote connection needs

Remmina is a remote desktop client that supports multiple network protocols — RDP, VNC, NX, XDMCP and SSH — in a nice and very user-friendly GUI.

In its basic usage, you only need to know the protocol, the server address, username and password.

Remmina basic connection tab

This works perfectly if you are in the same LAN. For c[……]

Read more

PHP: remove duplicate elements from a multi-dimensional array

This post is over 3 years old, so please keep in mind that some of its content might not be relevant anymore.

PHP’s array_unique() is great for removing duplicates from a flat array, but it chokes on multi-dimensional arrays. If you have nested data and need to remove duplicates, here’s[……]

Read more

Ban offending IP addresses – fail2ban

If you run a public SSH server, you will see failed login attempts in your logs constantly. Fail2ban monitors those logs and adds firewall rules to block offending IPs.

Here is what you see in /var/log/auth.log from a machine that has been online for a few days:

Nov 20 06:30:43 serverName sshd[63467[......]

Read more

Send system emails using gmail as smtp server

I wrote before about sending system emails using sendmail as a smarthost. Here is an alternative approach using Gmail SMTP servers — often simpler to set up for home servers and small VPS.

The software that makes this easy is called ssmtp. It is a lightweight MTA that forwards mail to a configured SM[……]

Read more