Skip to content

Instantly share code, notes, and snippets.

@mtrudel
Created May 28, 2010 21:58
Show Gist options
  • Select an option

  • Save mtrudel/417814 to your computer and use it in GitHub Desktop.

Select an option

Save mtrudel/417814 to your computer and use it in GitHub Desktop.
backend
=======
while true do
select(listener, 1s)
if commands
send them
end
if get_button
send beep down button pipe
end
get_light_status
send status down light pipe
end
end
partyd
======
while true do
read button pipe
if button on
save light status
while time < 10 do
random light frob
sleep (random in .3-.6)
time += random
end
restore light status
end
end
web daemon
==========
on set lights request:
send command pipe appropriate command
on get light status:
read light pipe for three characters (or time out)
Commands / Status responses
===========================
R = red on
r = red off
G = green on
g = green off
A = amber on
a = amber off
buildout
========
cat > /etc/config/network <<EOF
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'ifname' 'eth0'
option 'type' 'bridge'
option 'proto' 'dhcp'
option 'hostname' 'lights'
)
EOF
/etc/init.d/dnsmasq disable
/etc/init.d/uhttpd disable
opkg update
opkg install ruby libpthread kmod-usb-serial (do we need this?)
rm /etc/banner
# put your ssh key in /etc/dropbear/authorized_keys 0600
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment