<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Sayanee</title>
 <link href="https://blog.sayan.ee/feed.xml" rel="self"/>
 <link href="https://blog.sayan.ee/"/>
 <updated>2016-11-03T14:40:04+00:00</updated>
 <id>https://blog.sayan.ee/</id>
 <author>
   <name>Sayanee</name>
   <email>sayanee@gmail.com</email>
 </author>

 
 <entry>
   <title>Web control panel for Neopixel</title>
   <link href="https://blog.sayan.ee/neopixel"/>
   <updated>2016-11-03T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/neopixel</id>
   <content type="html">&lt;p&gt;Recently, I fell in love with the simple RGB LED 💡&lt;/p&gt;

&lt;p&gt;I love connecting physical things and displaying them on a web browser! So I thought of getting the Neopixel ring and displaying different colored lights and patterns through the control of the web interface. Here are some steps to make that...&lt;/p&gt;

&lt;h2&gt;What we need&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/products/2874&quot;&gt;60 LED Neopixel ring&lt;/a&gt; + USB cable&lt;/li&gt;
&lt;li&gt;Arduino + USB cable for power&lt;/li&gt;
&lt;li&gt;Jumper wires&lt;/li&gt;
&lt;li&gt;&lt;code&gt;470Ω&lt;/code&gt; resistor&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1000uF&lt;/code&gt; capacitor&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Assemble the Neopixel Ring&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Get the &lt;a href=&quot;https://www.adafruit.com/products/2874&quot;&gt;60 LED Neopixel ring&lt;/a&gt; as 4 pieces of 15-pixel quarters
&lt;img src=&quot;img/ring.jpg&quot; alt=&quot;Neopixel quarters before soldering&quot;&gt;&lt;/li&gt;
&lt;li&gt;Refer to the detailed &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide&quot;&gt;Adafruit&amp;#39;s guide on Neopixel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Solder 3 out of the 4 joints from &lt;code&gt;GND&lt;/code&gt; to &lt;code&gt;GND&lt;/code&gt;, &lt;code&gt;DIN&lt;/code&gt; to &lt;code&gt;DOUT&lt;/code&gt;, &lt;code&gt;5V&lt;/code&gt; to &lt;code&gt;5V&lt;/code&gt;
&lt;img src=&quot;img/ring-joints.jpg&quot; alt=&quot;Solder joints&quot;&gt;&lt;/li&gt;
&lt;li&gt;Solder &lt;code&gt;GND&lt;/code&gt;, &lt;code&gt;DIN&lt;/code&gt; and &lt;code&gt;5V&lt;/code&gt; to 3 wires at the 4th (last) joint
&lt;img src=&quot;img/ring-last-joint.jpg&quot; alt=&quot;Last solder joint&quot;&gt;&lt;/li&gt;
&lt;li&gt;Create a USB cable with 2 wires sticking out at the other end by striping of the wires at the end. This will provide &lt;code&gt;+5V DC&lt;/code&gt; from a power supply to the Neopixel.
&lt;img src=&quot;img/usb-cable-stripped.jpg&quot; alt=&quot;USB cable with stripped wires&quot;&gt;&lt;/li&gt;
&lt;li&gt;Wire up with an Arduino&amp;#39;s digital pin &lt;code&gt;PIN 6&lt;/code&gt;, &lt;code&gt;470Ω&lt;/code&gt; resistor and &lt;code&gt;1000uF&lt;/code&gt; capacitor.
&lt;img src=&quot;img/ring-connections.png&quot; alt=&quot;Schematic of Arduino, Neopixel and 5V DC power supply&quot;&gt;
&lt;small&gt;Source: &lt;a href=&quot;https://learn.adafruit.com/adafruit-neopixel-uberguide/basic-connections&quot;&gt;Adafruit Neopixel Uberguide - basic connectors&lt;/a&gt;&lt;/small&gt;
&lt;img src=&quot;img/ring-connections-actual.jpg&quot; alt=&quot;Actual photo of the wirings&quot;&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Blinky with Arduino&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Open up the &lt;a href=&quot;https://www.arduino.cc/en/Main/Software&quot;&gt;Arduino IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;https://github.com/adafruit/Adafruit_NeoPixel&quot;&gt;Adafruit&amp;#39;s Neopixel library&lt;/a&gt; from &lt;code&gt;Sketch &amp;gt; Include Library &amp;gt; Manage Library&lt;/code&gt;
&lt;img src=&quot;img/install-neopixel.jpg&quot; alt=&quot;Install the Arduino Neopixel package&quot;&gt;&lt;/li&gt;
&lt;li&gt;Create new &lt;code&gt;neopixel&lt;/code&gt; project with &lt;code&gt;neopixel.ino&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Write some code to blink the &lt;code&gt;LED10&lt;/code&gt; and &lt;code&gt;LED11&lt;/code&gt; every 1 second in red color&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot; data-lang=&quot;c&quot;&gt;  &lt;span class=&quot;cp&quot;&gt;#include &amp;lt;Adafruit_NeoPixel.h&amp;gt;
&lt;/span&gt;
  &lt;span class=&quot;cp&quot;&gt;#define PIN 6 // Arduino's PIN 6
&lt;/span&gt;  &lt;span class=&quot;cp&quot;&gt;#define N_LEDS 60 // 60 pixel
&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;Adafruit_NeoPixel&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Adafruit_NeoPixel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;N_LEDS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PIN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NEO_GRB&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NEO_KHZ800&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

  &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;begin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// LED ON in red
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setPixelColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setPixelColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// LED OFF
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setPixelColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setPixelColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Compile and upload to see the red led blinking every 1 second!
&lt;img src=&quot;img/pixel-arduino.jpg&quot; alt=&quot;2 LEDs with red blinky&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Control via the Web&lt;/h2&gt;

&lt;p&gt;Instead of using Arduino code, we will now flash &lt;a href=&quot;https://github.com/firmata/protocol&quot;&gt;firmata&lt;/a&gt; to the Arduino so that &lt;a href=&quot;https://github.com/rwaldron/johnny-five&quot;&gt;Johnny-Five&lt;/a&gt; JavaScript framework can talk to the Arduino. Using the same JavaScript code, we can also insert the code for a web server and serve an &lt;code&gt;html&lt;/code&gt; page to control the LED light patterns.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install some node.js dependancies like &lt;a href=&quot;http://expressjs.com/&quot;&gt;express&lt;/a&gt;, &lt;a href=&quot;http://johnny-five.io/&quot;&gt;johnny-five&lt;/a&gt;, &lt;a href=&quot;https://github.com/ajfisher/node-pixel&quot;&gt;neopixel&lt;/a&gt; and &lt;a href=&quot;https://github.com/johnny-five-io/nodebots-interchange&quot;&gt;interchange&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  npm i express johnny-five node-pixel nodebots-interchange
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Ensure the Arduino is connected to your computer&lt;/li&gt;
&lt;li&gt;Flash the firmata to the Arduino using &lt;a href=&quot;https://github.com/johnny-five-io/nodebots-interchange&quot;&gt;interchange&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  interchange install git+https://github.com/ajfisher/node-pixel -a uno --firmata
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Create a node.js file &lt;code&gt;index.js&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;five&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'johnny-five'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pixel&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'node-pixel'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'express'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;board&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;five&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;process&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;express&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;__dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Example&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;listening&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;at&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;//localhost:${server.address().port}`)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'ready'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pixel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;color_order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pixel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;COLOR_ORDER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;GRB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'FIRMATA'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'ready'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

      &lt;span class=&quot;c1&quot;&gt;// add routes for different LED patterns&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// extend to add http routes...&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Extend &lt;code&gt;index.js&lt;/code&gt; to add http routes for various LED controls&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/red'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clearTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'#100'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/green'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clearTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'#010'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/blue'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clearTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'#001'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/clear'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;clearTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;off&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/panel'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;colors&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'red'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'green'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'blue'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;yellow&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;cyan&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;magenta&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;white&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;current_colors&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;setInterval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;current_colors&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;colors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;current_colors&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;colors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;current_colors&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/breathe'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rising&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;max&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;min&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;blinker&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;setInterval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rising&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;rising&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;max&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;rising&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;min&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

      &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'rgba('&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;','&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;','&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;')'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;strip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;redirect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;index.html&lt;/code&gt; in the same folder as &lt;code&gt;index.js&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;  &lt;span class=&quot;nt&quot;&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/red&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;red&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/green&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;green&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/blue&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;blue&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/clear&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;clear&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/panel&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;panel&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/breathe&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;breathe&lt;span class=&quot;nt&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Plug in the Arduino to the laptop, plug in the neopixel to USB power and start the node server&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  node index
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Visit the browser at &lt;code&gt;localhost:3000&lt;/code&gt;
&lt;img src=&quot;img/neopixel-browser.png&quot; alt=&quot;Web browser with hyperlinks&quot;&gt;&lt;/li&gt;
&lt;li&gt;Click the web controls and see the colors and patterns on the LED
&lt;img src=&quot;img/neopixel-colors.png&quot; alt=&quot;Neopixel ring with various colors&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is just the simplest example case to get started with the Neopixel ring, but the combinations and patterns can be limitless!&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Beaglebone and Go</title>
   <link href="https://blog.sayan.ee/bbb"/>
   <updated>2016-10-02T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/bbb</id>
   <content type="html">&lt;p&gt;I have been busy learning 2 new things: &lt;a href=&quot;http://beagleboard.org/&quot;&gt;Beaglebone&lt;/a&gt;, a single board computer and &lt;a href=&quot;https://golang.org/&quot;&gt;Go&lt;/a&gt;, a programming language. It was especially fun running a compiled Go script and playing with the GPIO pins of the Beaglebone. In this blog, I wanna share how to run a simple digital write with a blinky LED and read analog values from a potentiometer.&lt;/p&gt;

&lt;h2&gt;Pre-requisites&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;a href=&quot;https://beagleboard.org/latest-images&quot;&gt;Debian Linux for Beaglebone&lt;/a&gt; with an SD card.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://learn.adafruit.com/ssh-to-beaglebone-black-over-usb?view=all&quot;&gt;SSH into the Beaglebone&lt;/a&gt; with IP address &lt;code&gt;192.168.7.2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;https://golang.org/&quot;&gt;Go&lt;/a&gt; programming language with &lt;code&gt;brew install go&lt;/code&gt; in your development machine (local machine)&lt;/li&gt;
&lt;li&gt;Familiarise with the Beaglebone&amp;#39;s GPIO pin layout
&lt;img src=&quot;img/bbb-gpio.png&quot; alt=&quot;&quot;&gt;
&lt;small&gt;Source: &lt;a href=&quot;http://beagleboard.org/support/bone101&quot;&gt;Beaglebone.org&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Digital write&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Wire up a super simple LED circuit with &lt;code&gt;1kΩ&lt;/code&gt; resistor and Beaglebone&amp;#39;s &lt;code&gt;P8 pin 2 DGND&lt;/code&gt; and &lt;code&gt;P8 pin 10 GPIO_68&lt;/code&gt;
&lt;img src=&quot;img/bbb-led.jpg&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
&lt;li&gt;SSH into the BBB with &lt;code&gt;ssh root@192.168.7.2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Turn on and off the LED in the command line with&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;high &amp;gt; /sys/class/gpio/gpio68/direction &lt;span class=&quot;c&quot;&gt;# LED ON&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;echo &lt;/span&gt;low &amp;gt; /sys/class/gpio/gpio68/direction &lt;span class=&quot;c&quot;&gt;# LED OFF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Wondering what does &lt;a href=&quot;https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt&quot;&gt;Linux file systems&amp;#39;s &lt;code&gt;/sys&lt;/code&gt;&lt;/a&gt; do?&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;sysfs is a virtual file system provided by Linux. sysfs provides a set of virtual files by exporting information about various kernel subsystems, hardware devices and associated device drivers from the kernel&amp;#39;s device model to user space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Write &lt;code&gt;high&lt;/code&gt; or &lt;code&gt;low&lt;/code&gt; to the &lt;code&gt;/sys/class&lt;/code&gt; pin files to turn on and off the LED in Go programming language&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-go&quot; data-lang=&quot;go&quot;&gt;&lt;span class=&quot;x&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;// blinky.go&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;io/ioutil&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;time&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;panic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;high&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;low&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;low&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gpio&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/sys/class/gpio/gpio68/direction&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Tick&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Second&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ioutil&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WriteFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gpio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0644&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;high&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ioutil&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WriteFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gpio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;low&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0644&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;low&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Compile on OSX for Beaglebone&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  &lt;span class=&quot;nv&quot;&gt;GOARM&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7 &lt;span class=&quot;nv&quot;&gt;GOARCH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;arm &lt;span class=&quot;nv&quot;&gt;GOOS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;linux go build blinky.go
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Transfer the executable file &lt;code&gt;blinky&lt;/code&gt; via ssh&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  scp blinky root@192.168.7.2:/root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Run the binary &lt;code&gt;blinky&lt;/code&gt; in Beaglebone and see the LED turn on and off 💥&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  ./blinky
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Analog read&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Wire up a potentiometer to &lt;code&gt;P9_32&lt;/code&gt; for &lt;code&gt;VDD (1.8V)&lt;/code&gt;, &lt;code&gt;P9_34&lt;/code&gt; for &lt;code&gt;GND&lt;/code&gt; and &lt;code&gt;P9_33&lt;/code&gt; for analog input pin
&lt;img src=&quot;img/bbb-pot.jpg&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
&lt;li&gt;SSH into the BBB with &lt;code&gt;ssh root@192.168.7.2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Setup the GPIO pins by adding the device&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;BB-ADC&quot;&lt;/span&gt; &amp;gt;&amp;gt; /sys/devices/platform/bone_capemgr/slots
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Turn the potentiometer knob and read the 12-bit ADC values from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;4095&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  cat /sys/bus/iio/devices/iio:device0/in_voltage4_raw
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Read file to get the analog sensor values in Go&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-go&quot; data-lang=&quot;go&quot;&gt;&lt;span class=&quot;x&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;// analogread.go&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fmt&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;io/ioutil&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;time&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;panic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

  &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ticker&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NewTicker&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Millisecond&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gpio&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/sys/bus/iio/devices/iio:device0/in_voltage4_raw&quot;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;go&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ticker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ioutil&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ReadFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gpio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Tick at&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}()&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;

    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Millisecond&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;60000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt; &lt;/span&gt;&lt;span class=&quot;c&quot;&gt;// run for 1 minute&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ticker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Println&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Ticker stopped&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Compile on OSX for Beaglebone&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  &lt;span class=&quot;nv&quot;&gt;GOARM&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7 &lt;span class=&quot;nv&quot;&gt;GOARCH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;arm &lt;span class=&quot;nv&quot;&gt;GOOS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;linux go build analogread.go
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Transfer the executable &lt;code&gt;analogread&lt;/code&gt; via SSH&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  scp analogread root@192.168.7.2:/root
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Run in Beaglebone &lt;code&gt;./analogread&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Turn the potentiometer knob to see its ADC values change 💥&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;As one of the feature of Unix, &lt;a href=&quot;https://en.wikipedia.org/wiki/Everything_is_a_file&quot;&gt;Everything is a file&lt;/a&gt;, it was fun to read or write to extract the values and interact with simple sensors and the Beaglebone. And because we are running the digital write and analog read programs on Linux, we can also use other programming language frameworks like &lt;a href=&quot;https://github.com/adafruit/adafruit-beaglebone-io-python&quot;&gt;Adafruit&amp;#39;s Beaglebone IO Python library&lt;/a&gt; or &lt;a href=&quot;https://github.com/jadonk/bonescript&quot;&gt;Bonescript with Node.js&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Starting commands for DevOps</title>
   <link href="https://blog.sayan.ee/starting-devops"/>
   <updated>2014-02-10T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/starting-devops</id>
   <content type="html">&lt;p&gt;In the past month, I was immersed in &lt;a href=&quot;http://en.wikipedia.org/wiki/DevOps&quot;&gt;DevOps&lt;/a&gt; starting up various &lt;a href=&quot;http://aws.amazon.com/ec2/&quot;&gt;EC2&lt;/a&gt; and &lt;a href=&quot;http://aws.amazon.com/rds/&quot;&gt;RDS&lt;/a&gt; instances in &lt;a href=&quot;http://aws.amazon.com/&quot;&gt;AWS&lt;/a&gt;, trying to deploy my app consisting of &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; &lt;a href=&quot;https://github.com/rails-api/rails-api&quot;&gt;API&lt;/a&gt; server, &lt;a href=&quot;http://angularjs.org/&quot;&gt;AngularJS&lt;/a&gt; frontend and &lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; database in various environments such as staging or production.&lt;/p&gt;

&lt;p&gt;It was a challenging time for me as I needed to have a &lt;strong&gt;systems view&lt;/strong&gt; instead of just a single application. Yet, firing up some instances in different operating systems also gave me a slight insight to their similarities and differences.&lt;/p&gt;

&lt;p&gt;Below are the list of &lt;strong&gt;20 most used commands&lt;/strong&gt;. Why is noticing the &lt;em&gt;most used commands&lt;/em&gt; important? Because ultimately, we can include them in a script and build automation for various tasks in DevOps.&lt;/p&gt;

&lt;p&gt;Here we start!&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;Logging into the Server&lt;/h2&gt;

&lt;h3&gt;1. &lt;code&gt;ssh-keygen&lt;/code&gt; generate ssh keys&lt;/h3&gt;

&lt;p&gt;Even before we log in to the remote server, we generate a pair of public and private ssh keys. Ultimately, the contents of the public key &lt;code&gt;*.pub&lt;/code&gt; can go into &lt;a href=&quot;https://help.github.com/articles/generating-ssh-keys&quot;&gt;Github SSH keys&lt;/a&gt; or the remote computer&amp;#39;s &lt;a href=&quot;http://www.openssh.org/faq.html#3.14&quot;&gt;&lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt; file&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;&lt;!--email_off--&gt;$ ssh-keygen -t rsa -f project-name -C &quot;name@email.com&quot;&lt;!--/email_off--&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;2. &lt;code&gt;ssh&lt;/code&gt; secure shell&lt;/h3&gt;

&lt;p&gt;Next, to login there are various ways of using the &lt;code&gt;ssh&lt;/code&gt; command. The 3 common ways that I have used are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;with a &lt;a href=&quot;http://www.openbsd.org/cgi-bin/man.cgi?query=ssh_config&quot;&gt;config file&lt;/a&gt; at &lt;code&gt;~/.ssh/config&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;Host projectname
      HostName website.com
      Port 8000
      IdentityFile ~/.ssh/sshkey
      IdentitiesOnly=yes
      User username
  &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;p&gt;And now we can ssh into the server with a much simpler command&lt;/p&gt;

&lt;p&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ssh projectname&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ssh with a &lt;a href=&quot;http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html#AccessingInstancesLinuxSSHClient&quot;&gt;username and a public key&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;&amp;lt;!--email&lt;em&gt;off--&amp;gt;$ ssh -i mykey.pem username@server.com&amp;lt;!--/email&lt;/em&gt;off--&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ssh directly into a &lt;a href=&quot;http://stackoverflow.com/questions/626533/how-can-i-ssh-directly-to-a-particular-directory&quot;&gt;particular directory&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ssh projectname -t &amp;quot;cd /path/to/app ; /bin/bash&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;Transferring files&lt;/h2&gt;

&lt;h3&gt;3. &lt;code&gt;scp&lt;/code&gt; secure copy&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://www.openbsd.org/cgi-bin/man.cgi?query=scp&amp;amp;sektion=1&quot;&gt;Secure copy&lt;/a&gt; &lt;code&gt;scp&lt;/code&gt; comes in handy for transferring files from the local machine to the remote machine and vice versa.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;from &lt;a href=&quot;http://stackoverflow.com/questions/11822192/ssh-scp-local-file-to-remote-in-terminal-mac-os-x&quot;&gt;local to remote&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;&amp;lt;!--email&lt;em&gt;off--&amp;gt;$ scp -i /path/to/key.pem /path/to/file username@server.com&amp;lt;!--/email&lt;/em&gt;off--&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;from &lt;a href=&quot;http://stackoverflow.com/questions/11304895/how-to-scp-a-folder-from-remote-to-local&quot;&gt;remote to local&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;&amp;lt;!--email&lt;em&gt;off--&amp;gt;$ scp -i ~/.ssh/key.pem  /path/to/source/file username@server.com:~/path/to/destination/file&amp;lt;!--/email&lt;/em&gt;off--&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;

&lt;h3&gt;4. &lt;code&gt;cp&lt;/code&gt; copy&lt;/h3&gt;

&lt;p&gt;To &lt;a href=&quot;http://www.cyberciti.biz/faq/copy-folder-linux-command-line/&quot;&gt;copy&lt;/a&gt; files or entire folder:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ cp /path/to/source-folder/filename /path/to/destination-folder
$ cp -r /path/to/source-folder/folder /path/to/destination
$ cp /path/to/source-folder/filename /path/to/destination . # dot: destination is current folder
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;5. &lt;code&gt;mv&lt;/code&gt; move&lt;/h3&gt;

&lt;p&gt;To move files/folders is also the same as renaming.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ mv /path/to/source-folder/filename . # move file to current directory
$ mv /path/to/source-folder . # move folder to current directory
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;6. &lt;code&gt;echo&lt;/code&gt; output&lt;/h3&gt;

&lt;p&gt;To &lt;a href=&quot;http://linuxcommand.org/lc3_lts0080.php&quot;&gt;print out&lt;/a&gt; simple commands and piping the output to a new file.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ echo hello
$ echo `date` &gt;&gt; currentime.txt # copy to file
$ echo `date` &gt; currentime.txt # append
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;7. &lt;code&gt;touch&lt;/code&gt; update a file&lt;/h3&gt;

&lt;p&gt;When used without any arguments, &lt;code&gt;touch&lt;/code&gt; will simply &lt;a href=&quot;http://www.linfo.org/touch.html&quot;&gt;create a file&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ touch filename1 filename2 filename3&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;8. &lt;code&gt;ln&lt;/code&gt; symlink&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://ss64.com/bash/ln.html&quot;&gt;Symbolic links&lt;/a&gt; for files are useful when we want the exact file contents in 2 different places to be synced up. This can be handy for doing so with executable files if needed.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ln -s /path/to/source/filename /path/to/destination/filename&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;File contents&lt;/h2&gt;

&lt;h3&gt;9. &lt;code&gt;head&lt;/code&gt; top of a file&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;head&lt;/code&gt; is very useful to quickly view a certain first few lines of a file with an option &lt;code&gt;-n&lt;/code&gt; to specify how many lines from the top.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ head -n 5 /path/to/filename&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;10. &lt;code&gt;tail&lt;/code&gt; end of a file&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;tail&lt;/code&gt; as the name goes, is the opposite of the command &lt;code&gt;head&lt;/code&gt; and this gives the content of the &lt;a href=&quot;http://www.computerhope.com/unix/utail.htm&quot;&gt;last lines of a file&lt;/a&gt;. Using with the option &lt;code&gt;-f&lt;/code&gt;, the output is appended as the file grows and this is used to continuously view server log files while changes are happening.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ tail -n 5 /path/to/filename
$ tail -f log/production.log
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;11. &lt;code&gt;cat&lt;/code&gt; see the contents of a file&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cat&lt;/code&gt; is a simple way to view the file contents, but it can also be used to concatenate a few files into a new file.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ cat /path/to/filename
$ cat file1 file2 &gt;&gt; newfile # newfile has contents of file1 and file2
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Permissions&lt;/h2&gt;

&lt;h3&gt;12. &lt;code&gt;chmod&lt;/code&gt; change permissions&lt;/h3&gt;

&lt;p&gt;File permissions include the ability to read, write or execute the file for users owner, group or others. &lt;code&gt;chmod&lt;/code&gt; can &lt;a href=&quot;http://www.onlineconversion.com/html_chmod_calculator.htm&quot;&gt;change these permissions&lt;/a&gt; with either a number or expression.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ chmod u+x /path/to/script # user can execute
$ chmod 600 ~/.ssh/authorized_keys # user can read, write
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;13. &lt;code&gt;sudo&lt;/code&gt; act as root&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;sudo&lt;/code&gt; gives the &lt;a href=&quot;http://xkcd.com/149/&quot;&gt;permission to run commands as the root user&lt;/a&gt;. It can be used for a single command or a &lt;a href=&quot;http://askubuntu.com/questions/376199/sudo-su-vs-sudo-i-vs-sudo-bin-bash-when-does-it-matter-which-is-used&quot;&gt;series of commands&lt;/a&gt;. This command should definitely be used with caution as root user will have permissions to execute things a normal user might not.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo !! # execute the previous command with sudo
$ sudo cp /path/to/source /path/to/destination # execute as root
$ sudo su # switches from current user to root
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;14. &lt;code&gt;chown&lt;/code&gt; own the folder/file&lt;/h3&gt;

&lt;p&gt;To quickly change the owner of a folder or file &lt;code&gt;chown&lt;/code&gt; comes in handy in&lt;a href=&quot;http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo&quot;&gt; various situations&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo chown -R username:username ~/path/to/folder&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Directory&lt;/h2&gt;

&lt;h3&gt;15. &lt;code&gt;cd&lt;/code&gt; change directory&lt;/h3&gt;

&lt;p&gt;Changing directory is such a common command. Here are some ways to use &lt;code&gt;cd&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ cd ~ # go to home directory
$ cd - # go to the last visited directory
$ cd ../path/to/folder # go to relative directory one level up
$ cd /path/to/folder # absolute path
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;16. &lt;code&gt;ls&lt;/code&gt; list files/folders&lt;/h3&gt;

&lt;p&gt;Another common commands is to &lt;a href=&quot;http://www.freebsd.org/cgi/man.cgi?query=ls&amp;amp;sektion=1&quot;&gt;list the directory contents&lt;/a&gt;. Using &lt;code&gt;ls&lt;/code&gt; with 3 options are useful to view the dotfiles in long format to give a comprehensive look inside that folder.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ls -lah . # current folder
$ ls -lah ~ # home folder
$ ls -lah /path/to/folder # absolute path to a folder
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Monitoring processes&lt;/h2&gt;

&lt;h3&gt;17. &lt;code&gt;ps&lt;/code&gt; running processes&lt;/h3&gt;

&lt;p&gt;Knowing the &lt;a href=&quot;http://unixhelp.ed.ac.uk/CGI/man-cgi?ps&quot;&gt;current processes running&lt;/a&gt; is another useful command through &lt;code&gt;ps&lt;/code&gt;. Often, the list will be long. In this case &lt;a href=&quot;http://stackoverflow.com/questions/9375711/more-elegant-ps-aux-grep-v-grep&quot;&gt;piping the answer to a search terms&lt;/a&gt; is useful.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ps aux | grep unicorn # find all unicorn processes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The command &lt;code&gt;ps aux&lt;/code&gt; will give a long list of useful information about the processes including the user, CPU usage, path to the command as well as the Process ID (PID) which will come in handy if we want to stop that particular process.&lt;/p&gt;

&lt;h3&gt;18. &lt;code&gt;kill&lt;/code&gt; terminate a process&lt;/h3&gt;

&lt;p&gt;Often, we want to &lt;a href=&quot;http://unixhelp.ed.ac.uk/shell/jobz5.html&quot;&gt;find that particular process and kill/stop it&lt;/a&gt; so that we can make some change and then run it again. Coupled with the previous command &lt;code&gt;ps&lt;/code&gt; which will give the PID number, we can kill that particular process with a &lt;a href=&quot;http://stackoverflow.com/questions/9951556/why-number-9-in-kill-9-command-in-unix&quot;&gt;Unix signal 9&lt;/a&gt;. Here&amp;#39;s an example:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ ps aux | grep jekyll
$ sayanee  1835   0.0  0.8  2509028  68756 s003  S+    7:59PM   1:00.64 ruby /Users/command
$ kill -9 1835
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;19. &lt;code&gt;lsof&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;At other times, knowing &lt;a href=&quot;http://stackoverflow.com/questions/9346211/how-to-kill-a-process-on-a-port-on-ubuntu&quot;&gt;which process is running in a particular port&lt;/a&gt; is also useful. For this &lt;code&gt;lsof&lt;/code&gt; comes in handy!&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ sudo lsof -i:8080 # complete info on the process
$ sudo lsof -t -i:8080 # just the PID of the process
$ kill -9 `sudo lsof -t -i:8080` # put the PID to kill it
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;20. &lt;code&gt;crontab&lt;/code&gt; cron jobs for scheduling&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cron&quot;&gt;Scheduling scripts to run at a certain time or an interval&lt;/a&gt; is helpful through CRON jobs. Sometimes CRON jobs are created through a backend application using the application specific variables. To see the output, listing the cron job is useful.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ crontab -l&lt;/code&gt;&lt;/pre&gt;

&lt;hr&gt;

&lt;h2&gt;Getting started with DevOps&lt;/h2&gt;

&lt;p&gt;Noticing the most used commands is the first steps towards automation/shortcuts which can be done in the following ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;write the commands in a &lt;strong&gt;bash script&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;include commands in a &lt;strong&gt;CRON job&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;including commonly used commands as &lt;strong&gt;aliases&lt;/strong&gt; for shorthands&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are also frameworks such as &lt;a href=&quot;http://www.getchef.com/chef/&quot;&gt;Chef&lt;/a&gt; and &lt;a href=&quot;http://puppetlabs.com/&quot;&gt;Puppet&lt;/a&gt; which will help to kick start a list of commands that makes starting a production/staging environments easy with just one command or a click.&lt;/p&gt;

&lt;p&gt;I have also come to realize that there is a change in thought processes when I&amp;#39;m doing development versus devops. But in the end, it was rather rewarding to get to understand the file systems in various linux distributions or operating systems.&lt;/p&gt;

&lt;p class=&quot;discussion&quot;&gt;What common commands are you using? How do you automate your DevOps processes?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Updates&lt;/strong&gt;: Some useful tools were suggested:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ansible.com/home&quot;&gt;Ansible&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.getchef.com/chef/&quot;&gt;Chef&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://capistranorb.com/&quot;&gt;Capistrano&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://puppetlabs.com/&quot;&gt;Puppet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://fabric.readthedocs.org/en/1.8/&quot;&gt;Fabric&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>UX Patterns with Code</title>
   <link href="https://blog.sayan.ee/ux-patterns"/>
   <updated>2014-02-03T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/ux-patterns</id>
   <content type="html">&lt;div ng-app=&quot;App&quot;&gt;

  &lt;p&gt;The coolest thing about being a full-stack engineer is that I get to dabble in all parts of development including &lt;a href=&quot;http://en.wikipedia.org/wiki/User_experience&quot;&gt;ux&lt;/a&gt;, frontend, backend and &lt;a href=&quot;http://en.wikipedia.org/wiki/DevOps&quot;&gt;devops&lt;/a&gt;. While I love the coding aspect, the real test of the software comes when the user ultimately gets to interact with it.&lt;/p&gt;

  &lt;p&gt;My current project's tech stack included &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; as a pure &lt;a href=&quot;https://github.com/rails-api/rails-api&quot;&gt;api&lt;/a&gt; server, along with &lt;a href=&quot;http://angularjs.org/&quot;&gt;AngularJS&lt;/a&gt; as a stand-alone frontend and &lt;a href=&quot;http://aws.amazon.com/&quot;&gt;AWS&lt;/a&gt; for deployment. In terms of user interaction, I had 2 main challenges:&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;Querying from large volume of data&lt;/li&gt;
    &lt;li&gt;Displaying the right amount of data to the user&lt;/li&gt;
  &lt;/ol&gt;

  &lt;p&gt;As I was displaying the query results from the backend to the frontend, I realised I kept using these 6 patterns. They were implemented in &lt;a href=&quot;http://angularjs.org/&quot;&gt;AngularJS&lt;/a&gt;, but in terms of user interaction the tool is of course flexible.&lt;/p&gt;

  &lt;h2&gt;1. auto complete search&lt;/h2&gt;

  &lt;p&gt;Users love it when they come to a clean page with a big focus on just the search bar. Yes, a very Google-like clean design. In the following demo, the user &lt;strong&gt;already knows the search term&lt;/strong&gt; e.g. a serial number, name of person, etc. As the typing progresses, the search result becomes narrower quickly reducing to just the right number of info required by the user.&lt;/p&gt;

  &lt;div class=&quot;demo&quot;&gt;

    &lt;a class=&quot;code&quot; href=&quot;http://plnkr.co/edit/IuaW3l2WiN9Mi60r1FUC?p=preview&quot;&gt;code&lt;/a&gt;
    &lt;div ng-controller=&quot;PlanetsCtrl&quot;&gt;
      &lt;input type=&quot;text&quot; class=&quot;textbox&quot; ng-model=&quot;searchPlanets&quot; placeholder=&quot;Planet name in the Solar System. E.g. Saturn&quot; autofocus&gt;
      &lt;ol ng-show=&quot;searchPlanets&quot;&gt;
        &lt;li ng-repeat='planet in planets | filter:searchPlanets'&gt;
          &lt;strong&gt;{{planet.name}}&lt;/strong&gt; at {{planet.distance}} AU
        &lt;/li&gt;
      &lt;/ol&gt;
    &lt;/div&gt;

  &lt;/div&gt;

  &lt;h2&gt;2. search within&lt;/h2&gt;

  &lt;p&gt;In the following search pattern, a certain number of possible results are already displayed for the user to see and then search within them. This is because, the user is &lt;strong&gt;yet to know what is available&lt;/strong&gt;. The use case can be banking transactions or incoming donation amounts. Also, the user can type in any search terms apart from the main item. For example, in the demo below apart from the book name, the user can also search by author or year.&lt;/p&gt;

  &lt;p&gt;Another interesting pattern is the &lt;strong&gt;sorting order&lt;/strong&gt; of the displayed list. If there is a date and oldest item should be processed first (&lt;a href=&quot;http://en.wikipedia.org/wiki/FIFO&quot;&gt;FIFO&lt;/a&gt;), then the list should be &lt;strong&gt;chronological&lt;/strong&gt; (oldest is the first item). If the list is for activity monitoring e.g. transactions, then the order becomes &lt;strong&gt;reverse chronological&lt;/strong&gt; (newest is the first item).&lt;/p&gt;

  &lt;div class=&quot;demo&quot;&gt;

    &lt;a class=&quot;code&quot; href=&quot;http://plnkr.co/edit/RxFzsjPR5h3pVGHl0ywj?p=preview&quot;&gt;code&lt;/a&gt;
    &lt;div ng-controller=&quot;BooksCtrl&quot;&gt;
      &lt;input type=&quot;text&quot; class=&quot;textbox&quot; ng-model=&quot;searchBooks&quot; placeholder=&quot;Search book name, author or year&quot;&gt;
      &lt;ol&gt;
        &lt;li ng-repeat=&quot;book in bookList | filter:searchBooks | orderBy:'name'&quot;&gt;
          &lt;strong&gt;{{book.name}}&lt;/strong&gt; by {{book.author}} &lt;em&gt;[{{book.published}}]&lt;/em&gt;
        &lt;/li&gt;
      &lt;/ol&gt;
    &lt;/div&gt;

  &lt;/div&gt;

  &lt;h2&gt;3. emphasized selected item&lt;/h2&gt;

  &lt;p&gt;This is a common pattern to emphasize the chosen item among a list. The subtle visual cue helps in pointing out the selection from a large data set. In the following demo, the entire row becomes colored when the user selects the checkbox.&lt;/p&gt;

  &lt;div class=&quot;demo&quot;&gt;

    &lt;a class=&quot;code&quot; href=&quot;http://plnkr.co/edit/dNoeYpj67NtlZ1JhFqFu?p=preview&quot;&gt;code&lt;/a&gt;
    &lt;div ng-controller=&quot;BooksCtrl&quot;&gt;
      &lt;table class=&quot;table&quot;&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Select&lt;/th&gt;
            &lt;th&gt;Book name&lt;/th&gt;
            &lt;th&gt;Author&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tr ng-repeat='book in books' ng-class=&quot;{'demo-selected': (book.selected == true)}&quot;&gt;
          &lt;td&gt;&lt;input type=&quot;checkbox&quot; class=&quot;check-ctr&quot; ng-model=&quot;book.selected&quot;&gt;&lt;/td&gt;
          &lt;td&gt;{{book.name}}&lt;/td&gt;
          &lt;td&gt;{{book.author}}&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/div&gt;

  &lt;/div&gt;

  &lt;h2&gt;4. sequential steps&lt;/h2&gt;

  &lt;p&gt;If the user has to perform some sequential steps and the answer to the current step depends on the previous one, then the following patterns aid the user in focusing on the current step:&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;Hide all future steps&lt;/li&gt;
    &lt;li&gt;Reveal one step at a time&lt;/li&gt;
    &lt;li&gt;Disable input/action buttons to all previous steps&lt;/li&gt;
    &lt;li&gt;Display input/action buttons for the current action only&lt;/li&gt;
  &lt;/ol&gt;

  &lt;div class=&quot;demo&quot;&gt;
    &lt;a class=&quot;code&quot; href=&quot;http://plnkr.co/edit/hUNpBTpPGHGXvSnxXEtw?p=preview&quot;&gt;code&lt;/a&gt;
    &lt;ol&gt;
      &lt;li&gt;Pick a number from 1-10 &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 0)&quot; ng-click=&quot;count = count + 1&quot; ng-init=&quot;count=0&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 0)&quot;&gt;Multiply that number by 9 &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 1)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 1)&quot;&gt;Add up the digits to the previous answer &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 2)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 2)&quot;&gt;Subtract 5 from that number &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 3)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 3)&quot;&gt;Find the alphabet that corresponds to the number &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 4)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 4)&quot;&gt;Think of a country whose name starts with that letter &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 5)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 5)&quot;&gt;Take the 2nd alphabet of that country and think of an animal &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 6)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 6)&quot;&gt;Think of the color of that animal &lt;button class=&quot;button&quot; ng-hide=&quot;(count &gt; 7)&quot; ng-click=&quot;count = count + 1&quot;&gt;OK&lt;/button&gt;&lt;/li&gt;
      &lt;li ng-show=&quot;(count &gt; 7)&quot;&gt;Sadly, &lt;strong&gt;grey elephants&lt;/strong&gt; aren't found in &lt;strong&gt;Denmark&lt;/strong&gt; :-)&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/div&gt;

  &lt;h2&gt;5. disabled action button&lt;/h2&gt;

  &lt;p&gt;The following ux pattern helps the user keep a track while the selection is being made and guides the user upon each selection. Certain elements are also disabled so that the interface itself acts to allow only valid inputs.&lt;/p&gt;

  &lt;p&gt;The implementation can be summarised as:&lt;/p&gt;

  &lt;ol&gt;
    &lt;li&gt;Guiding words change as the user selects&lt;/li&gt;
    &lt;li&gt;Upon selecting all the required items:
      &lt;ul&gt;
        &lt;li&gt;the final action button appears&lt;/li&gt;
        &lt;li&gt;selection/input buttons for unselected items are disabled&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/ol&gt;

  &lt;p&gt;In the following demo, upon choosing any 3 books, not only the action button appears, but the checkboxes for the unselected items are also disabled.&lt;/p&gt;

  &lt;div class=&quot;demo&quot; ng-controller=&quot;BooksCtrl&quot;&gt;
    &lt;a class=&quot;code&quot; href=&quot;http://plnkr.co/edit/PS4TCagaidIYwd30rIQd?p=preview&quot;&gt;code&lt;/a&gt;

    &lt;p ng-hide=&quot;(count == 0)&quot;&gt;Choose &lt;strong&gt;{{count}}&lt;/strong&gt; &lt;span ng-show=&quot;(count &lt; 3)&quot;&gt;more&lt;/span&gt; book&lt;span ng-hide=&quot;(count == 1)&quot;&gt;s&lt;/span&gt;&lt;/p&gt;
    &lt;button class=&quot;button&quot; ng-show=&quot;(count == 0)&quot;&gt;Get the books!&lt;/button&gt;

    &lt;table class=&quot;table&quot; ng-hide=&quot;(booksOrdered == true)&quot;&gt;
      &lt;tr ng-repeat='book in books' ng-class=&quot;{'demo-selected': (book.chosen == true)}&quot;&gt;
        &lt;td&gt;&lt;input ng-hide=&quot;(count == 0) &amp;&amp; (book.chosen == false)&quot; type=&quot;checkbox&quot; class=&quot;check-ctr&quot; ng-model=&quot;book.chosen&quot; ng-init=&quot;book.chosen=false&quot; ng-click=&quot;updateCount(book)&quot;&gt;&lt;/td&gt;
        &lt;td&gt;{{book.name}}&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;

  &lt;/div&gt;

  &lt;h2&gt;6. more info on demand&lt;/h2&gt;

  &lt;p&gt;Finally, in this ux pattern the user has the &lt;strong&gt;choice of displaying more information&lt;/strong&gt; upon selecting an individual item. Often, we can query the server for all the information related to an individual item, but viewing them at one go might be too overwhelming for the user. In this case, only the most asked information is displayed first, leaving it to the user's discretion to reveal more information.&lt;/p&gt;

  &lt;p&gt;Often, I love to &lt;a href=&quot;http://codepen.io/bbodine1/pen/novBm&quot;&gt;style these checkboxes&lt;/a&gt; as switches or push button to give a more visual context on what the user can see upon clicking it.&lt;/p&gt;

  &lt;div class=&quot;demo&quot; ng-controller=&quot;BooksCtrl&quot;&gt;
    &lt;a class=&quot;code&quot; href=&quot;http://plnkr.co/edit/NLVzEsdVyhbdwdhfrs2H?p=preview&quot;&gt;code&lt;/a&gt;

    &lt;table class=&quot;table&quot;&gt;
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;th&gt;More&lt;/th&gt;
          &lt;th&gt;Book name&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tr ng-repeat='book in books' ng-class=&quot;{'demo-selected': (book.chosen == true)}&quot;&gt;
        &lt;td class=&quot;demo-fixed&quot;&gt;&lt;input type=&quot;checkbox&quot; class=&quot;check-ctr&quot; ng-model=&quot;book.chosen&quot; ng-init=&quot;book.chosen=false&quot;&gt;&lt;/td&gt;
        &lt;td&gt;
          {{book.name}}
          &lt;p ng-if=&quot;book.chosen&quot;&gt;{{book.summary}}&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;

  &lt;/div&gt;

  &lt;h2&gt;Learning about UX&lt;/h2&gt;

  &lt;p&gt;I found the following resources on common patterns as well as good examples of ux implementations for both web and mobile apps.&lt;/p&gt;

  &lt;ol class=&quot;ideas&quot;&gt;
    &lt;li&gt;&lt;a href=&quot;http://www.lukew.com/ff/entry.asp?1826&quot;&gt;Best UX patterns for mobile apps&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://uxdesign.smashingmagazine.com/2009/01/12/10-useful-web-application-interface-techniques/&quot;&gt;Useful web app interface techniques&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://ui-patterns.com/&quot;&gt;UI Patterns&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://quince.infragistics.com/html/AllPatterns.aspx&quot;&gt;Public patterns&lt;/a&gt;&lt;/li&gt;
  &lt;/ol&gt;

  &lt;p&gt;As I am getting to work with larger and larger data set, I'm actually enjoying going through the thinking of what will ease the user into finding the right information and making a clear decision. As much as possible, these can be built into the interface. And I would love to know more know how we can do them so as it make it as intuitive as possible to the user. &lt;/p&gt;

  &lt;p class=&quot;discussion&quot;&gt;What are other UX patterns that can aid the user in info search and decision making?&lt;/p&gt;

  &lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; More resource on UX - &lt;a href=&quot;http://searchpatterns.org/?&quot;&gt;Search Patterns&lt;/a&gt;.&lt;/p&gt;

&lt;/div&gt;

&lt;style&gt;
.demo-selected{ background-color: #ddd;}
.demo-fixed{width:20px; vertical-align: baseline;}
&lt;/style&gt;

&lt;script src=&quot;//ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js&quot;&gt;&lt;/script&gt;

&lt;script&gt;

var app = angular.module('App', []);

app.controller('BooksCtrl', function($scope) {

  $scope.books = [
    { name: 'Design Patterns', author: 'Gang of 4', published: '1994', summary: 'Elements of Reusable Object-Oriented Software' },
    { name: 'Getting Started with Electronics', author: 'Forrest M. Mims', published: '1983', summary: 'Teaches you the basics, takes you on a tour of analog and digital components' },
    { name: 'Design of Everyday Things', author: 'Donald A. Norman', published: '1988', summary: 'A powerful primer on how-and why-some products satisfy customers while others only frustrate them.' },
    { name: 'The Feynman Lectures on Physics', author: 'Richard Feynman', published: '1964', summary: 'Lectures on mathematics, electromagnetism, Newtonian physics, quantum physics, and the relation of physics to other sciences' },
  ];

  $scope.bookList = [
    { name: 'Design Patterns', author: 'Gang of 4', published: '1994' },
    { name: 'Getting Started with Electronics', author: 'Forrest M. Mims', published: '1983' },
    { name: 'Design of Everyday Things', author: 'Donald A. Norman', published: '1988' },
    { name: 'The Feynman Lectures on Physics', author: 'Richard Feynman', published: '1964' },
  ];

  $scope.count =  3;

  $scope.updateCount = function(book) {
    if(book.chosen) $scope.count += 1;
    else $scope.count -= 1;
  }

});

app.controller('PlanetsCtrl', function($scope) {

  $scope.planets = [
    { name: 'Mercury'   , distance: '0.39' },
    { name: 'Venus'     , distance: '0.72' },
    { name: 'Earth'     , distance: '1' },
    { name: 'Mars'      , distance: '1.52' },
    { name: 'Jupiter'   , distance: '5.20' },
    { name: 'Saturn'    , distance: '9.52' },
    { name: 'Uranus'    , distance: '19.21' },
    { name: 'Neptune'   , distance: '30.09' }
  ];
});

&lt;/script&gt;
</content>
 </entry>
 
 <entry>
   <title>Open sourced: Angular PDF</title>
   <link href="https://blog.sayan.ee/angular-pdf"/>
   <updated>2014-01-16T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/angular-pdf</id>
   <content type="html">&lt;p&gt;&lt;strong&gt;Angular-pdf&lt;/strong&gt; is an &lt;a href=&quot;http://angularjs.org/&quot;&gt;AngularJS&lt;/a&gt; directive based on &lt;a href=&quot;http://mozilla.github.io/pdf.js/&quot;&gt;Mozilla&amp;#39;s PDFJS&lt;/a&gt;. With this directive, a pdf file can be embedded into a web page with simple controls such as next/previous page, zooming, rotation and jump to a page.&lt;/p&gt;

&lt;ol class=&quot;os&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;http://sayan.ee/angularjs-pdf/&quot;&gt;demo&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/sayanee/angularjs-pdf/blob/master/readme.md&quot;&gt;docs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/sayanee/angularjs-pdf&quot;&gt;source code&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/sayanee/angularjs-pdf/issues/new&quot;&gt;feedback&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Install it for current projects with &lt;a href=&quot;http://bower.io/&quot;&gt;bower&lt;/a&gt; or simply git clone:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;bower install angular-pdf
# or
&lt;!--email_off--&gt;git clone git@github.com:sayanee/angularjs-pdf.git&lt;!--/email_off--&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And once the file &lt;code&gt;dist/angular-pdf.js&lt;/code&gt; is integrated as a directive &lt;code&gt;&amp;lt;ng-pdf&amp;gt;&lt;/code&gt; in the application, some simple navigations can be done to the pdf file.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-markup&quot;&gt;&amp;lt;div class=&quot;container&quot; ng-controller=&quot;DocCtrl&quot;&gt;
  &amp;lt;ng-pdf template-url=&quot;viewer.html&quot;&gt;&amp;lt;/ng-pdf&gt;
&amp;lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/ng-pdf.gif&quot; alt=&quot;Angular-PDF preview&quot;&gt;&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;The idea&lt;/h2&gt;

&lt;p&gt;I had the challenge to integrate over a thousand pdf files into a web application. This was a great idea as it was part of an effort to totally eliminate paper printing. Along with the ability to view and manipulate each pdf file with simple controls, there should also be a unique url for each pdf so that it can be bookmarked in the browser for future reference.&lt;/p&gt;

&lt;p&gt;Hence, I used the &lt;a href=&quot;http://docs.angularjs.org/api/ngRoute.$routeParams&quot;&gt;$routeParams&lt;/a&gt; service to get the current route parameters. With some simple string concatenation, the path to the pdf is stored in the scope variable &lt;code&gt;$scope.pdfUrl&lt;/code&gt; under the controller &lt;code&gt;DocCtrl&lt;/code&gt;, which then can be used by the Angular-pdf directive to render the file.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;app.controller('DocCtrl', function($scope) {
  $scope.pdfUrl = '/path/to/all/pdf/' + $routeParams.pdfname + '.pdf';
});
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Learning to open source&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m still quite a newbie to open sourcing my code. As I build more and more software, I&amp;#39;m finding that open source is a great way to learn. Finding ways to modularize and releasing it as a package can not only decouple our code base, but it&amp;#39;s also a fantastic way to give back to the very community I benefit from everyday.&lt;/p&gt;

