<![CDATA[Down The Codes]]>https://downthe.codes/https://downthe.codes/favicon.pngDown The Codeshttps://downthe.codes/Ghost 6.19Thu, 19 Mar 2026 12:45:16 GMT60<![CDATA[What is ROS (Robot Operating System) ?]]>https://downthe.codes/what-is-ros/676c38f8fefb804bd29a5f28Mon, 23 Nov 2020 12:56:00 GMT

Have you ever wondered how advanced robots are programmed? Do you know there's a framework especially made for that? Let's see in this article what it is and how to learn that.

What is ROS?

Robot Operating System (ROS) is not an actual operating system but it is a set of tools and framework for writing robot software. It aims to simplify the task of creating complex and robust robot behaviour across various robotic platforms. ROS was built from the ground up to encourage collaborative robotics software development. It is an open-source framework that helps researchers and developers build and reuse code between robotics applications.

ROS Versions

ROS releases a version every year in May, following the release of Ubuntu LTS versions. ROS2 releases a new version every six months (in December and July). These releases are supported for a single year.

Each ROS version is supported on a particular version of OS. For ROS1, Ubuntu is recommended, however other OS can also be used but only partial support and/or community-contributed installation guides are available.

More details of the ROS versions can be found here.

Who uses ROS?

ROS has been adopted into some of the biggest names in robotics. The majority of organizations are either using ROS as it can be installed by anyone or a fork of ROS in some form.

The use-cases of ROS are still growing. It is used across numerous industries from agriculture to medical devices to vacuum cleaners but is spreading to include all kinds of automation and software-defined dynamic use-cases.

Why should you use ROS?

  • ROS was built with cross-collaboration in mind. The base code and knowledge can be applied across all robotics platforms such as arms, drones, mobile bases, etc.
  • It’s open-source. ROS has contributors all over the world using ROS for countless different purposes.
  • ROS robots can use any language. You can communicate easily between Python and C++ nodes, get libraries to allow you to use most other languages or install rosbridge and use any language that can speak JSON.
  • There is a package for everything. Whether you want to compute trajectory, conduct SLAM algorithms or implement remote control, there’s a ROS package for that.

And many more .....

How to learn ROS?

Now you'll be thinking about how to start learning ROS and start creating your own robots. No worries, we have got you all covered. Currently, there are very few online tutorials on ROS available. We have found some of the best ones and listed them here.

Video Tutorials

  1. ROS Tutorials from Robotis
  2. Programming for Robotics: ROS Tutorials from ETH Zurich
  3. ROS Basic Tutorials from Shawn Chen
  4. ROS in 5 days from Construct
  5. ROS Course from Edx

Books For ROS

  1. A Gentle Introduction to ROS by Jason M. O'Kane [Read Here]
  2. ROS Robot Programming by YoonSeok Pyo, HanCheol Cho, RyuWoon Jung, TaeHoon Lim [Read Here]
What is ROS (Robot Operating System) ?
Photo by Erhan Astam / Unsplash
What is ROS (Robot Operating System) ?

Keep Learning ! Bbyee 👋

]]>
<![CDATA[Create A Beautiful Responsive Website Within Minutes]]>https://downthe.codes/create-responsive-website-tailwind/676c38f8fefb804bd29a5f27Sun, 02 Aug 2020 15:38:00 GMT

Hello Everyone, In this post I will be telling you how to make a beautiful responsive website within minutes and I'm not talking about any free website creating tool. You will write the whole code and deploy it also on your own all for free. We will use Tailwind CSS for styling and Netlify to deploy our newly created website.

Adding Tailwind CSS Stylesheet

Open your favorite code editor and create a new file named index.html. Now we will write the starter html code and add the Tailwind CSS CDN into between the head tag of your html code. This will add the Tailwind CSS stylesheet to our html code and now we can use the classes defined by Tailwind CSS in our website.

Your code should like this now:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
    <title>My Website</title>
</head>
<body>
    
</body>
</html>

Adding Blocks

Now we will add the Tailwind blocks to our webpage according to the design we need. Go to Tailblocks, where Ready-to-use Tailwind CSS blocks are available. You can find blocks divided into multiple categories such as contact, content, e-commerce, feature and many more.

Select the design you like and select the colour of the blocks you want. Then click on view code which will display the code for that corresponding block. Copy that code and paste it into our HTML code between body tags. You can change the colour of these blocks by going to Tailwind Background Colors and replacing the colour code in the code.

Once you have added all the designs you can open your HTML file in any web browser of your choice and you will find your new website which is both responsive and beautiful.

You can add paddings, margins etc according to your need easily by just adding a class to that element.

Hosting on Netlify

Once you have finalized your website design upload the HTML code and other assets of the website to a new GitHub repository. Now head over to Netlify and log in using your GitHub account. Once logged in, click on New Site from Git and follow the steps to add the repository you have created, keep the build command field empty and click on Deploy Site to deploy your website to Netlify.

Once your website has been deployed successfully you will see the link to your website. Open the link to see the live version of your website and share it with your friends.

What if you want to change something on the website? You don't need to create a new repository and repeat all the steps. You can directly commit changes to your repository and the changes will automatically get deployed on the Netlify.

You can also add a custom domain if you have one. Read the Netlify Docs to learn more.


Fun Fact- I have made my personal portfolio website also this way.

I hope you liked this article. See you soon in another one.

Bbyee 👋

]]>
<![CDATA[AWS CLI S3 Commands]]>https://downthe.codes/s3-cli-commands/676c38f8fefb804bd29a5f26Thu, 25 Jun 2020 15:06:00 GMT

Hello, In this post we will see some of the commands that will make your job easier while working with AWS S3 buckets.

What is AWS S3?

