Monday, December 29

What follows is a grab bag of stuff I wrote some time in the past year or so but never polished enough to feel like I should post it. It may be garbage, but just this one time I’m going to clear out my work-in-progress directory by doing something besides rm *.

more: html isolation novel trust

Sunday, December 28, 2014

candles & candlemaking

A year ago at Christmastime, I decided to see what kind of candlemaking supplies were still at my parents' house, and wound up digging a couple of big Rubbermaid tubs worth of molds, dyes, additives, wick, wax, &c out of the basement.

I used to do this a lot, but I’ve mostly forgotten the details of technique.

Rough notes:

  • Wax temperature when pouring is important. I’m aiming for 210-220 F with metal molds, but it’s hard to get there with the little hot plate I’m using. I can usually get it just over 200, according to the thermometer I’ve got. This doesn’t seem to be doing too much damage, but I do think the results would be a little better with hotter wax.
  • You’re supposed to use a proper double boiler or a purpose-built wax melter. I put various sizes of can in some water in a medium size pan.
  • I remember that I used to melt wax on the woodstove in my dad’s shop, but if so we must have been running the stove hotter in those days or I had a lot more patience. it does work well for holding wax at a reasonable temperature until you have to do a second pour.
  • With metal molds, keeping the wax from streaming out the wick hole at the bottom is often kind of problematic. I think you’re supposed to affix the wicking with a little screw and put some tacky putty-type stuff over the screw, but if you’re low on the putty or don’t have just the right size screw this doesn’t work so great. Things tried this time around: The remaining putty and then everything kind of smashed down on a wood block (Ben’s idea), pouring a little wax in the bottom and letting it harden first, the wrong size screw, silicone caulk. The wood block and the silicone caulk both worked pretty well.
  • You can dye beeswax, but you have to keep in mind that the stuff is already pretty yellow and opaque. Shades of green work well. Other colors… Well, I wound up with some the color of a strange weird woodland fungus.
  • Last time I did this, I wound up with a bunch of pillars that burned really poorly and with a small flame. I think I wasn’t using a heavy enough wick. Tried to go with heavier braided wicking this time. Guess I’ll see how that pans out.

Tuesday, December 23, 2014

screenshots

Looking to streamline capture of static screenshots a bit. Options:

  • gnome-screenshot - use this already, it’s fine, whatever.
  • shutter - weirdness with my xmonad setup? Errors and I don’t feel like taking the time to find out why.
  • scrot - buncha nice command line options

I wind up forking Tyler’s grab, a nice wrapper for scrot, which is pretty much what I was going to write anyway.

This is pretty good at defining a region for a static screenshot.

Monday, December 22

tiny letters

As a kind of counterbalance to things I’ve said lately about e-mail, I want to talk about some mass mailings I really love getting — things that feel like they make me a little smarter or a little better or a little less broken.

A bunch of them are using TinyLetter, which is a simple but evidently well-crafted service for sending newsletters. It’s possible (indeed, nearly inevitable) that one day this will go sour and some depressing person will use the presence of my address in a bunch of subscription lists maintained by TinyLetter to spam me,1 but in the mean time I’m enjoying them.

One of these I have mentioned before is 6, by Charlie Loyd, who I do not always agree with but who is almost always saying something I am interested in hearing. The dude makes me wish I were smart enough to have the kind of ideas he has, but somehow does this without making me feel any dumber. Like this:

The best guesses, and they are just guesses, suppose that most writing was invented in a very piecemeal way. This is hinted at by the way we can trace our letters back to pictograms, for example. Probably people were just drawing for a long time, then write-drawing rebuses for a while, and sort of communally pushed each other toward more abstract, fluent writing-writing. Not Ssiquaya! He had an existence proof, so to speak. He had evidence to believe that writing was possible, although not enough evidence to convince other reasonable people. And from that alone, independently, he invented systems in three major types of writing, one of which completely succeeded. Can you imagine that? To truly teach yourself to read and write? To never have someone say a word while pointing at it, to lay those tracks in front of your own moving train? I can’t. I can’t wrap my head around that much imagination, that much mental power and precision.

Also, sometimes he just really lays it down on the whole speaking-for-those-of-us-from-the-provinces front. A sample of this latter, from a paragraph later in the same newsletter:

I refer to the ability of the New York Times to both believe that it has free reference to the entire world, and to express fall-over-flat astonishment that people live and work and think and interact anywhere outside the Five Boroughs. The vigor of mind needed to patronize Kansans that hard and that shamelessly is simply astonishing. Sure, it’s gross and weird, but you have to admire the sheer difficulty of what they’re pulling off. They manage to make the fact that a town receives a classic rock station sound like quaint local color. How? All over the country, expert writers and editors are hunched over sentences like that one, peering through microscopes, debating, whiteboarding diagrams, pacing, running the words letter-by-letter through supercomputers, trying to understand how the NYT can strike tones that rude and foolish.

Another: Metafoundry, which almost always manages to make me think about something in a way I otherwise would have failed to do, and been worse for it.

Another: Pome, which is a daily bit of poetry. I don’t read every single one, but most of the time I read one, I’m reminded how much poetry I like, and how much I like poetry itself, and how much of the expression that I want to find in the world can be found in poems, and these are all things that it is for whatever reason desperately hard for me to remember in 2014.

I feel kind of weird writing about some of these mailings on the web (let alone quoting from them), even though they are openly subscribable and their archives can be found on the web if you take just a moment to look. I worry that maybe I’m on the edge of violating some expectation of a space that is not exactly private, but is also not entirely public in the way that the big, broadcast web and the big, broadcast mode of publishing and communicating on the web has become.

But then I guess that neither, exactly, is this web site that I’ve been haphazardly tending for so long. I feel ok talking a little about what people are writing in not-too-public spaces specifically because I have an audience, if it can even be called that, of close friends and scattered internet acquaintances of more-or-less demonstrated goodwill. There are no access controls on this page, but neither is it likely to be read by more than a few dozen people, most of them known to me. (On that very rare occasion when I do come to the attention of a few thousand readers, this site also fails to offer them a quick and easy platform for being horrible about anything, which is not exactly irrelevant to a continued sense of smallness and relative safety.)

I have been thinking a lot about the internet that feels decent and kind and safe enough for human presence. I’ve recently experienced it again in places like the tildeverse and little IRC channels on obscure, out of the way private servers: Places that are explicitly constrained by membership, or implicitly less-than-public by virtue of being known and interesting to only a few.

One way to explain some of what I’ve been noticing are formulations my parents probably learned from their parents or grandparents: The “good fences make good neighbors” and “locks keep honest people honest” models of the world. And this is not altogether a bad way to understand things, especially when I think about the farming communities it’s situated in.

But thinking about small towns (like the one I grew up near, and the one I live in now) and small spaces on the net gets me back to something else that we talk about a lot in the technical world: Scale.

I’ve probably tried to talk about this before and failed, but it seems to me like most of the conversations you hear about scale, in the overlapping domains of software/systems and organization/business/politics, go like one or more of these:

  1. We are small. How can we get big?
  2. We are getting bigger. How should our systems handle that?
  3. We are big. How can we get huge?
  4. We are huge. How can we stay huge?
  5. We were huge. What happened?

Not all of these conversations presuppose that scale is a good thing. People will tell you that they want their company or project to stay small, that they like working on a small team, and so on. That they miss the days when x forum or x network was more intimate. But expansion is so much the economic logic of so many undertakings, and more users so much the metric of success for software/network projects, that these parts of the discussion usually feel more like ritual invocations than anything else. The inescapable is this idea:

  1. If we are huge, then money and power.

Even when the desire to limit growth or prioritize things other than more/bigger is expressed as policy, it rarely has teeth and tends to evaporate in the face of money (or perceived money).

All of which makes it hard for internet people to grapple with all the ways that scale can be poison, all the ways it amplifies and massively distributes the social pathology we are seeing so much of lately.

Misogyny and racism and griefer behavior as mass culture. Circular-firing-squad activist outrage discourse. The technical conversation as a relentless and unbelievably cruel turf war. This stuff has been both latent and active in the network for its entire history, but for a while it has been something almost like a natural disaster in progress. Which is an idea I invoke not so much to absolve the bad actors who nurture and coordinate and act as cogs in the distributed machinery of being a vicious shithead on the internet, but rather to help explain how they have come to occupy so much of the bandwidth.2

The internet used to be a patchwork of little protocols and little systems that turned out, as everything grew, to be intrinsically vulnerable to trolls, griefers, creepers, know-it-alls, spammers, and the near-mechanical certainty of outrage storms. For a long time I’ve talked about, for example, how e-mail was designed spammable and this is a fundamental breakage. I think everybody knows it. But then again as I’ve revisited some of those forms and withdrawn into small network scenes from big ones like twitter and reddit, I’ve started to wonder how much those structural vulnerabilities are the actual problem and how much is just the mathematical certainty of emergent pathology at scale.

To put it another way, I live a lot of the best and healthiest parts of my meatspace life in kitchens and living rooms and campgrounds. How many of these places wouldn’t be scenes of abject horror, or at least gravely damaged, if they were rebuilt as broadcast projections?

As an addendum, I think a bunch of the above is unconsciously ripped-off from, among other places (including most probably writers with TinyLetters I subscribe to and people with tilde.club blogs), Tiny Letters to the Web We Miss, by Joanne McNeil:

Self-publishing online was fluid and inviting in the early years because the community was self-selecting — the sort of people who would know what Blogspot was in 2003. I didn’t worry about my boss finding my blog. I didn’t worry about getting rape threats in the comments either. (Just thinking about how absurd that sentence would have sounded in 2003 is giving me a crater-sized hit of nostalgia.) We didn’t have the same worries over public personas, because the internet felt like it was just us.

Blogging before social media was like drinking with friends. If someone adjacent to your conversation said something interesting, you would pull up a chair and invite them in. Sometimes a friendly stranger would even buy you a drink.

1 Given that TinyLetter's owned by the MailChimp people, I'm going to assume bleedover and entanglement between databases and metrics tools of some kind. Oh well. At least it's a very-explicitly opt-in model on a per-list basis right now.

2 And maybe part of how I myself have found it so easy to be drawn into ugly flamewarrior nonsense on plenty of occasions. I got no excuses, but why is the temptation so strong, other than that I'm kind of a jerk?

Friday, December 19, 2014

{timetracking}

So hamster really doesn’t scratch my particular itch all that well. Rather than devote any serious brain energy to finding or writing a replacement that does, I’ve decided to just use a text file.

It looks like the following:

2014-12-17 21:55 - 2014-12-17 11:40
2014-12-18 10:05 - 2014-12-18 12:50
2014-12-18 13:45 - 2014-12-18 16:00

This is just two datetimes for each range of time when I’m working on a given thing, delimited by / - /. I just want a quick script to tally the time represented. (Later, if I need to track more than one project, I’ll expand on this by adding a project name and/or notes to the end of the line.)

It kind of seems like I should be able to do this with GNU date, but let’s find out. Here’re the official examples. This sounds about right:

To convert a date string to the number of seconds since the epoch (which is 1970-01-01 00:00:00 UTC), use the –date option with the ‘%s’ format. That can be useful in sorting and/or graphing and/or comparing data by date. The following command outputs the number of the seconds since the epoch for the time two minutes after the epoch:

    date --date='1970-01-01 00:02:00 +0000' +%s
    120

As a test case, I start here:

$ cat ~/bin/timelog
#!/usr/bin/env bash

date --date="$1" +%s

$ timelog '2014-12-17 21:55'
1418878500

Ok, groovy.

I was going to do the rest of this in shell or awk or something, but then I thought “I should not spend more than 10 minutes on this”, and wrote the following Perl:

#!/usr/bin/env perl

use warnings;
use strict;
use 5.10.0;

my $total_hours = 0;

# while we've got input from a file/stdin, split it into two datestamps
# and feed that to date(1)
while (my $line = <>) {
  chomp($line);
  my ($start, $end) = map { get_seconds($_) } split / - /, $line;
  my $interval = $end - $start;
  my $hours = $interval / 3600;
  $total_hours += $hours;
  say sprintf("$line - %.3f hours", $hours);
}

say sprintf("%.3f total hours", $total_hours);

sub get_seconds {
  my ($stamp) = @_;
  my $seconds = `date --date="$stamp" +%s`;
  chomp($seconds);
  return $seconds;
}

Which gives this sort of output:

brennen@desiderata 14:54:38 /home/brennen/bin (master) ★ timelog ~/notes/some_employer.txt
2014-12-15 13:10 - 2014-12-15 14:35 - 1.417 hours
2014-12-16 10:00 - 2014-12-16 12:55 - 2.917 hours
2014-12-16 14:00 - 2014-12-16 17:15 - 3.250 hours
2014-12-17 15:00 - 2014-12-17 16:51 - 1.850 hours
2014-12-17 21:55 - 2014-12-17 23:40 - 1.750 hours
2014-12-18 10:05 - 2014-12-18 12:50 - 2.750 hours
2014-12-18 13:45 - 2014-12-18 16:00 - 2.250 hours
2014-12-18 17:00 - 2014-12-18 17:30 - 0.500 hours
16.683 total hours

This is me once again being lazy and treating Perl as a way to wrap shell utilities when I want to easily chop stuff up and do arithmetic. It is many kinds of wrong to do things this way, but right now I don’t care.

If this were going to be used by anyone but me I would do it in pure-Perl and make it robust against stupid input.

drawing tools

Ok, so because I’m starting to poke at drawing again for the first time in quite a while (even to the extent that I’ll soon be publishing some stuff that includes cartoon graphics, despite having no idea what I’m doing), I thought I’d take some rough notes on where I’m at with toolset.

The first thing is that I’m not using any Adobe tools, or indeed any proprietary software (unless you count the firmware on my cameras and maybe Flickr) to work with images. I am fully aware that this is a ridiculous limitation to self-impose, but I want to stick with it as best I can.

For a long time, I’ve sort of fumbled my way through GIMP whenever I needed to do the kind of light image editing stuff that inevitably comes up in the life of a web developer no matter how many things you foist off on your Photoshop-skilled, design-happy coworkers. I think GIMP gets kind of an unfair rap; it’s a pretty capable piece of software. That said, I’ve still never really put the time in to get genuinely skilled with it, and it’s not the most accessible thing for just doodling around.

Several years back, I bought a cheap Wacom tablet. I was maybe a little optimistic in that writeup, but I still really enjoy MyPaint. The problem is that, while it’s really fun for a sketchy/painty/extemperaneous kind of workflow, and dovetails beautifully with the tablet interface, it deliberately eschews a lot of features that you start to want for editing an image. I don’t blame its developers for that — they’re obviously trying to do a certain kind of thing, and constraints often make for great art — but I’m wondering if I can’t get some of the same vibe with a tool that also lets me easily cut/copy/scale stuff.

I’m giving Krita a shot with that in mind. It has a real KDE vibe to it. Lots of modular GUI widgets, menus, etc. A little bureaucratic. It doesn’t feel as fluid or immediate as MyPaint right out of the gate, but it’s definitely got more in the way of features. Could grow on me.

Thursday, December 18, 2014

screencast gifs

Looking to make some GIFs of things that happen on my screen, found byzanz.

$ sudo apt-get install byzanz
byzanz-record -x 1 -y 1 --delay=4 -h 150 -w 700 hello_world.gif

Options:

  • -x and -y set origin of capture on screen
  • -h and -w set height and width to capture

I think I need a more clever way to trigger / manage this than just fiddling with CLI options, but it works really well and produces lightweight image files.

I think it would be cool if there were a utility that let me use arrow keys / hjkl / the mouse cursor to visually select a region of the screen. It could return x, y, height, and width, then I’d let byzanz handle the capture.

That can’t be the hardest thing in the world to do.

xdotool seems like kind of a swiss army knife, and has a getmouselocation command. Theoretically, at least, you can have it respond to events, including a mouse click. I can’t quite wrap my head around how this is supposed to work, and my first few attempts fall flat.

GNU xnee might also be promising, but I don’t really get anywhere with it.

Eventually I find an Ask Ubuntu thread on creating screencast gifs, which points to xrectsel, a tool for returning the coordinates and size of a screen region selected with the mouse:

brennen@desiderata 22:06:28 /var/www/workings-book (master) ★  xrectsel "%x %y %w %h"
432 130 718 575%

I wind up with gif_sel:

#!/usr/bin/env bash

# requires:
# https://github.com/lolilolicon/xrectsel.git

eval `xrectsel "BYZANZ_X=%x; BYZANZ_Y=%y; BYZANZ_WIDTH=%w; BYZANZ_HEIGHT=%h"`
byzanz-record -x $BYZANZ_X -y $BYZANZ_Y --delay=4 -h $BYZANZ_HEIGHT -w $BYZANZ_WIDTH ~/screenshots/screencast-`date +"%Y-%m-%d-%T"`.gif

I’ll probably wind up with a couple of wrappers for this for different lengths of recording (for starting with dmenu), though it would be nice if I could just have it record until I press some hotkey.

Wednesday, December 17

I'm writing a bit about the command line again (surprise), and I hadn't read In the Beginning was the Command Line in ages. Somehow searching for that one got me reading this Neal Stephenson interview on Slashdot.

I haven't thought all that much about Slashdot in quite a while — probably since the first time something I was responsible for got slashdotted, which must make it five years or better. I have to guess that a lot of what used to draw me there would leave me cold these days, but I'm enjoying this one. I think maybe I appreciate the quiet sanity of thoughts like

I can never get past the structural similarities between the singularity prediction and the apocalypse of St. John the Divine.

more than I did a decade ago.

Wednesday, December 10, 2014

listusers / squiggle.city repo

There’s now a squigglecity organization on GitHub. What little is there is a classic duct-tape mess complete with a bunch of commits made as root, but may contain a few useful bits.

I’m planning to clean up this version of listusers.pl into a more generic listusers utility that just outputs TSV and pipe to csvkit / jq for HTML & JSON.

Oh, right — about the JSON. ~ford proposed a standard tilde.json kind of like this, which I think is not a terrible idea at all though that one’s a bit rough and the format could still use a little tweaking as of this writing.

This is the kind of thing it’s unbelievably easy to overthink. I’m hoping we’ll give it enough thought to do a few smart things but not so much thought that no one actually uses it.

Monday, December 8, 2014

ssh

I use SSH for damn near everything. We need SSH for damn near everything.

I have this thought that SSH is quite possibly the only end-user-exposed implementation of acceptable crypto in wide use which actually satisfies the “actual human beings can use this” constraint at the same time as satisfying the “this makes your shit relatively secure” constraint. That’s not to say it’s easy for the average mortal to comprehend, but it beats the shit out of almost everything else I can think of.

In “almost everything else”, I include SSL/TLS/HTTPS, which sort-of works as far as the general user population of browsers is concerned, much of the time, but which is an absolute nightmare to administer and which is a fundamentally broken design on a political / systems-of-control / economic / regular-admins-get-this-right level. Arguably, the only thing that has been worse for the wide adoption of crypto by normal users than SSL/TLS is PGP.

DISCLAIMER: I DON’T KNOW SHIT ABOUT CRYPTO. Tell me how I’m wrong.

mosh

I’m not exactly sure when mosh started to catch on with people I know, but I’d say it’s on the order of a year or two that I’ve been aware of it. The basic thing here is that it’s essentially OpenSSH with better characteristics for a specific cluster of use cases:

  • laggy, high-latency, intermittently-broken network connections
  • client machines that frequently hop networks and/or suspend operations
  • unreliable VPNs (which is to say very nearly all VPNS in actual use)

time tracking

I’m about to start in on some remote contracting stuff, so I go looking for a time tracking tool. For the moment I settle on this little tray widget called hamster, which looks functional if not precisely inspiring.

noobs / raspbian

Last year I did a bunch of work on a Raspberry Pi, but it’s been a few months since I booted one up. I got a model B+ (more USB ports, various hardware tweaks, takes a microSD card instead of the full-size one) in my last employee order at SparkFun, and I’m stepping through what seems to be the stock recommended installation process.

  • http://www.raspberrypi.org/new-raspbian-and-noobs-releases/
  • http://www.raspberrypi.org/downloads/
  • http://downloads.raspberrypi.org/NOOBS_latest.torrent

I torrented NOOBS_v1_3_10.zip. Be careful unzipping this one - everything is at the top level of the archive (advice to distributors of basically anything: don’t do that).

If I’d been smart I probably would have done:

$ mkdir noobs && unzip NOOBS_v1_3_10.zip -d noobs/

The basic system here is “get an SD card, put the stuff in this zip file on the SD card, put it in the Pi”. Everything about this has always felt kind of weird (if not actively broken) to me, but it’s probably important to remember that for most users “put some files on this media” is a lot easier than “image this media with the filesystem contained in this file”.

So I plug in all the stuff: microSD card, keyboard, HDMI cable to random spare monitor, power.

Nothing. Well, almost nothing. Blinkenlights, no video output. Red light is steady, green light blinks a couple of times periodically.

I am reminded that this is, fundamentally, a terrible piece of hardware.

Power down, remove SD card, mount SD card on Linux machine, google variously, delete and recreate FAT32 partition using gparted, re-copy NOOBS files, unmount SD card, replace card in Pi, re-apply power.

Green LED flashes spasmodically for a bit then seems mostly off, but is actually flickering faintly on closer examination. Red light is solid.

This wiki page suggests this means that no boot code has been executed at all. It’s failing to read the card, or it’s missing some file, or something is corrupt.

Ok, so, mount SD card on Linux machine again; immediately discover that the card is now a volume called “SETTINGS”, or seems to be.

$ ls /media/brennen/SETTINGS
lost+found
noobs.conf

$ cat /media/brennen/SETTINGS/noobs.conf
[General]
display_mode=0
keyboard_layout=gb
language=en

brennen@desiderata 15:52:24 /home/brennen ★ sudo parted /dev/mmcblk0
GNU Parted 2.3
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  823MB   822MB   primary   fat32        lba
 2      826MB   15.9GB  15.1GB  extended
 3      15.9GB  15.9GB  33.6MB  primary   ext4

(parted)

Well, obviously something ran, because I definitely didn’t arrange anything that way. And this seems a little telling:

brennen@desiderata 15:55:36 /home/brennen ★ dmesg | tail -12
[51329.226687] mmc0: card aaaa removed
[51776.154562] mmc0: new high speed SDHC card at address aaaa
[51776.154894] mmcblk0: mmc0:aaaa SL16G 14.8 GiB 
[51776.169240]  mmcblk0: p1 p2 < > p3
[51781.342106] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
[51791.757878] mmc0: card aaaa removed
[51791.773880] JBD2: Error -5 detected when updating journal superblock for mmcblk0p3-8.
[51793.651277] mmc0: new high speed SDHC card at address aaaa
[51793.651601] mmcblk0: mmc0:aaaa SL16G 14.8 GiB 
[51793.666335]  mmcblk0: p1 p2 < > p3
[51799.516813] EXT4-fs (mmcblk0p3): recovery complete
[51799.518183] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)

(The “Error -5 detected bit.)

Ok, so I bought a new Sandisk-branded card because I didn’t have a decently fast microSD card laying around. What I’m going to check before I go any further is whether I got one the Pi can’t deal with. (Or just one that’s bunk. I bought this thing for 15 bucks at Best Buy, so who knows.)

Here’s an 8 gig class 4 card, branded Kingston, but I probably got it off the shelves at SparkFun some time in the last 3 years, so its actual provenance is anybody’s guess. Looking at what’s on here, I’ve already used it for a Raspberry Pi of some flavor in the past. Let’s see if it’ll boot as-is.

Ok, no dice. I’m starting to suspect my problem lies elsewhere, but I’ll try one more time on this card with NOOBS.

Again: No dice.

Also checked:

  • the monitor with other inputs, because who knows
  • tried a couple of different power supplies - USB cable from my laptop, 5V wall wart purchased from SFE, cell phone charger.
  • the usual plug-things-in-one-at-a-time routine.

Time to try one of these cards with an older RasPi, if I can figure out where I put any of them.

After much shuffling through stuff on my dining room table / workbench, I find a model B. It fails in much the same way, which leads me to suspect again that I’m doing something wrong with the card, but then I can’t quite remember if this one still worked the last time I plugged it in. They can be fragile little critters.

Here’s a thought, using a Raspbian image I grabbed much earlier this year:

brennen@desiderata 17:10:03 /home/brennen/isos ★ sudo dd if=/home/brennen/isos/2014-01-07-wheezy-raspbian.img of=/dev/mmcblk0

No dice on either the model B or model B+, using the new SanDisk.

Trying with the older card, dd spins through 800ish megs before giving me an I/O error.

It may be time to start drinking.

The next day: I swing through a couple of stores in town with the wiki list of known cards in hand and buy a pile of cards across a handful of brands, plus a $20 card reader (the Insignia NS-CR20A1) since there’s not one built in to the laptop I’m carrying today. The first card I try boots NOOBS instantly; an installer is running as I type this.

Suddenly It occurs to me that the card reader on the laptop I was using last night might is likely dying/dead.

This is a really slick install process now, so good work to somebody on that.

beaglebone black

I’ve got a Beaglebone Black sitting here new in the box. It comes with a USB cable, so I plug it in. Instantly there are bright blue blinky lights, and my laptop tells me I’m connected to an ethernet network and I’ve got a new drive mounted with some README files in it.

This is kind of great.

Browsing to to 192.168.7.2 gets a bunch of docs and a link to Cloud9, an in-browser IDE that happens to include a root terminal.

I don’t really know what’s going on here. I think it might be a little scattered and confused as a user experience, in some ways. But it immediately strikes me as good tech in a bunch of ways.

Josh Datko, who I’ve gotten to know a little bit, has a book called Beaglebone for Secret Agents. It’s been on my ever-growing to-read list for a while; I’m going to have to give it a look sooner rather than later.

reading list

  • http://www.jann.cc/2013/01/15/trying_out_the_adafruit_webide.html
  • http://www.angstrom-distribution.org/
  • http://www.raspberrypi.org/documentation/configuration/config-txt.md

Sunday, December 7, 2014

notes directory

On organizing todo lists, see the p1k3 entry from August of 2014.

For years now, I’ve kept that sort of thing in a notes.txt. At some point notes.txt got its own directory with a haphazard jumble of auxiliary files. It looks like I turned that directory into a git repository a couple of years ago.

Unlike a lot of what I keep in git, ~/notes/ isn’t meant for any kind of publication. In fact, it’d be pretty dumb to let it out in the world. So I got to thinking: I should really encrypt this.

So what’s the best way to encrypt a single directory on Linux?

Two search strings:

  • linux encrypted directory
  • encrypted git repo

It looks like maybe eCryptFS is the thing? This machine’s an Ubuntu, so let’s see what we can find:

$ apt-cache search ecryptfs
ecryptfs-utils - ecryptfs cryptographic filesystem (utilities)
ecryptfs-utils-dbg - ecryptfs cryptographic filesystem (utilities; debug)
libecryptfs-dev - ecryptfs cryptographic filesystem (development)
libecryptfs0 - ecryptfs cryptographic filesystem (library)
python-ecryptfs - ecryptfs cryptographic filesystem (python)
zescrow-client - back up eCryptfs Encrypted Home or Encrypted Private Configuration

Google suggests that ecryptfs-utils might be what I’m looking for.

I become distracted reading about protests and leave this idea for another day.

Friday, December 5, 2014

notes on vim

Vim is a text editor. My slowly-evolving configuration can be found on GitHub, in bpb-kit.

Tyler Cipriani is a lot smarter than I am about vim (and, in fact, most things), but I am particular and don’t always share his preferences.

keybindings

I’m starting in on this notebook, which uses a Makefile, and think it might be nice to have a quick vim keybinding for :make. I would use F5, by analogy to QBasic, but I’ve already bound that to :wall, which writes all the open buffers with changes.

I think that maybe <leader>m, which in my case means ,m, would be ok. Then I’m not sure if something is already mapped starting with that, so I try :map.

I want to search through the list produced by :map, and think it’d be nice if I could just read it into a buffer. The first thing I google is “vim read output of command into file”. This could easily enough give hits for reading the output of a shell command, but the 3rd thing down the page is Capture ex command output on the Vim Tips Wiki.

There are a bunch of interesting ideas there, but the first basic idea is this:

:redir @a
:set all
:redir END

Then you can open a new buffer - :new - and do "ap. This says “using the named register a, paste”.

This seems to work with :set all, but not so much with :map. Why not? I skim :help map and help redir without getting very far. Updates to come.

With that digression still unanswered, the mapping I settled on is simple:

nmap <leader>m :make<CR>

I never know if these are going to take with me. The handful of custom bindings that have actually entered my vocabulary are super-useful, but more often than not I wind up forgetting about an idea not long after I’ve implemented it.

Wednesday, December 3, 2014

makecitizen

{sysops, scripting, adduser, chfn}

Paul Ford sent out an e-mail to the tilde.club waitlist pointing at ~pfhawkins’s list of other tildes, so I’m getting signup requests. There are enough that I want to write a script for adding a new squiggle.city user. I’m not determined to be very fancy about this right now; I just want to save some keystrokes.

The first thing I do is google “adduser”. adduser(1) is basically just a front end to useradd(1). (This distinction will never stop being confusing, and should probably be a lesson to anyone considering that naming pattern.) I learn via Wikipedia that the metadata (name, room number, phone, etc.) which adduser prompts for is called the GECOS field, and is a relic of something called the General Electric Comprehensive Operating System, which ran on some machines at Bell Labs.

You can change that info with chfn(1).

What my script needs to do is:

  1. create a user with a given $USERNAME
  2. generate a random password for the user and tell me
  3. do chage -d0 $USERNAME
  4. put a given public key in ~$USERNAME/.ssh/authorized_keys

You can’t log in to squiggle.city with a password, so why go to the trouble of setting a random one and forcing users to change it at their first login? Mostly because users are going to need to know a password for things like changing their shell or in the case that they get operator privileges one day.

This is what I come up with, after a couple of even dumber iterations:

#!/bin/bash

CITIZEN=$1
KEYSTRING=$2

# Complain and exit if we weren't given a path and a property:
if [[ ! $CITIZEN || ! $KEYSTRING ]]; then
  echo "usage: makecitizen <username> <key>"
  exit 64
fi

# this should actually check if a _user_ exists,
# not just the homedir
if [ -d /home/$CITIZEN ]; then
  echo "$CITIZEN already exists - giving up"
  exit 68
fi

PASSWORD=`apg -d -n2`

adduser --disabled-login $CITIZEN
echo "$CITIZEN:$PASSWORD" | chpasswd
chage -d 0 $CITIZEN

echo "$KEYSTRING" >> /home/$CITIZEN/.ssh/authorized_keys  

echo "passwd: $PASSWORD"

exit 0

This is used like so:

root@squiggle:~# ./makecitizen jrandomuser "ssh-rsa ..."

It’ll still do adduser interactively, which is fine for my purposes.

I think this would be improved if it took a fullname and e-mail as input, and then sent that person a message, or at least output the text of one, telling them their password.

It’d probably be improved even more than that if it operated in batch mode, was totally idempotent, and could be driven off some separate file or output containing the set of users.

(Thoughts like this are how systems like Puppet and Chef are born.)

Monday, December 1

I’ve been thinking about a lot of different things, as I drive around rural Kansas and Nebraska between family gatherings and places I’ve called home at one time or another: Cities, towns, churches, buildings, operating systems, software in general, trails & roads, fields & farming.

It seems to me that there’s a unifying fact about the built environment, the universe of running code, and the things we call “culture”: These are all things that people keep doing.

Yesterday, winding our way up from Kansas, we passed a farm place with a big round wooden barn still standing and well-maintained. Structures like this are rare enough to elicit comment, at this late date. In the decades since the technology of farming moved on from the patterns embodied in the wooden barn,1 the rooves were mostly left to rot, and once the roof goes it’s only a matter of time.

A barn, like most buildings, isn’t a static fact. It doesn’t just exist, or not for long anyway. It’s a kind of project. It’s something people do. So too are most of the spaces we live our lives inside.

1 For example: Horses as working animals, cows kept for milk, haylofts. When I was a child, the remnants of these patterns and the systems that contained them were still legible everywhere on the landscape. They're harder to read with every passing year.