vankuik.nl

Latest weblog entries

2015-05-09 discovering bitrot with MD5

Except for modern filesystems such as ZFS and btrfs, your files aren't protected against so-called "bitrot". If, for some reason, a file is corrupted then you won't discover this and your normal backups might not have the correct file anymore. This is because the corrupted file has been backed up and your archives don't go back in time far enough.

There are a number of ways to protect against this:

  • Use a modern file system, which may not be practical at this moment.
  • Calculate hashes for your archived files and check to see if they haven't been changed somehow, with md5deep.
  • Create parity files that can not only check for damaged files but can also repair them: Parchive.

I went with the second option. md5deep is easily installable via Homebrew:

 $ brew install md5deep

To generate a file with hashes:

 $ md5deep -r -l testdirectory > testdirectory.md5deep

Explanation: -r means recursive, -l will use relative paths. This will create a file called "testdirectory.md5deep", where all files are written with their path and their hash.

To print all changed (damaged) files:

 $ md5deep -r -l -x testdirectory.md5deep testdirectory

Regularly, check the hashes against a directory that shouldn't ever change. For example, your archive of last year's family pictures. If one of the pictures got corrupted, then you know you should restore it from backup.

If you don't mind using a bit of extra space (as well as taking a bit of additional CPU time), then you can use par2. It installs nicely via Homebrew as well:

 $ brew install par2

Example command inside the directory with the files of your choice:

 $ cd testdirectory
 $ par2create par2file *

To verify:

 $ cd testdirectory
 $ par2verify par2file.par2

As an indication, a directory containing 1836 megabytes of photos and videos resulted in a couple of par2 files that took 93 megs, so about 5% of extra storage is necessary.

2015-05-09 DenyHosts no longer available on Debian 8.0 Jessie

When I was configuring a new Debian 8.0 ("Jessie") server, I noticed the very useful DenyHosts package is no longer available in the package repository. The package "sshguard" however, is available and according to my testing, works fine.

These packages block an IP address after a number of failed login attempts. This is very useful to counter brute-force attacks on your SSH server.

2015-05-05 Stop the new Photos app from opening automatically

Since the last Yosemite update, the new Photos app will open automatically when you hook up your iPhone or iPad.

To stop this from happening, open Image Capture (available in your Applications folder), connect your iOS device, select it in the upper left, and in the lower right corner, click the arrow up. Then change the dropdown to not do anything.

Stop Photos from opening.gif

2015-05-03 HealthKit error when uploading to the App Store

Currently I'm getting an error when uploading a new binary to the App Store:

Apps that use the entitlements [com.apple.developer.healthkit] must have a privacy policy URL for [English, Dutch]. If your app doesn’t use these entitlements, remove them from your app and upload a new binary.

I've been playing around with HealthKit, but to my knowledge I removed all traces from the project in Xcode. When I have a solution, I'll post it here.

Edit: StackOverflow to the rescue

2015-04-30 edit in vi from Xcode

Purely looking at the editing part, I find vi much more powerful than Xcode. If you want to do a quick edit in vi, then simply drag the file from the project navigator to an open terminal, and edit away!

quick vi from Xcode.gif

More...

Weblog Archive

Weblog entries 2015

Weblog entries 2014

Weblog entries 2013

Weblog entries 2012

Weblog entries 2011

Weblog entries 2010

Weblog entries 2009

Weblog entries 2008

Weblog entries 2007

Weblog entries 2006

Weblog entries 2005

Weblog entries 2004

All weblog entries

Articles

Articles, chronologically (latest first). This is pretty old stuff.

Scribblings

Not yet finished. Maybe will never be finished. Maybe they'll get deleted. Who knows?

Programming:

System administration:

Others:

Files: