flak rss random

documentation is thoroughly hard

Documentation is good, so therefore more documentation must be better, right? A few examples where things may have gotten out of control.

more...

Posted 18 May 2017 20:24 by tedu Updated: 19 May 2017 02:48
Tagged: openbsd software

meaningful short names

Why don’t unix commands have any vowels in the name? cp and mv are obviously devoweled standins for copy and move. But they’re less intuitive for new users. The user wants to copy a file. Why shouldn’t the name of the command be exactly the operation the user wants to perform?

What exactly does the user want to do? Instead of copying files, maybe I want to link two files. What does that mean? In unix, we have hard links and symbolic links. If I replace the “original” file, do I want the link to refer to the original file or the replacement? Or maybe what I mean by link two files is to combine two object files into an executable. Do we call that loading instead? ln is the name of a command, but link is the name of a concept. And sometimes the concept evolves over time. The linker is called ld because it used to be the loader. (I think.)

grep is a remarkably useful tool, but with a most unintuitive name. Why not call it find like Windows does? I want to find some text, I run find. So obvious. But some users may want to find files in the filesystem, not strings in a file. What command do they run? Probably locate.

There may be a great deal of historical accident in the names of commands (what if the inventors of awk had different initials?), but that doesn’t mean we can’t recognize the value of unique and precise identifiers.

Posted 03 Mar 2017 02:31 by tedu Updated: 14 Jun 2017 22:55
Tagged: rants software

mplayer ktracing

In my ongoing quest to find the most inefficient software that still appears to work, I happened to notice that mplayer was chewing up 16% CPU while playing an MP3 (an audio format from the time before youtube). This was somewhat surprising because extrapolating back to the 20 year old computer I first used for MP3 listening, this would mean in excess of 100% CPU usage. Is efficient MP3 decoding really a lost art or was mplayer spending all its time doing something other than decoding? ktrace to the rescue.

more...

Posted 11 Feb 2017 18:45 by tedu Updated: 11 Feb 2017 18:45
Tagged: software

RC40 card cipher

The Solitaire cipher is perhaps the best known encryption algorithm implemented with a deck of cards. Ignoring security, it has a few drawbacks. It’s pretty complicated. I can never quite remember the rules. Sure, with practice it’s possible to memorize, but ideally we want something easy to teach. It’s also pretty slow. Even with practice, the shuffling and cutting manipulations take time.

more...

Posted 10 Feb 2017 14:27 by tedu Updated: 10 Feb 2017 14:27
Tagged: gadget security

openbsd changes of note 6

In a bit of a hurry, but here’s some random stuff that happened.

more...

Posted 07 Feb 2017 13:55 by tedu Updated: 07 Feb 2017 13:55
Tagged: openbsd

to errno or to error

Unlike other languages which have one preferred means of signalling an error, C is a multi error paradigm language. Error handling styles in C can be organized into one of several distinct styles, such as popular or correct. Some examples of each.

more...

Posted 24 Jan 2017 20:52 by tedu Updated: 24 Jan 2017 20:52
Tagged: c programming

Samsung 960 EVO

Thought I was happy with my gaming PC, but there was a Steam sale, and suddenly 256GB just doesn’t stretch as far as it used to. Even purchasing only a few games per year, at 20GB or so each, that’s not much. Looking for a bit of future longevity, decided to make the switch from SATA to NVMe. Best drive on the market is probably the Samsung 960 PRO. Saved some money by going with the EVO line, which might be the best value.

It’s an older motherboard, so I needed one of these gadgets to plug it in. Seems a bit silly to spend $20 for a bit of plastic and copper. No boot support, but that’s just fine. It’s only for storage.

It’s as fast as promised. For reference, the existing drive is a Samsung 840. Copying all the game data across, the destination drive was almost entirely idle. (For funsies, I made a second copy, both from and to the 960, and it screamed.)

Posted 07 Jan 2017 21:51 by tedu Updated: 07 Jan 2017 21:52
Tagged: computers gadget

python 3k17

New year, time for a new python, right? I’ve been sticking for python2 but two related events led me to try python3. The first was python3.6, which has a bunch of new features, notably finalized async support. No plans to actually use said support myself, but it seems like the kind of landmark feature that will convince other people to switch, so I figured I would hop on board. The second thing was python3.6 being available as an OpenBSD package. The scene was set for a day spent updating code. If you don’t use python, this will probably not be of much interest.

more...

Posted 05 Jan 2017 17:30 by tedu Updated: 05 Jan 2017 17:30
Tagged: python

turn your network inside out with one pf.conf trick

I think this falls somewhere a little short of common knowledge, but obvious once you know it. It lets machines roam in and out of the network without too much config fiddling. Instead, we configure machines to always use “cloud” services but intercept the packets to provide local services.

Here’s the pf.conf rules I have on my router.

pass in on cnmac1 proto { udp , tcp } from any to any port domain rdr-to 10.10.10.10 port domain
pass in on cnmac1 proto { udp , tcp } from any to any port ntp rdr-to 10.10.10.10 port ntp

This steals any DNS or NTP traffic bound for the internet and redirects it back to the local machine, servicing it locally.

Normally one gets a DNS server via DHCP, but I usually prefer to use 8.8.8.8. So I override that option in dhclient.conf. Works great outside the house. But when I’m home, then I really do want to use the local server because that’s the one that knows about other hostnames on the network. This lets me keep a hardcoded config on my laptop and fix it at the router.

Similarly with NTP, although the situation is a little different since we don’t usually get that from the DHCP server. Instead it’s configured once. I could use the ntp.org server pool, but it’s silly to have a half dozen machines each probing several upstream servers. For a while I used a config that pointed at the router directly, but then when I take a laptop on the road, it can’t sync time at all. Solution: point everything at time.google.com in ntpd.conf, and again have the router fix it up. (Bonus benefit: Windows and Apple machines will also now use the router’s time service with no config fiddling either.)

In short, permanently configure laptops for mobile use, and then configure the router to provide optimized services. This is typically easier than trying to configure the laptop to detect which network it’s using.

Posted 04 Jan 2017 09:16 by tedu Updated: 04 Jan 2017 09:16
Tagged: openbsd

openbsd changes of note 5

New year, old changes.

more...

Posted 03 Jan 2017 18:55 by tedu Updated: 03 Jan 2017 19:26
Tagged: openbsd