&lt;p&gt;Here are some links I found about why and how to open source:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://tom.preston-werner.com/2011/11/22/open-source-everything.html&quot;&gt;Open source everthing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mattgemmell.com/open-source-code/&quot;&gt;Open source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://people.redhat.com/%7Erjones/how-to-supply-code-to-open-source-projects/&quot;&gt;How to get your code into an open source project&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I would love to have feedback on what are the elements of a good open source project and how I can integrate them into Angular-PDF or even future ones.&lt;/p&gt;

&lt;p class=&quot;discussion&quot;&gt;What are some good practices to incorporate when open sourcing?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Quick start projects</title>
   <link href="https://blog.sayan.ee/quick-start"/>
   <updated>2014-01-12T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/quick-start</id>
   <content type="html">&lt;p&gt;Let&amp;#39;s say we have 3 to 4 active projects at any one time. These projects might include, a couple of client projects, a side project or even a blog. Every time when starting each of these projects, typically the following applications need to be opened:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Text editor&lt;/strong&gt; with different folder paths&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Command line&lt;/strong&gt; with various panes and tabs&lt;/li&gt;
&lt;li&gt;Some &lt;strong&gt;native applications&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Browser&lt;/strong&gt; with various tabs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For each of the projects, the exact requirements to the above 4 applications definitely differs. For example, the browser needs to be opened in a different localhost port for different projects along with links to &lt;a href=&quot;https://github.com/&quot;&gt;Github&lt;/a&gt; or &lt;a href=&quot;https://trello.com/&quot;&gt;Trello&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the past few months, I have been automating the opening up of various project related elements with a single command - the project name itself. Here&amp;#39;s how the effect looks like when I open up various application with a single command to work on my blog:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/quick-start.gif&quot; alt=&quot;Quick start projects&quot;&gt;&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;What you need&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.alfredapp.com/&quot;&gt;Alfred app&lt;/a&gt; (optional) for launching a shell command&lt;/li&gt;
&lt;li&gt;Simple &lt;a href=&quot;http://www.tldp.org/LDP/Bash-Beginners-Guide/html/&quot;&gt;Bash&lt;/a&gt; scripting to create a script &lt;code&gt;project-name&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://tmux.sourceforge.net/&quot;&gt;Tmux&lt;/a&gt; and &lt;a href=&quot;https://github.com/aziz/tmuxinator&quot;&gt;Tmuxinator&lt;/a&gt; installation to create a tmuxinator project file &lt;code&gt;project-name.yml&lt;/code&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;brew install tmux
gem install tmuxinator
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With AlfredApp, we can &lt;a href=&quot;http://support.alfredapp.com/features:terminal&quot;&gt;call the shell command&lt;/a&gt; without launching any command line application with a simple prefix of &lt;code&gt;&amp;gt;&lt;/code&gt;. The bash script that we will create will open up various applications, url and paths in the Finder. &lt;a href=&quot;https://wiki.archlinux.org/index.php/tmux&quot;&gt;Tmux&lt;/a&gt; is a terminal multiplexer and I use it more oten to layout the arrangement of windows and panes that are running different commands.&lt;/p&gt;

&lt;p&gt;Let&amp;#39;s take the example of this blog itself and create the 2 files:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;blog&lt;/code&gt; (bash script)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;blog.yml&lt;/code&gt; (tmuxinator project file)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Create the script file&lt;/h3&gt;

&lt;p&gt;Usually, I just name the file as the project. In this case, it will be simply &lt;code&gt;blog&lt;/code&gt;. As this file needs to be an executable, we will also change the file permission with the command &lt;code&gt;chmod&lt;/code&gt;. Lastly, we will symlink this file to a file in a directory where all such automated scripts are stored. This &lt;a href=&quot;http://askubuntu.com/questions/3744/how-do-i-modify-my-path-so-that-the-changes-are-available-in-every-terminal-sess&quot;&gt;directory has to be found in your path variable&lt;/a&gt; &lt;code&gt;$PATH&lt;/code&gt;. Now, this script can be run from any location.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ touch blog

$ ls -al blog
-rw-r--r--  1 sayanee  staff  0 Jan 11 22:24 blog

$ chmod u+x blog

$ ls -al blog
-rwxr--r--  1 sayanee  staff  0 Jan 11 22:24 blog

$ ln -s blog /current/path/blog
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The exact contents of the script file will vary project to project, but it generally consists of the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;path to the source code is defined&lt;/li&gt;
&lt;li&gt;open the source code in &lt;strong&gt;window&lt;/strong&gt; and &lt;strong&gt;text editor&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;open some &lt;strong&gt;native applications&lt;/strong&gt; and they might include:

&lt;ul&gt;
&lt;li&gt;version control&lt;/li&gt;
&lt;li&gt;database visualiser&lt;/li&gt;
&lt;li&gt;graphic editing software&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;open &lt;strong&gt;project management&lt;/strong&gt; tools or &lt;strong&gt;remote repository&lt;/strong&gt; in browser. I have used the following:

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.pivotaltracker.com/&quot;&gt;Pivotal Tracker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/&quot;&gt;Github&lt;/a&gt; with link to the open issues assigned to me&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://trello.com/&quot;&gt;Trello&lt;/a&gt; board of the project&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;open the &lt;strong&gt;project url&lt;/strong&gt; in the browser&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;production url&lt;/li&gt;
&lt;li&gt;development url - might include admin / testing / documentation url&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;open the tmuxinator project&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is an example of the &lt;code&gt;blog&lt;/code&gt; script file.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;#!/bin/bash

# USAGE in the command line:
# blog

app=&quot;/Users/sayanee/Sites/blog/app&quot; # path to source code

open $app # open in Finder
subl $app # open in text editor
cd _posts &amp;&amp; open `ls -tr | tail -1` # open last modified file (latest post)

open /Applications/Tower.app # open version control visualiser

open https://github.com/sayanee/blog/issues/assigned/sayanee?state=open # open git remote repo assigned to me

open http://localhost:4000 # open in development
open http://blog.sayan.ee # open in production

tmuxinator blog # open tmuxinator project
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Create the tmuxinator project&lt;/h3&gt;

&lt;p&gt;Next, we will create the tmuxinator project file that will define the various window, panes and commands to fire when starting the project. Let&amp;#39;s first create the file &lt;code&gt;blog.yml&lt;/code&gt; and create a symlink to the &lt;code&gt;~/.tmuxinator&lt;/code&gt; folder.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;$ touch blog.yml

$ ln -s blog.yml ~/.tmuxinator/blog.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the Tmuxinator project, I will define various windows for the following purpose depending on the project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;frontend server e.g. &lt;code&gt;sudo nginx&lt;/code&gt; with &lt;a href=&quot;http://wiki.nginx.org/Main&quot;&gt;Nginx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;backend server e.g. &lt;code&gt;rails server&lt;/code&gt; for &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;automated testing&lt;/li&gt;
&lt;li&gt;continuous build tool e.g &lt;code&gt;grunt&lt;/code&gt; for &lt;a href=&quot;http://gruntjs.com/&quot;&gt;GruntJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;ssh into the production server e.g. &lt;code&gt;ssh production &amp;amp;&amp;amp; cd path/to/source&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop&quot;&gt;repl&lt;/a&gt; e.g. &lt;code&gt;node&lt;/code&gt; for &lt;a href=&quot;http://nodejs.org/&quot;&gt;NodeJS&lt;/a&gt; or &lt;code&gt;irb&lt;/code&gt; for &lt;a href=&quot;http://en.wikipedia.org/wiki/Interactive_Ruby_Shell&quot;&gt;Ruby&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For this blog, the Tmuxinator project is pretty simple consisting of 1 window with 3 panes.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;name: blog
root: /Users/username/path/to/blog
windows:
  - blog:
      layout: main-vertical
      panes:
        - git pull origin gh-pages &amp;&amp; clear &amp;&amp; ls
        - jekyll serve --watch --config _dev_config.yml
        - grunt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With the command &lt;code&gt;tmuxinator blog&lt;/code&gt;, a tmux session will be started that will look like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/tmuxinator-blog.jpg&quot; alt=&quot;Tmuxinator project&quot;&gt;&lt;/p&gt;

&lt;p&gt;And that&amp;#39;s all! With these 2 simple files, now whenever we trigger the command &lt;code&gt;blog&lt;/code&gt; all the project related elements will open up within seconds!&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;Another example&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;blog&lt;/code&gt; command is pretty simple, so I thought of giving another example for a project called &lt;code&gt;todo&lt;/code&gt;. This project consists of full stack development with frontend and backend.&lt;/p&gt;

&lt;p&gt;Here&amp;#39;s the content of the bash script &lt;code&gt;todo&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;#!/bin/bash

# USAGE in the command line:
# todo

app=&quot;/Users/sayanee/Workspace/todo&quot;
backend=&quot;/backend&quot;
frontend=&quot;/frontend&quot;
apidocs=&quot;/apidocs&quot;

open $app
subl $app$backend
subl $app$frontend
subl $app$apidocs

open /Applications/Postgres93.app # db
open /Applications/Tower.app # git management

open http://localhost:8000 # frontend
open http://localhost:4000 # api documentation
open http://localhost:3000 # backend

open https://github.com/username/todo-frontend/issues/assigned/sayanee?state=open
open https://github.com/username/todo-backend/issues/assigned/sayanee?state=open

open https://trello.com/b/xxxxxxx/todo-board-overview # trello tasks

tmuxinator todo
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And here is the tmuxinator project file &lt;code&gt;todo.yml&lt;/code&gt; with 4 windows opening up the development for frontend, backend or api documentation and lastly even the production server. When starting to code, I usually like to do a &lt;code&gt;git pull&lt;/code&gt; to sync my code base with the remote repository. Also, when logging into the production server with &lt;code&gt;ssh&lt;/code&gt;, I directly &lt;code&gt;cd&lt;/code&gt; into the direcotry required.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;name: todo
root: /Users/sayanee/Workspace/todo
windows:
  - backend:
      layout: main-vertical
      panes:
        - cd backend &amp;&amp; git pull
        - cd backend &amp;&amp; rails console
        - cd backend &amp;&amp; rails server
  - frontend:
      layout: main-vertical
      panes:
        - cd frontend &amp;&amp; git pull
        - cd frontend &amp;&amp; grunt
        - cd frontend &amp;&amp; sudo nginx
  - apidocs:
      layout: main-vertical
      panes:
        - cd apidocs
        - cd apidocs &amp;&amp; npm start
        - cd apidocs &amp;&amp; redis-server
  - production:
      layout: even-vertical
      panes:
        - ssh production -t &quot;cd /path/to/backend ; /bin/zsh&quot;
        - ssh production -t &quot;cd /path/to/frontend ; /bin/zsh&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr&gt;

&lt;h2&gt;Fast context switching&lt;/h2&gt;

&lt;p&gt;One of the challenges of getting into the &lt;em&gt;zone of creativity&lt;/em&gt; is how fast and easily we can launch the various applications and commands to get started, especially if we are spending some time launching them often. Here are some other projects that I found that helps in launching current projects fast:&lt;/p&gt;

&lt;ol class=&quot;ideas&quot;&gt;
    &lt;li&gt;&lt;a href=&quot;http://anvilformac.com/&quot;&gt;Anvil for mac&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://yeoman.io/&quot;&gt;Yeoman&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://brunch.io/&quot;&gt;Brunch&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;http://support.apple.com/kb/ht2488&quot;&gt;Apple Automator&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Would love to know if there is a better or alternative way to launching applications other the current method that I am using. What are your thoughts?&lt;/p&gt;

&lt;p class=&quot;discussion&quot;&gt;How do you quick launch your various active projects?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: You can also follow this discussion on &lt;a href=&quot;https://news.ycombinator.com/item?id=7045744&quot;&gt;Hacker News&lt;/a&gt; with more ideas on how others are implementing this.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Setting up my new MacBook</title>
   <link href="https://blog.sayan.ee/new-macbook"/>
   <updated>2014-01-04T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/new-macbook</id>
   <content type="html">&lt;p&gt;Having a brand new computer is like having a chance to sharpen your tool so that when we work with it, we are in a &lt;em&gt;flow&lt;/em&gt;. I took about 7-8 hours in total to get everything working!&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;Model Name:    MacBook Pro
Model Identifier:   MacBookPro11,2
Processor Name: Intel Core i7
Processor Speed:    2 GHz
Number of Processors:   1
Total Number of Cores:  4
L2 Cache (per Core):    256 KB
L3 Cache:   6 MB
Memory: 8 GB
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Before the setup&lt;/h2&gt;

&lt;p&gt;Apart from any data, in terms of settings, a few things came in really handy as I had them either as a user account or the configurations stored as a Github repository:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.google.com/intl/en/chrome/&quot;&gt;Chrome&lt;/a&gt;&amp;#39;s user &lt;a href=&quot;https://www.google.com/intl/en/chrome/browser/signin.html&quot;&gt;login&lt;/a&gt; - useful for all bookmarks and recent browsing history&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/sayanee/dotfiles&quot;&gt;Dotfiles&lt;/a&gt; - useful to keep a list of frequently used config files&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/sayanee/sublime-text-settings&quot;&gt;Sublime Text settings&lt;/a&gt; - any text editor is a major tool and its handy to keep its settings&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/&quot;&gt;Apple account&lt;/a&gt; - useful to download apps that I already had before&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://setapp.me/users/sayanee&quot;&gt;Setapp&lt;/a&gt; as a reference to all the tools and apps I use&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Apps to download&lt;/h2&gt;

&lt;p&gt;I started setting up the MacBook with the installation of the Chrome browser and then some apps from the &lt;a href=&quot;http://www.apple.com/osx/apps/app-store.html&quot;&gt;App Store&lt;/a&gt;. &lt;a href=&quot;https://developer.apple.com/xcode/&quot;&gt;XCode&lt;/a&gt; with &lt;a href=&quot;https://developer.apple.com/downloads/index.action?=command%20line%20tools&quot;&gt;Command Line Tools&lt;/a&gt; are almost always needed as they install GCC, Clang-LLVM and many other developer tools.&lt;/p&gt;

&lt;h3&gt;From the App Store&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.apple.com/xcode/&quot;&gt;XCode&lt;/a&gt; and its &lt;a href=&quot;https://developer.apple.com/downloads/index.action?=command%20line%20tools&quot;&gt;Command Line Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/livereload/id482898991&quot;&gt;LiveReload&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/dash-docs-snippets/id458034879&quot;&gt;Dash&lt;/a&gt; for easy documentation reference while programming&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/codebox/id412536790&quot;&gt;Codebox&lt;/a&gt; for storing quick code snippets&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/sketch/id402476602&quot;&gt;Sketch&lt;/a&gt; for making simple vector graphics for favicons or logos&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/us/app/skitch-snap-markup-send/id490505997&quot;&gt;Skitch&lt;/a&gt; for quick annotation of screenshots&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Other apps&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.sublimetext.com/3&quot;&gt;Sublime Text 3&lt;/a&gt; as my main text editor&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.iterm2.com/&quot;&gt;iTerm2&lt;/a&gt; as a replacement for Terminal&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/fallroot/applescript-applets&quot;&gt;Applets for Finder toolbar&lt;/a&gt; to quickly open the folder in Iterm2 or Sublime Text&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.alfredapp.com/&quot;&gt;AlfredApp&lt;/a&gt; as a quick launcher with &lt;a href=&quot;http://www.alfredforum.com/topic/24-minimal-updated-download-available/&quot;&gt;Minimal theme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://caffeine.en.softonic.com/mac&quot;&gt;Caffeine&lt;/a&gt; to prevent sleeping&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.freemacsoft.net/appcleaner/&quot;&gt;App Cleaner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mouapp.com/&quot;&gt;Mou App&lt;/a&gt; for writing my markdown for &lt;code&gt;readme.md&lt;/code&gt; files&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/fikovnik/ShiftIt&quot;&gt;ShiftIt&lt;/a&gt; for Finder window positioning with shortcut keys&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.git-tower.com/&quot;&gt;Tower&lt;/a&gt; to quickly see my version changes with git&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://postgresapp.com/&quot;&gt;Postgres.app&lt;/a&gt; for database&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Finder, Display, Keyboard and Files&lt;/h2&gt;

&lt;p&gt;The thing about configuring a brand new machine is that you become aware of the little settings that you are always used to. Here are my settings for the Finder:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Show Path Bar, Sidebar, Status Bar. &lt;code&gt;Finder &amp;gt; View &amp;gt; Show Path Bar/Status bar/Side bar&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/view-options.png&quot; alt=&quot;Finder View Options&quot;&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Search in Current Folder and show file extensions. &lt;code&gt;Finder &amp;gt; Preferences &amp;gt; Advanced&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/finder-pref.png&quot; alt=&quot;Finder Advanced Preferences&quot;&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/fallroot/applescript-applets&quot;&gt;Applets for Finder toolbar&lt;/a&gt; to quickly open the folder in iTerm2 or Sublime Text&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/finder.png&quot; alt=&quot;Finder Advanced Preferences&quot;&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;hr&gt;

&lt;p&gt;I also like to have Hot Corners for easy access to the Desktop and have a snap shot of all the running application windows. Setting: &lt;code&gt;System Preferences &amp;gt; Desktop &amp;amp; Screen Saver &amp;gt; Screen Saver &amp;gt; Hot Corners&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/hot-corners.png&quot; alt=&quot;Hot Corners&quot;&gt;&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;I have remapped my almost-never-used &lt;code&gt;Caps Lock&lt;/code&gt; key to &lt;code&gt;Control&lt;/code&gt; key. This comes in really handy when using with &lt;a href=&quot;https://wiki.archlinux.org/index.php/tmux#Key_bindings&quot;&gt;Tmux key bindings&lt;/a&gt; as &lt;code&gt;ctrl-a&lt;/code&gt; is just 2 keys side by side. Setting: &lt;code&gt;System Preferences &amp;gt; Keyboard &amp;gt; Modifier Keys &amp;gt; Caps Lock Key&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/remap.png&quot; alt=&quot;Remapping keys&quot;&gt;&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;In terms of hidden or dotfiles, I like to show them. The following command in the Terminal will enable them:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Installed packages&lt;/h2&gt;

&lt;p&gt;The final step was to install the various packages that I use when I am programming. I started by installing the package manager &lt;a href=&quot;http://brew.sh/&quot;&gt;brew&lt;/a&gt; and then updating and upgrading brew itself. I installed some packages like wget, autojump and tree - useful when working in the command line, jumping from one folder to another or displaying the contents of the folder.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;ruby -e &quot;$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)&quot;

brew update
brew upgrade

