Skip to content

Instantly share code, notes, and snippets.

@rjcorwin
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

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

Select an option

Save rjcorwin/ff96e7a01438f6e5991b to your computer and use it in GitHub Desktop.

Gander upon cheatsheet http://lzone.de/cheat-sheet/Linux-Virtualization

~ $ # How to install the thing command?
~ $ npm install -g thing;
~ $ sudo apt-get install thing;

~ $ # Inpired by git...
~ $ mkdir FancyPipe;
~ $ cd FancyPipe;
~ $ thing init;
~ $ ls ./;
sensors/
reservoirs/
config

~ $ # Set up sensor
~ $ npm install thing-sensor-grove-dht11;
~ $ thing sensor grove-dht11;

~ $ # Set up the reservoir
~ $ npm install thing-reservoir-email;
~ $ thing reservoir email;
~ $ thing config email "[email protected]"

~ $ # Test our sensor package
~ $ thing poll
23.4
~ $ # Awesome... We have a reading from our sensor.

~ $ # Send a test message to an email address
~ $ thing send "45.5"
~ $ # Check your email for message that says "45.5".

~ $ # Now let's combine the two commands into sending a live reading
~ $ thing send `thing poll`;
~ $ # Hells yes. Now you have another email that says "45.5"

~ $ # Now we program this to happen every hour
~ $ thing interval "every hour";
~ $ thing start;
~ $ # Now every hour we get the results of grove-dht11 to our email
$ npm install -g pipething
$ mkdir MyPipe
$ cd MyPipe
$ pipe init
$ npm install pipething_random
$ pipe thing pipething_random
$ npm install pipething_logger
$ pipe reservoir pipething_logger
$ pipe interval 5000
$ pipe watch
~ $ # How to install the thing command?
~ $ npm install -g thing;
~ $ sudo apt-get install thing;

~ $ # Inpired by git...
~ $ mkdir FancyPipe;
~ $ cd FancyPipe;
~ $ thing init;
~ $ ls ./;
sensors/
reservoirs/
config

~ $ # Each sensor and reservoir is a package
~ $ npm install thing-sensor-grove-dht11;
~ $ npm install thing-reservoir-email;
~ $ thing install;
~ $ # Now our handy sensor and reservoir commands are set up locally

~ $ # Test our sensor package
~ $ ./sensors/grove-dht11/poll;
23.4
~ $ # Awesome... We have a reading from our sensor.

~ $ # Send a test message to an email address
~ $ ./reservoirs/email/poll "45.5" [email protected]
~ $ # Check your email for message that says "45.5".

~ $ # Now let's combine the two commands into sending a live reading
~ $ ./reservoirs/email/poll `./sensor/grove-dht11/poll  `[email protected]`
~ $ # Hells yes. Now you have another email that says "45.5"

~ $ # Now let's set up this Pipe to send a reading to my email every hour
~ $ echo '{"sensor": {"id": grove-dht11"}, "reservoir":{"id": "email", parameters: ["[email protected]"]}, "frequency":"every hour"}' >> ./config;
~ $ thingpipe start;
~ $ # Now every hour we get the results of grove-dht11 to our email
$ npm install -g pipething
$ pipe
Hello. I am PipeThing. I will pull data from things and send that data to reservoirs.
$ mkdir MyPipe
$ cd MyPipe
$ pipe init
$ pipe thing add random
$ pipe reservoir add logger
$ pipe pull random
45
$ pipe push logger "42"
42
$ pipe interval 5000
$ pipe watch
24
47
98
12
...
@chrowe
Copy link
Copy Markdown

chrowe commented Feb 15, 2015

Should this syntax include the ability to view all running pipes? Following the Git model there is no way of doing that besides using a local client like SourceTree or a remote like Github that you can add all your repositories to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment