Skip to content

Instantly share code, notes, and snippets.

@rjcorwin
Created April 28, 2015 14:18
Show Gist options
  • Select an option

  • Save rjcorwin/32c43313cf80e4ce6c10 to your computer and use it in GitHub Desktop.

Select an option

Save rjcorwin/32c43313cf80e4ce6c10 to your computer and use it in GitHub Desktop.
An underscore template that generates a Jack-in-the-Box data pipe from sensors to database (WIP, see https://github.com/open-eio/Open-Pipe-Kit-Project/issues/27)
<%
var drivers = [
{
url: "",
name: "",
install: "",
}
]
%>
# Indicate we are installing.
blink red
# Get the drivers and install them
mkdir drivers
<% _.each(drivers, function (driver) { %>
wget -O driver.zip <%= driver.url %>
unzip drivers/driver.zip drivers/<%= driver.name %>
rm drivers/driver.zip
./drivers/<%= driver.name %>/<%= driver.install %>
<% } %>
# Configure WiFi
pirate-sh --ssid hmk --wepkey password
# Reset the autorun.sh file.
rm ./autorun.sh
touch autorun.sh
# Build a new autorun.sh file.
echo 'blink yellow' >> autorun.sh
# Set up a pipe.
echo 'watch -n60 " \
./drivers/opk-temper1-cli-0.5.0/pull \
--path USB1 | \
./drivers/opk-phant-cli-0.3.0/push \
--url http://data.sparkfun.com/stream/E9fejd9efjfj \
--private_key IIF9efejfese83n" &' \
>> autorun.sh
# Set up another pipe.
echo 'watch -n60 " \
./drivers/opk-temper1-cli-0.5.0/pull \
--path USB1 | \
./drivers/opk-phant-cli-0.3.0/push \
--url http://data.sparkfun.com/stream/E9fejd9efjfj \
--private_key IIF9efejfese83n" &' \
>> autorun.sh
# Indicate that everything is cool.
echo 'blink green' >> autorun.sh
# Indicate that we are going to reboot
blink yellow
# All done, next reboot will use the autorun.sh we just built.
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment