The Z-Stick does bi-directional communication over a UART. The connection speed is 115200, '8N1'. There are "requests" and "responses". The client software can make requests to the Z-Stick, and it will send responses. But it seems the Z-Stick can make requests of the client software too. I have yet to figure out the requests the Z-Stick sends to the client software.
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"os/signal" |
by Bjørn Friese
Beautiful is better than ugly. Explicit is better than implicit.
I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.
Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki
Most people are familiar with these three tools:
- [JSHint][1]
- [JSLint][2]
- [Google Closure Linter][3]
The first one is more popular among developers because it is style-agnostic. The other two enforce rules of [Crockford Style][4] and [Google Code Style][5] respectively.
#!/bin/bash | |
# | |
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe | |
# mounted at /mnt. It should be run early on the first boot of the system. | |
# | |
# Beware, This script is NOT fully idempotent. | |
# | |
METADATA_URL_BASE="http://169.254.169.254/2012-01-12" |
Configuration files for connecting Fedora Linux to Amazon Virtual Private Cloud | |
===== | |
This Gist contains the config files that I have used to successfully connect Fedora 15 (as the "Customer Gateway" in AWS terms) to Amazon's Virtual Private Cloud VPN. These files were pulled from a working environment but I have obfuscated the public IP addresses involved. I have found IPsec to be one of the more complicated technologies to get running successfully, as there are a lot of moving parts and subtle configuration settings involved. I post this here in the hope it might be of some help to others. | |
I received a lot of help from this blog post: http://openfoo.org/blog/amazon_vpc_with_linux.html . Besides IPsec, VPC requires BGP; I used basically the same config files shown there. They use Ubuntu, and I am running Fedora, but the upstream software packages used are the same. They call for installing a couple Ubuntu packages; the equivalent on Fedora 15 is: | |
yum install quagga ipsec-tools | |
You can read about |
""" | |
Licensed under the Apache License, Version 2.0: | |
http://www.apache.org/licenses/LICENSE-2.0 | |
""" | |
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp.util import run_wsgi_app | |
redirects = { | |
'/learning': 'http://blog.pamelafox.org', |
''' | |
Python implementation of Haskell's | |
sieve xs = sieve' xs Map.empty | |
where | |
sieve' [] table = [] | |
sieve' (x:xs) table = | |
case Map.lookup x table of | |
Nothing -> x : sieve' xs (Map.insert (x*x) [x] table) | |
Just facts -> sieve' xs (foldl reinsert (Map.delete x table) facts) |
#!/usr/bin/env ruby | |
require 'iconv' | |
require 'nokogiri' | |
# This is a simple script to spider your Netflix paginated "What You've Rated" list. | |
# It requires an OS X based system with Ruby 1.9+, Safari, and AppleScript | |
# | |
# I could not find a way to back up my ratings (for all titles, not just my rental activity) | |
# without registering for a Netflix API key or handing my Netflix credentials over to someone | |
# who had an API key, so I decided to take a brute force approach and just parse the HTML for |