<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yash Indane</title>
    <description>The latest articles on DEV Community by Yash Indane (@yashindane).</description>
    <link>https://dev.to/yashindane</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F732342%2F338b585b-a8a8-4314-9844-6c505b2fae38.png</url>
      <title>DEV Community: Yash Indane</title>
      <link>https://dev.to/yashindane</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yashindane"/>
    <language>en</language>
    <item>
      <title>Configuring Amazon Alexa on Raspberry Pi!</title>
      <dc:creator>Yash Indane</dc:creator>
      <pubDate>Sat, 26 Mar 2022 15:21:29 +0000</pubDate>
      <link>https://dev.to/yashindane/configuring-amazon-alexa-on-raspberry-pi-10i6</link>
      <guid>https://dev.to/yashindane/configuring-amazon-alexa-on-raspberry-pi-10i6</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Alexa&lt;/em&gt;&lt;/strong&gt; is Amazon’s cloud-based voice service available on more than 100 million devices from Amazon and third-party device manufacturers. With Alexa, you can build natural voice experiences that offer customers a more intuitive way to interact with the technology they use every day.&lt;/p&gt;

&lt;p&gt;In this post I will guide you how to do it on a &lt;strong&gt;Raspberry Pi&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&amp;gt;&lt;/strong&gt; &lt;em&gt;Creating Amazon Developer Account&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Open up a browser and go to &lt;strong&gt;&lt;a href="https://developer.amazon.com/"&gt;https://developer.amazon.com/&lt;/a&gt;&lt;/strong&gt;.&lt;br&gt;
Just enter a username and password and create your account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e34lk52d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bysmfh2lkylizvxcbfht.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e34lk52d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bysmfh2lkylizvxcbfht.png" alt="Image1" width="880" height="673"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&amp;gt;&lt;/strong&gt; &lt;em&gt;Register Amazon Developer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Just enter all the relevant details&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5oXshh-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyqcgwdnbehnckshs0rn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5oXshh-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyqcgwdnbehnckshs0rn.png" alt="Image2" width="880" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&amp;gt;&lt;/strong&gt; &lt;em&gt;Creating the Product&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;strong&gt;&lt;a href="https://developer.amazon.com/alexa/console/avs/products"&gt;https://developer.amazon.com/alexa/console/avs/products&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click on Add new product&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHh9Eai---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22g332cour803um9h5i3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZHh9Eai---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22g332cour803um9h5i3.png" alt="Image3" width="880" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now fill the required details&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kqW69hbp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhlnqate8xgnt9cokdge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kqW69hbp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhlnqate8xgnt9cokdge.png" alt="Image4" width="880" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vK62U7wy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/klkjbqukyolpnzycmq82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vK62U7wy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/klkjbqukyolpnzycmq82.png" alt="Image5" width="880" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LmN2MFVq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo4hyxtnvfkuhq70m5wo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LmN2MFVq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zo4hyxtnvfkuhq70m5wo.png" alt="Image6" width="880" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&amp;gt;&lt;/strong&gt; &lt;em&gt;Creating LWA Security Profile&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Click on create new profile and fill the details&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: You can put anything in security profile description&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cSsGLXJH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0yzps1gghj33x8qk7hu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cSsGLXJH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0yzps1gghj33x8qk7hu.png" alt="Image7" width="880" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After filling details click on next.&lt;/p&gt;

&lt;p&gt;Copy all the details and note them, as they will be required in further steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--esgIDTtM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqks5n88tbrzov01a4n1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--esgIDTtM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqks5n88tbrzov01a4n1.png" alt="Image8" width="880" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zX9qGEkI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jozgm7vybv9xyemyrz7v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zX9qGEkI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jozgm7vybv9xyemyrz7v.png" alt="Image9" width="880" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;IN allowed origins field put &lt;strong&gt;&lt;a href="http://IP:5050"&gt;http://IP:5050&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="http://localhost:5050"&gt;http://localhost:5050&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;IP is the IP of the Raspberry Pi where you want to Alexa service to run.&lt;/p&gt;

&lt;p&gt;In allowed return URLs put &lt;strong&gt;&lt;a href="http://IP:5050/code"&gt;http://IP:5050/code&lt;/a&gt;&lt;/strong&gt;  and &lt;strong&gt;&lt;a href="http://localhost:5050/code"&gt;http://localhost:5050/code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IP is the IP of the Raspberry Pi where you want to Alexa service to run.&lt;/p&gt;

&lt;p&gt;Click on I agree and then continue/next.&lt;/p&gt;

&lt;p&gt;You will get a message that Your product has been created successfully.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5&amp;gt;&lt;/strong&gt; &lt;em&gt;Configuring the device&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Open up a terminal, we will do some installations first.&lt;/p&gt;

&lt;p&gt;Make sure everything is updated -&lt;br&gt;
&lt;code&gt;$ sudo apt-get update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Distribution upgrade -&lt;br&gt;
&lt;code&gt;$ sudo apt-get dist-upgrade&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install git -&lt;br&gt;
&lt;code&gt;$ sudo apt-get install git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Install CherryPy library -&lt;br&gt;
&lt;code&gt;$ sudo pip3 install CherryPy==17.4.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Navigate to /opt folder -&lt;br&gt;
&lt;code&gt;cd /opt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Clone the AlexaPi repository -&lt;br&gt;
&lt;code&gt;$ sudo git clone https://github.com/alexa-pi/AlexaPi.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run the setup script -&lt;br&gt;
&lt;code&gt;$ sudo ./Alexa/src/scripts/setup.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Answer the prompts according to your device and OS. For Airplay support give &lt;strong&gt;n&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Once every detail is provided to the script, open up a browser and go to &lt;strong&gt;&lt;a href="http://localhost:5050"&gt;http://localhost:5050&lt;/a&gt;&lt;/strong&gt;. If any error comes then check in security profile configuration that the URLs are added.&lt;/p&gt;

&lt;p&gt;Sign in using your Amazon developer account credentials.&lt;/p&gt;

&lt;p&gt;This page will come after signing in, click on Allow&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BprbxgBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bon20i7xip2fdlzuh2pi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BprbxgBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bon20i7xip2fdlzuh2pi.png" alt="Image10" width="582" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will get this message -&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vk4lQ-hh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4e5sgierxqhv768xozny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vk4lQ-hh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4e5sgierxqhv768xozny.png" alt="Image11" width="698" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now exit the browser and press Ctrl+C in the terminal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step&lt;/strong&gt; Start the AlexaPi service&lt;/p&gt;

&lt;p&gt;start by -&lt;br&gt;
&lt;code&gt;$ sudo systemctl start AlexaPi.service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;stop by -&lt;br&gt;
&lt;code&gt;$ sudo systemctl stop AlexaPi.service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Connect a Speaker and Mic to your Raspberry Pi. Once the service is running start asking &lt;strong&gt;Alexa&lt;/strong&gt; any questions.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;My GitHub Profile -&amp;gt; &lt;a href="https://github.com/YashIndane"&gt;https://github.com/YashIndane&lt;/a&gt;&lt;br&gt;
My Linkedin Profile -&amp;gt; &lt;a href="https://www.linkedin.com/in/yash-indane-aa6534179/"&gt;https://www.linkedin.com/in/yash-indane-aa6534179/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>alexa</category>
      <category>amazon</category>
      <category>tech</category>
      <category>programming</category>
    </item>
    <item>
      <title>Enable CGI in Apache2</title>
      <dc:creator>Yash Indane</dc:creator>
      <pubDate>Fri, 12 Nov 2021 15:53:07 +0000</pubDate>
      <link>https://dev.to/yashindane/enable-cgi-in-apache2-mgi</link>
      <guid>https://dev.to/yashindane/enable-cgi-in-apache2-mgi</guid>
      <description>&lt;p&gt;By default when you install &lt;code&gt;apache2&lt;/code&gt;, and navigate to /var/www directory you won't find the &lt;code&gt;cgi-bin&lt;/code&gt; folder. To enable CGI in &lt;code&gt;apache2&lt;/code&gt; follow this steps -&lt;/p&gt;

&lt;h2&gt;
  
  
  Install apache2
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install apache2 -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Enable CGI module
&lt;/h2&gt;

&lt;p&gt;We can find the available &lt;code&gt;modules&lt;/code&gt; in &lt;code&gt;/etc/apache2/mods-available&lt;/code&gt;. Here you will see the &lt;code&gt;cgi.load&lt;/code&gt; module which you need to load.&lt;/p&gt;

&lt;p&gt;Enable by-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo ln -s /etc/apache2/mods-available/cgi.load
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now as Apache configuration has changed, reload the apache service by -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo service apache2 reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create CGI-script
&lt;/h2&gt;

&lt;p&gt;Apache2 recognizes cgi-scripts in the directory &lt;code&gt;/usr/lib/cgi-bin&lt;/code&gt;, so we need to place the script in this folder.&lt;/p&gt;

&lt;p&gt;Lets create a cgi script in python that returns the output of &lt;code&gt;free -m&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/bin/python3
&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;getstatusoutput&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;gso&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;cgi&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content-type:text/plain&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;gso&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;free -m&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make this script executable by -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo chmod +x c.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now just &lt;code&gt;curl&lt;/code&gt; to get response&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvlm4mor16ie5wh5c3ayd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvlm4mor16ie5wh5c3ayd.png" alt="Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect with me -&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yash-indane-aa6534179/" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/YashIndane" rel="noopener noreferrer"&gt;GitHub Profile&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>webdev</category>
      <category>python</category>
      <category>apache</category>
    </item>
  </channel>
</rss>
