Every wondered what the timestamps on files on UNIX sytems mean?

Unix keeps three or four timestamps per file (or directory (or other random thing in the file system).

How to you take a list of files and do something with them in the UNIX shell? xargs is the key.

If you’ve run in to xargs, it’s probably in it’s most simple form:

1
xargs rm < list.txt

I’ve touched on shell aliases and functions a few times, today I wanted to get in to a little more detail on passing arguments to them.

BASH aliases don’t actually take arguments, but they will automatically append any argument to the underlying command line.

1
2
3
alias t=tail -f
t /var/log/apache/access.log
# expands to tail -f /var/log/apache/access.log

Another progress update on my RepRep 3D Prusa Mendel. After digging into the laying issue, I narrowed it down to a likely slicing issue. And, after a lot of research I was able to find the specs I needed for the particular hot end on my printer (a no longer supported version from Makergear).

The problem was that the layer height was to tall for extruder nozzle diameter, creating the gaps. Armed with the specs, I reconfigured Slic3r and the results are clearly better!

Previously while talking features of the HTTP Range header I wrote:

Last and likely least , you can read the last N bytes of a file by requesting a negative offset: […] Honestly, I’ve never come up with a use case for that.

A friend pointed out a possible use case, “tailing” a file on a server.

In my previous post about codeless APIs I made use the HTTP Range header to download only a portion of the file from a web server or cache (byte serving).

Because I was working in client side Javascript, I didn’t provide a Ruby example, which would look like:

1
2
3
4
5
6
7
8
require 'uri'
require 'net/http'

uri = URI("http://example.com/file-I-want")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.path)
request['Range'] = 'bytes=64-1024'
response = http.request(request)

For bonus points, response.code == 206 tells you that you got your “Partial Content”. A code of 200 would tell you that the Range was ignored and you got the whole file.

There a couple of other features of the Range header that are worth mentioning…

What if I told you that you could create a API backend that didn’t require any code? Crazy right? Wrong!

When I run into a problem I can’t and the Google doesn’t have it, I document it for the next person.

Recently, RVM started using GNU Privacy Guard to sign releases (a good thing!). However, when I tried to upgrade to the a signed release, GPG failed with:

1
gpg: public key of ultimately trusted key 00000000 not found

The gpg --check-trustdb and gpg --update-trustdb commands report the problem, but do not repair it.