Fixing a Buggy Puppet On Raspbian 
The puppet agent that is bundled with Raspbian is old:

# puppet agent --version

It has a bad bug, in that the --digest parameter is ignored when you try to create a client key:

# puppet agent -t --digest sha256
info: Creating a new SSL certificate request for pinkpi
info: Certificate Request fingerprint (md5): 7B:8D:F2:B3:93:DE:0A:18:FF:B0:5D:3A:91:2D:69:65

Since the latest puppet daemon won't accept MD5 certs, you may think you're screwed, but the Raspbian agent can actually generate SHA256 certs, you just have to patch a couple lines of code. In /usr/lib/ruby/vendor_ruby/puppet/ssl/certificate_request.rb change this line:


to this:


and change this line: "Certificate Request fingerprint (md5): #{fingerprint}"

to this: "Certificate Request fingerprint (sha256): #{fingerprint}"

Now, your puppet agent will generate an SHA256 cert, assuming your OpenSSL is reasonably up to date.

Note also! "puppet cert clean -all" won't actually delete old certs, it just revokes them. To really clean up and start over, you need to remove the revocation lists as well:

rm -r /var/lib/puppet/ssl

otherwise, you will get something that looks like this:

err: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed: [certificate revoked for /CN=4core.localdomain]

or this:

Info: Creating a new SSL key for 4core.localdomain
Error: Could not request certificate: Find /production/certificate/ca?fail_on_404=true resulted in 404 with the message: Not Found: Could not find certificate ca

Note #2: "puppet cert sign -all" doesn't really sign everything. For me, it signed only the local hosts's cert and not the newly created client:

# puppet cert sign -all
"pinkpi" (SHA256) 1D:45:7A:A8:A2:5B:15:FA:AB:F1:EB:59:E7:81:59:30:24:CB:E8:88:D9:6D:DB:2A:E6:B2:E6:9C:7A:F8:88:2A
+ "4core.localdomain" (SHA256) 74:2E:54:0E:17:DB:5A:DB:09:31:B5:74:29:03:4D:0E:DD:6A:F0:0F:F1:B2:65:37:C6:36:D8:DF:82:BF:AD:05 (alt names: "DNS:4core", "DNS:4core.localdomain", "DNS:4core.localhost", "DNS:puppet", "DNS:puppet.localhost")

I had to explicitly use the hostname:

# puppet cert sign pinkpi
Notice: Signed certificate request for pinkpi
Notice: Removing file Puppet::SSL::CertificateRequest pinkpi at '/var/lib/puppet/ssl/ca/requests/pinkpi.pem'

Hope this saves someone some time ....

[ view entry ] ( 1487 views )   |  permalink
How to get Shuffle working in iPhone 8.4 Music 
This is for those of us who have made the tragic mistake of upgrading our last-year's model iphones (4s in my case) to IOS 8.4.

The "Music" app that has replaced iTunes is utterly, completely borked. The capability of shuffling all songs or a particular genre is gone. Genius Playlists are gone. You can still shuffle playlists you ave created in iTunes, but navigating to that capability is completely different now. In addition, you may find the Up Next screen missing, or that selecting shuffle on a playlist repeats one song over and over. Here is the fix:

- In Settings>Music disable Show Apple Music. In Settings> General>Restrictions disable Apple Music Connect. This will disable all the cloud features of Music and the app will act a little more like the old app.

- Navigate to your playlist: In the app: Playlists (at the bottom bar), then select your Playlist. This takes you to the screen of the playlist you have selected. There is a shuffle icon in the middle of the screen. Tap on that and play will begin.

- To get to the Up Next screen, tap on the white bar at the bottom of the playlist screen - it will have name of the currently playing song on it. Presto! The Now Playing screen for that song. You can get to the Now Playing list by tapping the icon wth the three "- ----"'s on it.

- If the same song repeats over and over again make sure the "repeat" icon (loop arrows symbols at the bottom of the song Now Playing screen) is completely unselected.

Another missing feature is the ability to rate songs. I've carefully curated my collection in iTunes and I have star ratings for every song. My auto playlists are all dependent on ratings. I haven't upgraded my laptop OSX to Yosemite (actually I graded and then backed out - see below ), but if that capability went away in the new iTunes I'll be really pissed. You don't want to see me when I'm really pissed.

[ view entry ] ( 1207 views )   |  permalink
Flicker-Free PWM on the Raspberry Pi 
If you've ever considered using PWM on the Pi to control LED brightness or servos directly from the GPIO pins, you may have noticed LED flickering or servo instability with any of the timer based GPIO drivers like RPi.GPIO. It's just not gonna work, since sleep() is affected by interrupts and is wildly inaccurate at times below 10 milliseconds or so. This is well-known behavior in sleep/usleep.

The solution has been at hand for a while: ServoBlaster! Richard, who obviously knows way more than I do about ARM bit-twiddling (the ATM Peripherals Manual at is not for the faint-hearted), instead uses DMA to scan a table of on-off bits and directly map that to the pins. This uses virtually no CPU and is impervious to other stuff, like wlan or ethernet, that interrupts the kernel. It's good down to 1% duty cycles. The daemon defaults to setup for servos, but you can use arguments to specify parameters useful to control LEDs:

servod --p1pins=8,10,12 --max=20000us --cycle-time=20000us

So if you have LEDs connected to header pins 8,10, and 12, you control them by sending command strings to /dev/servoblaster:

# LED 0 on GPIO13, full on
echo 0=100% > /dev/servoblaster
# LED 1 on GPIO 14, 10% duty cycle
echo 1=10% > /dev/servoblaster
# LED 2 on GPIO18, off, (0% duty cycle is still on a little bit)
echo 2=0 > /dev/servoblaster

UPDATE: You won't be able to run servoblaster and play music through the onboard audio at the same time, since they both use the ARM's PWM timer. Use servoblaster's "--pcm" option, which uses the PCM instead of the PWM timer on the chip, so servoblaster and onboard audio can run at the same time.

Good stuff!

[ view entry ] ( 930 views )   |  permalink
The WSANDERS.ORG Blog is Still Around 
Even though WSANDERS.ORG is expired, the ham radio and Mother of all Junk Boxes posts are still there:

Some permalinks to most-viewed entries:

Kenwood Upside Down DIN-13 ACC2 Plug
RFI Fix for Oregon Scientific Weather Station
Advice For New Baker To Vegas Stage Volunteers
The Galveston Hooter is Destroyed
The Hat Museums of Europe

[ view entry ] ( 797 views )   |  permalink  |  related link
Dept. of "Why Didn't I Think of That": Getting Average Brightness of an Image 
Using convert, resize the image to 1x1 pixel, and get the image stats (in HSV):
convert original.jpeg -colorspace hsb -resize 1x1 txt:-

Credit goes to this guy: ... brightness

However, the Python PIL package will do this for you, the results are only a teensy bit different and you can get extrema and RMS for each channel:

>>> from PIL import Image
>>> from PIL import ImageStat
>>> im ='/tmp/image.jpg')
>>> stat = ImageStat.Stat(im)
>>> print stat.mean
[92.87710129310345, 94.48407707910751, 82.74996830628804]
>>> print stat.rms
[114.97883849032031, 116.21534866014377, 107.79289136583212]
>>> print stat.extrema
[(0, 255), (0, 255), (0, 255)]


~$ convert /tmp/image.jpg -resize 1x1 txt:-
# ImageMagick pixel enumeration: 1,1,255,srgb
0,0: (91,92,80) #5B5C50 srgb(91,92,80)

Actually I'd go with Python, because all the cool kids use Python and shells are for old people.

[ view entry ] ( 1452 views )   |  permalink
Raspbian Wifi Adhoc Mode - It's Easy If .... 
I gave up trying to get adhoc wifi to work solely by editing /etc/network/interfaces. This, and variations thereof, never worked:
iface wlan0 inet static
wireless-channel 11
wireless-essid Pi
wireless-mode ad-hoc

What did work was creating an /etc/rc3.d/adhoc script and calling iwconfig directly. This might save you a lot of time:
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 channel 11
ifconfig wlan0 up
iwconfig wlan0 essid "Pi"
ifconfig wlan0 netmask

WLAN0 does go down every time the other side of the link gets lost due to a reboot, power cycle, or some other problem. I'm working on a way short of a brute-force restart daemon to fix that.

[ view entry ] ( 1375 views )   |  permalink

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next> Last>>