brew install wget
brew install autojump
brew install tree
brew install terminal-notifier
brew install tmux
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next I installed packages that I use while programming in the &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; ecosystem. I started with &lt;a href=&quot;https://rvm.io/rvm/install&quot;&gt;RVM&lt;/a&gt;, then &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; itself, &lt;a href=&quot;http://git-scm.com/downloads&quot;&gt;Git&lt;/a&gt; and &lt;a href=&quot;http://rubygems.org/pages/downloadgit&quot;&gt;RubyGems&lt;/a&gt;. &lt;a href=&quot;https://help.github.com/articles/set-up-git&quot;&gt;Setting up Git&lt;/a&gt; and then &lt;a href=&quot;https://help.github.com/articles/generating-ssh-keys&quot;&gt;generating SSH Keys&lt;/a&gt; had me setup my Github as well.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;\curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

rvm get stable

brew install git
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, I installed &lt;a href=&quot;http://nodejs.org/&quot;&gt;Node&lt;/a&gt; releated packages. The main installer on the Node website comes with both Node as well as &lt;a href=&quot;https://npmjs.org/&quot;&gt;NPM&lt;/a&gt;, so I downloaded that. Also, just like Ruby&amp;#39;s RVM, I use Node&amp;#39;s &lt;a href=&quot;https://npmjs.org/&quot;&gt;NVM&lt;/a&gt; for managing Node versions. Finally, I installed some commonly used global packages like &lt;a href=&quot;http://gruntjs.com/&quot;&gt;Grunt&lt;/a&gt; and &lt;a href=&quot;http://bower.io/&quot;&gt;Bower&lt;/a&gt;. Here are the steps:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;curl https://raw.github.com/creationix/nvm/master/install.sh | sh

npm install -g grunt
npm install -g grunt-cli

npm install -g bower
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Sharpening the Tools&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;I&amp;#39;ve known people who have not mastered their tools who are good programmers, but not a tool master who remained a mediocre programmer. ~ &lt;a href=&quot;https://twitter.com/KentBeck/status/398623270917771264&quot;&gt;Kent Beck&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Recently, I listened to a lovely episode from the &lt;a href=&quot;http://rubyrogues.com/129-rr-sharpening-tools-with-ben-orenstein/&quot;&gt;RubyRogues on Sharpening the Tools&lt;/a&gt;. Couldn&amp;#39;t agree more with the fact that as we are making and creating stuff, we will have to continuously keep note of steps that we are repeating or steps that are mildly erking us.&lt;/p&gt;

&lt;p&gt;Can we do it smaller number of steps or in an easier way? I&amp;#39;m keeping a little scratch note of this and every few weeks I go back to it and find ways to improve. Whether it&amp;#39;s amending my bash prompt to contain more information or linting while coding in my text editor - all these tiny steps add up to ease me into the &lt;em&gt;flow of creativity&lt;/em&gt; every time I get down to work.&lt;/p&gt;

&lt;p&gt;I would love to hear from you too!&lt;/p&gt;

&lt;p class=&quot;discussion&quot;&gt;What apps or packages do you use very often? How do you keep sharpening your tools?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: After getting some more tips, I have also install:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://filezilla-project.org/download.php&quot;&gt;FileZilla&lt;/a&gt; for ftp&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://itunes.apple.com/en/app/kindle/id405399194&quot;&gt;Kindle app&lt;/a&gt; to read &lt;code&gt;*.mobi&lt;/code&gt; format Kindle eBooks&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/sindresorhus/quick-look-plugins&quot;&gt;QuickLook plugins&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.sequelpro.com/&quot;&gt;Sequel Pro&lt;/a&gt; for MySQL db management&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 
 <entry>
   <title>On web and iot, minimalism, space</title>
   <link href="https://blog.sayan.ee/restart"/>
   <updated>2014-01-01T00:00:00+00:00</updated>
   <id>https://blog.sayan.ee/restart</id>
   <content type="html">&lt;h2&gt;2013&lt;/h2&gt;

&lt;p&gt;This was an intense and vibrant &lt;strong&gt;year of sharing&lt;/strong&gt; for me! And I absolutely loved it.&lt;/p&gt;

&lt;p&gt;As I immersed myself in the world of web technologies, I found myself taking the route of &lt;a href=&quot;http://hub.tutsplus.com/authors/sayanee-basu&quot;&gt;writing&lt;/a&gt;, &lt;a href=&quot;http://build-podcast.com/&quot;&gt;screencasting&lt;/a&gt; and &lt;a href=&quot;http://live.webuild.sg/&quot;&gt;podcasting&lt;/a&gt; to further strengthen the understanding of my work. After all, teaching and sharing is learning for myself as well. Through this I also made so many wonderful conversations from fellow developers all around the world!&lt;/p&gt;

&lt;p&gt;After focusing on the &amp;quot;hows&amp;quot; of making things with the web, I have realised I need to scratch deeper to understand the &amp;quot;whys&amp;quot; and pen down my reflections and explorations. Writing seems to be the perfect reflective process to do so and bring clarity to that thinking.&lt;/p&gt;

&lt;p&gt;I will specifically write on 3 things that have come to define my &amp;quot;what&amp;quot;, &amp;quot;how&amp;quot; and &amp;quot;why&amp;quot;.&lt;/p&gt;

&lt;h2&gt;The What - Web &amp;amp; IOT&lt;/h2&gt;

&lt;p&gt;The web still excites me so much because of its democratic power to put ones creation at an instant to every single person anywhere in the world. In the coming decade, potentially &lt;a href=&quot;http://www.huffingtonpost.com/eric-e-schmidt/the-new-digital-age_b_3128692.html&quot;&gt;5 billion more will be coming online&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Along with the world of bits and bytes, I also discovered that I can make cool things to connect the physical world to this web. Sensors are becoming cheaper and the hardware movement is becoming exciting for beginners with projects like &lt;a href=&quot;http://arduino.cc/&quot;&gt;Arduino&lt;/a&gt; and &lt;a href=&quot;http://rasberrypi.org/&quot;&gt;RasberryPI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/web-iot.jpg&quot; alt=&quot;Web and IOT&quot;&gt;&lt;/p&gt;

&lt;p&gt;In the coming year, I want to pen down my journey into the world of web that I fell in love few years back as well as a new field for me - hardware, sensors and the &lt;a href=&quot;http://en.wikipedia.org/wiki/Internet_of_Things&quot;&gt;Internet of Things&lt;/a&gt;. These are some interesting links I found on the Web and IOT...&lt;/p&gt;

&lt;ol class=&quot;ideas&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;http://littlebits.cc/&quot;&gt;Little Bits&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.adafruit.com/&quot;&gt;Adafruit&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.amazon.com/Makers-The-New-Industrial-Revolution/dp/0307720950&quot;&gt;Makers: The New Industrial Revolution&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts&quot;&gt;ECMAScript 6&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.polymer-project.org/&quot;&gt;Polymer project&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;The How - Minimalism&lt;/h2&gt;

&lt;p&gt;In almost everything I do, I&amp;#39;m finding a bliss in simplicity. Whether it is applying the &lt;a href=&quot;http://en.wikipedia.org/wiki/Don&amp;#x27;t_repeat_yourself&quot;&gt;DRY&lt;/a&gt; principle in programming, traveling light or keeping an uncluttered home, I have fallen in love with minimalism as a way of doing anything.&lt;/p&gt;

&lt;p&gt;In the coming year, I will have the chance to apply minimalism into more areas such as designing my upcoming home, applying &lt;a href=&quot;http://en.wikipedia.org/wiki/Test-driven_development&quot;&gt;test-driven development&lt;/a&gt; or understanding the principles of &lt;a href=&quot;http://en.wikipedia.org/wiki/Minimalism#Minimalistic_design&quot;&gt;minimal design&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have come to draw inspiration for minimalism from some these links...&lt;/p&gt;

&lt;ol class=&quot;ideas&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dieter_Rams#Dieter_Rams:_ten_principles_for_good_design&quot;&gt;Dieter Rams: ten principles for good design&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://scottchacon.com/2011/08/31/github-flow.html&quot;&gt;Github Flow&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://zenhabits.net/&quot;&gt;Zen Habits&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.becomingminimalist.com/&quot;&gt;Becoming Minimalist&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.agiledata.org/essays/tdd.html&quot;&gt;Test Driven Development&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;The Why - Space&lt;/h2&gt;

&lt;p&gt;Big topic to comprehend is the very space, the universe we are all engulfed in.&lt;/p&gt;

&lt;p&gt;Over the years, the amateur study of the universe has not only brought me back to the fundamentals of mathematics and physics, but also given me huge inspiration to why we must deny our boundaries of country, race, religion and unite to do great work that will pass on after we leave this world. I had an amazing time in Chile this year experiencing some aspects of astronomy. I hope to consistently remind myself of the much bigger universe we all live in to give a bigger perspective as we live through the days.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.sayan.ee/img/space.jpg&quot; alt=&quot;Space&quot;&gt;&lt;/p&gt;

&lt;p&gt;These links might interest anyone keen to take a peek into the current work of humanity into understanding space:&lt;/p&gt;

&lt;ol class=&quot;ideas&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.startalkradio.net/&quot;&gt;Star Talk radio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.eso.org/public/esocast.html&quot;&gt;ESO Cast&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Overview_effect&quot;&gt;Overview Effect&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.spacex.com/&quot;&gt;SpaceX&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.nanosatisfi.com/&quot;&gt;Nano Satisfi&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;What&amp;#39;s next&lt;/h2&gt;

&lt;p&gt;I&amp;#39;m really looking forward to 2014! I&amp;#39;m excited on what&amp;#39;s to come and the things I&amp;#39;m gonna make :) And yes, keep writing!&lt;/p&gt;

&lt;p&gt;I would love to know your thoughts too!&lt;/p&gt;

&lt;div class=&quot;discussion&quot;&gt;
  &lt;p&gt;Do you know of other cool projects on web, internet of things, simplicity and space exploration?&lt;/p&gt;
&lt;/div&gt;
</content>
 </entry>
 
</feed>
