I noticed that a lot of Instagram users, such as Alan Schaller to name but one, were posting images with thick white borders to make their images into the square images that Instagram favours. I like the striking look these images have in the Instagram gallery. I wondered for some […]
Unmount USB drives from a script in macOS
I have a number of external drives hanging off my laptop, but sometimes I want to disconnect them. I used to go into Finder and click the eject button but I have five drives now so that’s getting unwieldy. There are a few different ways of doing this. I wrote […]
Howto disable syntax highlighting in Vimdiff
X > Y >> Z Where X is the population of developers who read this blog, Y is those that use Vim and Z is those that use vimdiff regularly. I guess this post will only be useful to a tiny minority of my readers, but to them it might be […]
Find Duplicate Files in MacOS
In the past I’ve used FSLint or even some BASH magic to find duplicate files but I have a huge archive of photos and videos, some of which were renamed during import, and some were accidentally imported more than once, or moved about. It’s somewhat chaotic So I was very […]
set -o vi FTW
The Bash command line can be edited using the cursor keys but for the real power user you need to enable Vi mode: $ set -o vi Or add it to one of your Bash startup files. Now, instead of the slow interactive editing you’ll get the command and insert […]
The best thing about Mac OS X
The best thing may well be the Bash command prompt and MacPorts.* * most Mac owners probably won’t agree with me.
Fix file (644) and directory (775) permissions in Linux easily
A few weeks back I was sorting out the drives on my Linux server and as some of the directories were created through various configurations of Samba by Windows clients the permissions were a bit odd. Some archive files were executable, some directories were rw only for the owner. You […]
Bash: compare two directories
In Unix based systems like Linux and Mac OS X there are a number of ways of comparing two directories. The simplest way is to use diff: diff –brief -rb directory_1 directory_2 This command compares each file and reports if they differ. You can find the meanings of the options […]
Who's abusing your website?
I wanted to know what IP addresses were hitting my website. I’d done this before and it only took a moment or two to recreate the following commands. Still, here it is for future reference. grep -v “wp-content” access.log|grep -v wp-includes|cut -f 1 -d ” “|sort|uniq -c|sort -nr|less This code: […]
How to loop over filenames wit …
How to loop over filenames with spaces – I knew this, but it had disappeared in the recesses of my brain. > for f in `cat /pathtolist/mp3.txt` do cp “$f” /newdirectory done You didn’t say exactly how the file is organised, so I’m going to guess one filename per line. […]