Posted 2 months ago

programming is terrible: Why your distributed social network will not work

programmingisterrible:

Your post describes a ( ) protocol ( ) github repo ( ) manifesto ( ) kickstarter for a distributed social network.

Your idea will not work. Here is why it won’t work. One or more of the following flaws may apply to your particular idea.

( ) You think “if you build it, they will come”
( ) All of…

Posted 3 months ago

SSH keys on Git

Long ago on a Q&A site I used to frequent, I asked why GitHub didn’t let me associate a single SSH public key with two accounts. I had a work account and a personal account on GitHub, I wanted to use them both on one computer, and it’s a pain in the neck to get Git to use the right one of multiple SSH keys to connect to a single host. (It’s solvable; you have to change your ssh configuration to define different Hosts, each with a different key, that resolve to the same hostname, and then tell Git to connect to a Host rather than a hostname.) I imagined that GitHub should be able to say that if I’m connecting to Repository X with Key A, I’d be recognized as Person M, but I’d be recognized as Person N with the same key in Repository Y. Why couldn’t GitHub do this?

I got a perfectly reasonable answer right away on the Q&A site that GitHub uses SSH to tell who you were, so it can’t be done from a technical perspective. I found the answer wanting, though — why did GitHub use SSH? Why couldn’t the SSH identity map to a different concept? Wasn’t this SSH-owns-identity thing a big price to pay?

I got the answer while reading Pro Git. It turns out that Git doesn’t know anything about authentication, and SSH is the only practical wrapper protocol that allows write access to a repository. (The other protocols are local file access, the completely anonymous Git protocol, and HTTP, but none easily allows authenticated access.) So it’s likely that on a given server, the git process is running as “you” (whoever you are who ssh’ed into the server), and the sysadmin has set up standard Unix permissions on the .git repo directory to control who has read/write access. Thus Git read/write operations are automatically permitted or not without a single line of code in Git. Very Unix-y.

Does this mean that my original feature request (SSH Key A means you’re Person M in Repo X and Person N in Repo Y) is impossible? No; there is probably a way to map an SSH user to a specific machine user based on contextual clues like the directory you’re trying to access. But the way it is today, where SSH Key M means you’re Person M only and nobody else, is a lot easier from the perspective of someone hacking together a young service like GitHub and making a bunch of shell scripts that set access properly across repositories. Moreover, it avoids the edge case where Person M joins Person N’s company and now has access to Repo Y, so the already-weirdish heuristic to determine who you are breaks down. The higher-level solution GitHub came up with, Organizations, solves the problem more elegantly without requiring (or allowing) a single person to assume multiple identities on the system.

Posted 5 months ago

Serial console on Raspberry Pi

If you have a CP2102-based USB-to-serial adapter, it’s very likely to use 3.3-volt logic levels that are safe for your Raspberry Pi. I reviewed the datasheet for the chip, and any normal circuit using it would use the internal 3.3-volt regulator powered by the 5-volt USB bus, meaning that the I/O levels will be relative to Vdd (i.e., 3.3 volts).

A recap of an excellent tutorial explaining how to get a serial console on your Pi:

  1. Hold your unplugged Pi so the GPIO header is close to you on the right side of the board, pointing up.
  2. Connect the TXD pin of your adapter to the fifth pin from the right on the closest row to you.
  3. Connect the RXD pin to the fourth pin, right next to the other one. So when you look at your Pi, you should see the yellow RCA jack in the middle, then to the right of that eight empty pins, then TXD, then RXD, then three empty pins.
  4. On your real computer, fire up a serial terminal and connect at 115200 bps. On my Mac, that’s screen /dev/tty.SLAB_USBtoUART 115200.
  5. Plug in your Pi, but read this whole step first. I powered mine from my desktop computer’s USB port, so I knew both machines were sharing ground. If you’re plugging in your Pi from another power source, there’s a chance it won’t work because the two machines will have a different ground.
  6. You should see the kernel boot output appearing on your terminal. After a bit you’ll get the Pi’s login prompt, almost as if you were sshing into it.

Update: If you make it as far as the login prompt but see inverted diamonds with question marks and can’t type in the username, you probably have the flow-control settings wrong. According to elinux.org, the default UART settings use no flow control. To fix this on Ubuntu, I installed minicom, then navigated to its serial-port settings and turned off hardware flow control (which was on). This fixed things for me. You can probably use stty to change the settings without using minicom.

Posted 6 months ago

Ikea Kilometer LED lights

I can’t find any description of these lights online. They’re like mini Christmas lights, with a gentle bluish glow that is too faint to read by, but too bright to be an all-night night light for my kids. A string of 48 costs $13: not cheap by IKEA standards, but reasonable. There is no switch.

The AC adapter puts out 21 volts, 90 mA, which I’m guessing is DC because the low-voltage plug is polarized. The Kill-a-Watt measures 0 watts.

I think I can kill a few birds with one stone. A small circuit spliced in between the transformer and the lights could provide a 30-minute gradual PWM dimming timer for the kids. They’d press the button to start the sequence, and fall asleep as the lights went out. The board would sip power from the adapter.

The 21 volts are a challenge. Might be fun.

Posted 6 months ago
Hello Mike, my name is Alex and I have recently started dabbling in the G35 Arduino lighting control. I recently purchased an Arduino Uno and was trying to set up your basic example sketch but can't seem to get it to load as it gives me an error "G35String" does not name a type. My goal is to set up some G35 lights w/ColorNode boards which I've purchased and populated, along with a JeeNode and JeeLink for control.
alejandrorey33 asked

Have you followed the installation instructions exactly? I just did so with a clean Arduino installation, and it worked. The error you’re seeing suggests you’ve taken just the example sketch but haven’t installed the library. 

Posted 7 months ago

Like A G35 instructions

I’ve updated the README. A neighbor caught the G35 bug when he was at Costco, and he’s an Arduino enthusiast, too, so I’m giving him the third of my three prototype shields. He even gets working instructions!

Posted 7 months ago

Daemon Downloader?

Sometimes I come across interesting things to download while I’m out and about, but I can’t download them (because I’m on a phone) or I’m at work (where I’d then have to figure out how to transfer them to home). These are things that are wasteful to sic Dropbox on.

What I really want is to have a private email address I can email URLs, and whoever’s listening on the other end will cause my home file server to download the content (handling properly if the resource turns out to be a torrent).

Does such a thing exist?

Posted 8 months ago

Like A G35 is working! Shown here running last year’s Christmas program. I’ve already updated the G35Arduino GitHub project for Halloween of this year!

Posted 8 months ago

Idea for easier Christmas light programming

As I get back into the Christmas spirit and think of more light programs for my G35 lights,  I’m dreading doing more cumbersome C++ work for this simple class of programming. What if there were a simpler language that were custom-designed for light programming? What if I made an Arduino shield that ran these light scripts from an SD card? What if other people could share scripts on the internet? What if the scripts were hardware-independent, so people could make their cool patterns run on any hardware, and any length of string?

These all seem like great ideas, but it must have already been done. Right? I did a little web research, but so far all I’ve found is DMX (a.k.a. DMX512), which is at a lower level than what I’m interested in. I want something like LightScript (just made that up) that can express hardware-independent RGB Christmas light programs. It’d be a little like MIDI, but where the width of the piano keyboard wasn’t known at composition time, and it would expand at runtime to sound good on a keyboard of 1 or 20 octaves. I haven’t found this yet in my minutes and minutes of research.

Does it exist? Internet, please give me some keywords!

Posted 8 months ago

G35 Christmas lights are available at Costco

$64.99. That is all.