Amazon Simple Storage Service also known as Amazon S3 is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 is designed for 99.999999999% (11 9's) of durability, and stores data for millions of applications for companies all around the world.

To know more about AWS S3 you can read here.

Commands

1. Create S3 Bucket in Default Region

Enter the following command to create a new bucket in the default region you have specified while configuring the AWS CLI. If the bucket name is already owned by you or someone else, you will get the error stating that.

aws s3 mb s3://bucket_name

2. Create S3 Bucket in Another Region

Enter the below command to create a new bucket in the region you have specified after the region flag. You can find the region names on the AWS website.

aws s3 mb s3://bucket_name --region region-name

3. Delete Empty S3 Bucket

Make sure the bucket you want to delete is empty or else you will get an error saying that bucket is not empty. Make sure the bucket exists in your account.

aws s3 rb s3://bucket_name

4. Delete Non-Empty S3 Bucket

To delete the non-empty bucket make sure to put the force flag after the bucket name.

aws s3 rb s3://bucket_name --force

5. List All S3 Bucket

Use the ls command in the following way to list all the buckets in your account.

aws s3 ls 

OR

aws s3 ls s3://

6. List All Objects in S3 Bucket

To list all objects in the bucket use the ls command and specify the bucket name in the command. It will display the list of files and folders in the S3 bucket.

aws s3 ls s3://bucket_name

7. List All  objects in S3 Bucket Recursively

To list all objects recursively use the ls command and specify the bucket name in the command. It will display the list of files and folders and all of its contents recursively.

aws s3 ls s3://bucket_name --recursive

8. Copy File to S3 Bucket

To copy file from the local machine to the S3 bucket. Make sure you enter the correct file location which you want to copy and also the location where you want to copy in the bucket.

aws s3 cp /home/file_to_copy.txt s3://bucket_name

9. Copy Folder to S3 Bucket

To copy the whole folder to the S3 bucket use the recursive flag after the bucket name. Make sure to enter the correct folder location.

aws s3 cp /home/folder_to_copy s3://bucket_name --recursive

10. Download File from S3 Bucket

To download file from an S3 bucket use the following command. This copies file.txt from the S3 bucket to the directory specified on the local machine. To download the file on the local machine with a different name, you can enter the new name in the destination field.

aws s3 cp s3://bucket_name/file.txt /home/downloads

11. Download All Files from S3 Bucket

To download all the files from an S3 bucket use the following command. This copies all the files and sub-folders present in the S3 bucket to the directory specified on the local machine.

aws s3 cp s3://bucket_name /home/project --recursive

12. Copy File Among S3 Buckets

To copy file among S3 buckets, use the following command. This copies file.txt from the source S3 bucket to the target S3 bucket. To copy file on the target bucket with a different name, you can enter the new name in the destination field with the target bucket name.

aws s3 cp s3://source_bucket/file.txt s3://target_bucket

13. Copy All Files Among S3 Buckets Recursively

To copy all the files among the S3 buckets, use the following command. This copies all the files and sub-folders present in the source S3 bucket to the destination S3 bucket.

aws s3 cp s3://source_bucket s3://target_bucket --recursive

14. Find Size Objects in S3 Bucket

To display the size of objects present in the S3 bucket. Use the recursive flag to display the size of all the files and sub-folders, a human-readable flag to display the size of the file in a readable format and summarize flag to display the last two lines in the output with the total number of objects in the S3 bucket and the total size of all those objects.

aws s3 ls s3://bucket_name --recursive --human-readable --summarize

15. Delete a File from S3 Bucket

To delete a file from the S3 bucket use the rm command and specify the file location in the S3 bucket.

aws s3 rm s3://bucket_name/file.txt

16. Delete All Files from S3 Bucket

To delete all the files from an S3 bucket, use the –recursive flag. This will clear the bucket.

aws s3 rm s3://bucket_name --recursive

17. Move File to S3 Bucket from Local

To move a file to the S3 bucket from the local machine, use the following command. To move file on the S3 bucket with a different name, you can enter the new name in the destination field with the location of the file on the bucket.

aws s3 mv file.txt s3://bucket_name

18. Move File from S3 Bucket to Local

To move a file to the local machine from the S3 bucket, use the following command. To move file on the local machine with a different name, you can enter the new name in the destination field with the location.

aws s3 mv s3://bucket_name/file.txt /home/downloads

19. Move Folder to S3 Bucket Recursively

To move all files and sub-folders recursively to S3 bucket from local machine use the following command. Add recursive flag to the move command.

aws s3 mv /home/folder s3://bucket_name/folder --recursive

20. Move Folder from S3 Bucket to Local Recursively

To move all files and sub-folders recursively to local machine from S3 bucket use the following command. Add recursive flag to the move command.

aws s3 mv s3://bucket_name/folder /home/downloads/folder --recursive

21. Move File among S3 Buckets

To move a file from the target bucket to the source bucket use the following command. To move file on source bucket with different name, you can enter the new name in the destination field with the location on the source bucket.

aws s3 mv s3://source_bucket/file.txt s3://target_bucket

22. Move Folder among S3 Buckets

To move all files and sub-folders among the S3 buckets use the following command. This will move all the files and sub-folder and it's contents to the target bucket from the source bucket.

aws s3 mv s3://source_bucket s3://target_backup --recursive

23. Sync Files from Local to S3 Bucket

To sync files from the local machine to the S3 bucket, use the following command with the appropriate location of files. It will only upload the file which doesn't exist or is not updated on the S3 bucket.

aws s3 sync /home/folder s3://bucket_name

24. Sync Files from S3 Bucket to Local

To sync files from the S3 bucket to local machine, use the following command with the appropriate location of files. It will only download the file which doesn't exist or is not updated on to the local machine.

aws s3 sync s3://bucket_name /home/downloads

25. Sync Files among S3 Buckets

To sync files among two S3 buckets, use the following command.

aws s3 sync s3://source_bucket s3://target_bucket

26. Host website on S3 Bucket

We can also host a static website on S3 bucket. Just upload the files to the bucket and specify the index and error page name in the command. If your bucket is in the us-east-1 region, then you can access your website on the URL: http://bucket_name.s3-website-us-east-1.amazonaws.com

aws s3 website s3://bucket_name/ --index-document index.html --error-document error.html

For more details on AWS CLI you can visit official documentation.


I hope you would have found these commands useful.

Stay Home Stay Safe.

Bbyee 👋

]]>
<![CDATA[Building a Simple Slack Bot]]>https://downthe.codes/simple-slack-bot/676c38f8fefb804bd29a5f25Mon, 25 May 2020 04:50:00 GMT

Hello,
You would have come across many slack bot tutorials. So this is one of them and especially for a newbie programmer along with the explanation of the code.

In this tutorial, we are going to create a Slack App which will send the timetable daily morning via Slack Bot to you and we will deploy that on AWS Lambda. The backend code of the bot will be written in Python 3.

What is Slack?

Slack is essentially a chat room for your whole company, designed to replace email as your primary method of communication and sharing. Its workspaces allow you to organize communications by channels for group discussions and allow for private messages to share information, files, and more all in one place.

To improve user-friendliness, Slack manages its space more efficiently. First, it divides conversations into Public, Private channels and direct messages, while WhatsApp offers only one-to-one or group chats.

Configuring Slack

In this section, we will see how to configure Slack for our Project.

  • Go to Slack’s website and create a workspace if you don’t have one already.
  • After successful registration, login into your workspace. On the left find Channels. Click on Add a Channel to create a new channel for our Project.
Building a Simple Slack Bot
Slack Channel
  • Now go to https://api.slack.com/apps and click on Create New App. Enter the name you want to give to your app and select the workspace you want to deploy your app into.
  • After creating the app, select the Incoming Webhooks options.
Building a Simple Slack Bot
Incoming Webhooks
  • Activate the Incoming Webhooks by using the slide button provided.
Building a Simple Slack Bot
Activating Incoming Webhooks
  • Now scroll down and click on the Add New Webhook to Workspace.
  • It will ask you to select the channel you want to post the messages. Select the channel from the drop-down list and click on allow.
  • The webhook is now active in your workspace.
  • You can find the Webhook URL on the Incoming Webhook page. Copy the URL as we will need that later in our code.
Note:- Always keep the Webhook URL private as anyone can push message using this URL.

Creating Python Script

We will be using datetime, requests and JSON library available for Python 3. The text is pushed to the Slack Channel via Webhooks available in Slack.

  • Create a new folder for our project and name it accordingly.
  • Open any text editor of your choice and create a file with the .py extension and save it in the project folder. The whole code of the project is linked at the last of this article.
  • First, we will import datetime, requests and json libraries in our project.
  • When we create a Lambda function, we specify a handler, which is a function in our code, that AWS Lambda can invoke when the service executes our code. We will do it in the following way:
  • Now we will get today's weekday using the datetime library which is in integer format and then store that in a variable named day. Then we will use Python List having all the weekday's names and store the name of that weekday in a variable.
  • We will now store the schedule in the Python List.
  • The message is pushed to Slack via Webhook gives us a unique URL to which we can send the JSON payload with the message text and some options.
  • The webhook URL is stored in a variable. Paste the Webhook URL within the quotes that we got in the previous section.
  • The message that we are going to send is stored in a variable names send_data.
  • Now we will create a function to send the data to Slack.
  • Now using the if condition we will specify which of the data is to be sent from the list we created before.
  • Copy the above same code for all other weekdays and replace the name of the weekday.
  • Now call the webhook_send send function.
  • This will push the message to the Slack Channel.
import requests
import json
import datetime
def lambda_handler(event=None, context=None): 
    # Our Main Code
day = datetime.datetime.today().weekday()
days_list = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
today_day = days_list[day]
Monday = ["Subject 1,", "Subject 2,", "Subject 3"]
Tuesday = ["Subject 1,", "Subject 2,", "Subject 3"]
Wednesday = ["Subject 1,", "Subject 2,", "Subject 3"]
Thursday = ["Subject 1,", "Subject 2,", "Subject 3"]
Friday = ["Subject 1,", "Subject 2,", "Subject 3"]
Saturday = ["Subject 1,", "Subject 2,", "Subject 3"]
webhook_url = 'Your-Slack-Webhook-URL'
send_data = "Good Morning !! :smile:\nToday it's " + days_list[day] + "\n\nTimetable is :"
def webhook_send():
        response = requests.post(wekbook_url, data=json.dumps(data),   headers={'Content-Type': 'application/json'})
if (day == 0):
        for i in range(len(Monday)):
            send_data = send_data + " " + Monday[i]
data = { 'text': send_data }
.
.
.
.
if (day == 6):
        data = { 'text': 'Today is Sunday :smile: \nNo classes today. Enjoy!!!!' }

AWS Lambda Deployment Package

A deployment package is a ZIP archive that contains our function code and dependencies. We need to create a deployment package if we use the Lambda API to manage functions, or if we need to include libraries and dependencies other than the AWS SDK in our project.

  • In your terminal, go to the folder in which your Python script is present.
  • Enter the following command in your terminal.
  • All the files for that library are now installed in the project folder.
  • Open file explorer and open the project folder. Select all the files and right-click on add to archive to compress them all into a ZIP file.
  • The deployment package of our project is now ready.
pip3 install requests -t .

What is AWS Lambda?

AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. It was introduced in November 2014.

AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume.

With Lambda, you can run code for virtually any type of application or backend service — all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.

Deploying on AWS Lambda

To use AWS Lambda you need to have an AWS account. I would recommend you create a free trial account which offers many AWS Services free for the first year. You can try out these services and learn AWS platform.

To deploy our application on AWS Lambda, follow the below given steps:

  • Log in to AWS and select the region you want to deploy your app on the top left corner. It is recommended that you select the region nearest to you.
  • Search Lambda in the dashboard and open the Lambda Dashboard.
  • Click on Create Function.
Building a Simple Slack Bot
Creating Lambda Function
  • Select Author from scratch and give the name of your function. Select the Runtime as Python 3.x and click on Create Function.
Building a Simple Slack Bot
Configurations for Lambda Function
  • After the function is successfully created you will be redirected to the configuration page of your newly created function.
  • Now click on Add Trigger on the Designer tab in Configuration Pane. Select CloudWatch Events from the drop-down menu.
  • Select Create new Rule and then give the name of your rule.
  • Use the following configuration to run your code daily at 7 AM (UTC) and click on Add.
Building a Simple Slack Bot
CloudWatch Events Configuration
Note:- The cron function timings are always in UTC.
  • Now click on the name of the function in the Designer tab in the Configuration pane.
Building a Simple Slack Bot
Lambda Function Overview
  • Scroll down to the Function Code table. In the Code entry type select Upload a .zip file and upload the zip file we created in the previous section.
  • Now click on Save to save our newly created function.
  • To test our function, click on Test and select Create new test event. Select the Hello World event template and give a suitable name for the event and leave others as default. Create the event by clicking on Create.
  • Now click on Test, this should send the message on your Slack channel.
  • If you didn’t receive the message, then check if you followed all the steps correctly. You can even check the logs in CloudWatch Logs for more error information.

Your Slack App is now deployed successfully on AWS Lambda and will run at the specified time. You can use this idea to implement something similar to this type.


The whole code of this project is available here.

To send the school timetable daily automatically to Slack Channel.
To send the school timetable daily automatically to Slack Channel. - slack_lambda.py
Building a Simple Slack Bot

So this is the end of the tutorial. I hope you would have successfully deployed the Bot on AWS Lambda.

Stay Home Stay Safe. Have a great day ^_^

Bbyee 👋

See you in the next post!

]]>