teleren/devto huggingface dataset:
Curl In 5 Min
Tags: webdev, http, linux, cli
Published: 2020-12-25 18:33:02

# So What is Curl ??

## Curl is a cli tool for making http from terminal it allows us to use other protocols such as FTP

CURL - Client URL

# Simple Get Request Using Curl

`` curl http://www.name.domain ``

## by default it will log the output or if you want to save response as a file use ``-o`` argument 

# Example

`` curl -o output.html http://www.name.domain  ``

# Also 
`` curl  http://www.name.domain > output.html ``

# For Specifying URL use 

`` curl -s http://www.name.domain ``

For POST method 


``curl -d '{"name":"John","surname":"Doe"}'\http://www.name.domain``

The -X flag specifies a custom request method to use when communicating with the HTTP server. By default, the GET method is used unless some other method is specified.



# Setting User Agent 
``
curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.0 i686)" http://www.name.domain
``
# Conclusion

## yeah every one should know how to use curl 

# Keep Coding !!!


# 🙏  Share with your friends on  [Twitter](https://twitter.com/intent/tweet?text=%20  Curl In 5 Min %20%20https://dev.to/alestor123/curl-in-5-min-ngm"Share It" )
 
 
<h2 align=center> 👇  Find more posts on the following topics </h2>
Configuration of HAProxy using Ansible in AWS
Tags: linux, ansible, aws
Published: 2020-12-25 17:10:36

Hello everyone, 

In this article, we are going to configure HAProxy using Ansible in AWS, 

So let's get started...

I have launched three instances in aws👇

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/drm5ltbacs24su97nwnf.png)

### Configuration of Control Node:

> Install Ansible in Control Node

To install Ansible use command **pip3 install ansible** and then install **sshpass** using command **yum install sshpass**

> Create Inventory

After installing Ansible create an Inventory anywhere in the system, here I have created an inventory named **ip.txt** and inside inventory put Managed Node username, Password, and the connection type.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kvn6llm5ayog7rzdtddl.png)

Here I have created group one of the load balancer and other of Backend Server.

> Check the connectivity of Managed Node
 
To check connectivity using command **ansible all -m ping**.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f7aemb38tot8v6eykk0a.png)

> Create Ansible Configuration file

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2jjeamircf39f64cxba8.png)

> Create Playbook

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/isk7779sr36xyg6l4872.png)

> Configure Haproxy file

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/01skac7ok39c7rkytbm6.png)

- Before we run the playbook lets check first is Haproxy is installed in the Control node or not, to check that use command **rpm -q haproxy**

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8rkl77oh11fiwm6vadca.png)

Here we can see Haproxy is not installed.

> Run the Playbook.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6q88wtfxd2y3lziq5sze.png)

- now check Haproxy is installed in the Control node or not

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hb2p7eopga3czvypg2fb.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l0hn8r1el9xzteq3ggnt.png)

Here you can see Haproxy is installed and launched successfully...

- Check in Managed node is webserver configured or not

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pz7zd33uly4lpj6p1xly.png)

Here you can see it is configured successfully...

> Check Haproxy or Load balancer is working or not

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pjxxreodcjeausjc9nqk.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ub69ygtsqch1hgn2lcsn.png)

Here you can see it is working...🙌

So that's how we can configure **Haproxy** in **AWS** using Ansible...

Thank you!❄
What I learned from building a Telegram bot on Next.js
Tags: nextjs, node, googlecloud, chatbot
Published: 2020-12-25 17:36:32

The future is now 🚀 Get yourself a cool sticker T-Shirt without never leaving Telegram. I wanted to try out Telegram Bot API's [Payments](https://core.telegram.org/bots/payments)  feature so I built [@StickerShirtsBot](https://t.me/StickerShirtsBot?start=). It also comes with a frontend app [stickershirts.com](https://stickershirts.com).

### How does it work? 

<img style="float: left" src="https://dev-to-uploads.s3.amazonaws.com/i/2jj2d42307frbtix1b4l.gif" />

You send a sticker to [@StickerShirtsBot](https://t.me/StickerShirtsBot?start=), our API generates a mockup image of the result and sends it back to you. After you choose the colour and the size of the shirt you want, the bot sends you an order invoice. You input your address details and pay the order (all inside Telegram). Your order gets sent to [Printful](http://printful.com/), we manually approve it for printing and the printed organic cotton T-Shirt gets automatically sent to you. 


**Technology**

- Telegram Payments
- Next.js
- Vercel
- Jimp
- Firestore
- Google Cloud Storage

### Next.js is a great tool for a variety of projects

Next.js might be a bit of an overkill for a chatbot, but I figured having it as an easy, standardised framework for building a function-based REST API is a good idea. Similar to Serverless framework, I like how you can deploy it anywhere and there's everything ready for building a frontend. 

In my case, I'm using Telegram API's webhook feature to receive all messages sent to the bot. As most of the development work is done locally, my development bot is registered to push events to my local Next.js through [ngrok](https://ngrok.com/) endpoint.


### Vercel's hobby plan might not be enough

Functions in hobby plan can only run for 10 seconds. Generating the mockup image from the sticker usually takes less than that, but there's always a chance for it taking longer. This means that sometimes the requests would fail before the user gets their mockup. 

Moving the project over to a team account wasn't trivial either. Instead of a transfer feature, you have to remove the project from your account and import it manually to the new team account

### Github Actions are a great companion for Vercel's hobby plan

If you wanna stick to the free hobby plan, you might want to consider an alternative solution for long-running jobs. Github actions is a good option for this.

### You probably need a static file storage

Telegram caches images indefinitely, so in an ideal case, I could have generated the images to a `/tmp` directory temporarily and serve them once to Telegram when it requests the image. Unfortunately in the serverless world, there are no guarantees that the same `/tmp` directory is available when the request eventually gets made. 

I first went with S3, which I then later on discarded for Google's Cloud Storage. For some reason writing to S3 sometimes took over 4 seconds for 200kB files. 

Give the Telegram [bot]([@StickerShirtsBot](https://t.me/StickerShirtsBot?start=)) a try and tell me what you think!
code-server for libtorrent 2.0
Tags: libtorrent, codeserver, vscode, bittorrent
Published: 2020-12-25 17:18:48

Libtorrent is version 2.0 rc now!!
It Great!!
https://github.com/arvidn/libtorrent


I created a develop environment at docker. In order to give it  a try.

https://github.com/kyorohiro/libtorrent_codeserver


# Unique Point
This Develop Environment's Good Point

- bundled vscode 
- using docker
- autocomplete at vscode c++plugin 

You can develop a torrent client with libtorrent Immediately!!
This Pacakge Has Already installed C++ and vscode c++ plugin!!


# Procedure

## Prepare

```
git clone https://github.com/kyorohiro/libtorrent_codeserver
cd libtorrent_codeserver
```

```
cd res 
git clone https://github.com/arvidn/libtorrent
cd libtorrent
git checkout RC_2_0
git submodule init 
git submodule update
```

## RUN  Docke Image

```
docker-compose build
docker-compose up -d
```

## Open VSCODE on Browser

open  "http://127.0.0.1:8443/"
※ 127.0.0.1 is your docker ip

## BUILD HELLO WORLD

```
g++ main_simple_torrent.cpp  -ltorrent-rasterbar -lpthread
```

## START A CLIENT

```
./a.out xxx.torrent
```
Merry Christmas, by Python
Published: 2020-12-25 16:46:28

Developers from the four corners of the World, Merry Christmas!

```python
x, y = 10, 0
while (x > 1):
  print(' ' * x + 'O' + ' ' * y + 'O')
  x-=1
  y+=2
print (' O' + '*' * 18 + 'O')
for y in range (2):
  print (' ' * 9 + '#' * 3 + ' ' * 9)
```
Create a responsive contact us form using HTML and CSS
Tags: html, css, cwb, contactus
Published: 2020-12-25 17:05:34

The contact us form is made with HTML and CSS. They are usually used on the contact us page. It is very useful and Important e.g. users can directly contact you if they find any issue and it increases user interaction, you can also use it by copy-pasting the code from my site.
<a rel="nofollow" href="https://codewithbishal.com/example/contact-us-form-using-html">View it on our website</a>
View More :
<ul>
<li><a rel="nofollow" href="https://www.codewithbishal.com/example/create-an-image-slider-with-html">Pure CSS automatic Image Slideshow</a></li>
<li><a rel="nofollow" href="https://codewithbishal.com/example/html-css-social-media-buttons">Social media icon animation</a></li>
</ul>
At first, on our webpage, there is a preview of our contact us form then there are few QNA and an overview of the blog. There is a button to copy the codes (HTML and CSS). You can also try it on our website

You can view and copy the source code files through the link given below. <a href="https://codewithbishal.com/example/contact-us-form-using-html">View and Copy Source Code</a>
How can playing chess ♞ evolve your coding skills? 💥🐱‍💻
Tags: career, computerscience, productivity, programming
Published: 2020-12-25 17:00:59

I have always been a big fan of chess. Since I was 10, I am enjoying playing it more than anything else. Well, I am not a great player (not even close, lol) but I enjoy the way that the game of chess helps me build mind maps and reasoning skills. Recently, I have been playing it a lot and I have realized that it has the capability to improve one's problem-solving skills.

Here are the five changes that I have developed in me because of chess.


#Attention to details! 👀

Chess is all about attention. How attentive you are will impact the result of the game. As a coder, I have always faced problems in finding bugs or even logical errors in a code but recently I have found that due to chess, my attention span on things has improved drastically. I now scan things rather than just skimming through them which has proven to be a really good skill for me.

#Approaching the problem in an optimized way 🚴‍♂️

Earlier, I had a careless attitude towards the problems that I was supposed to solve in my coding assignments. I used to just solve a problem somehow and never bat an eye about finding other/optimal ways of solving it, but now I really dig deep into them and try my best to find the optimized answer.

#Innovative and spontaneous thinking 🤔

I know whatever I am saying till now might come up as bragging to some people ( lol, I am just sharing my thoughts) but my main motive is to tell everyone how chess can improve you. Adding more colors to that, chess can really help you in becoming an innovative and spontaneous thinker. Once you’ll get into the game you would have to find innovative techniques (called traps in chess) and then later on as the time decreases you would have to be spontaneous and confidant with your moves. These crucial skills can also be applied to real-world problems.

#Never underestimate others 🤼

Whenever you meet an opponent, never ever judge him/her/them. Underestimating someone not only losses your focus but also kills the hunger inside you to win. Learning from everyone however could help you a lot. To sum it up, sometimes it is the people no one imagines anything of who do the things that no one can imagine.

#It is not the end until it is the end 💪

I have also learned that one should never give up, be it in life, a game, or anything else. It is very important to fight till the end. You have to give your 100% till the last millisecond. There were instances where I played higher-rated players than me and won. Initially, you will fail, you will lose but soon the things will change. Even a chess grandmaster can blunder once in a blue moon. You just have to wait for your turn and give your best until the game lasts. The same thing goes for life and almost anything else.

I hope you liked reading my thoughts and I wish to hear out your suggestions.
My Portfolio | Hackathon
Tags: dohackathon
Published: 2020-12-25 16:43:51

## What I built
I Tried To Make A Creative and Different Personal Portfolio Website.
### Category Submission: 
Personal Site/Portfolio

### series: [“v1.0”]


### Screenshots
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9cwwws34rpnk11cxjt7d.png)

### Description
 Although I am new to web design and front-end development, I wanted to take this great hackathon opportunity. Actually, I'm a civil engineering student, but I've loved computers since I was a kid.

When I first met C and C ++ languages ​​and for the first time in the command window, "Hello World!" When I wrote it was like a spell. Then I started making programs for simple paragraphs, calculators, and simple math equations. When I made my first game of tetris and snake, I was incredibly excited. I was sure I could achieve this. Then I started to research and download the game engines and play around a bit. After Unity2d projects, I turned to 3d projects. After I managed to make platform games that would be considered simple again, I realized that actually it is very important to do this job than graphic design. I also started studying graphic design as a hobby.

And while researching all these, I realized that great projects can be done with Javascript and CSS3. I opened a site with WordPress admin panel to share all this with people. Believe me, I don't want to deal with PHP again. Because PHP and MySQL was a very different issue for me. It was taking too long to solve the problems I encountered. But I was happy with this situation because I realized later that these problems actually caused me to learn. I had to get out of the dark lands of WordPress.

While researching website designs, I met freecodecamp and finished all stages. This was incredibly enjoyable. And then I met "dev.to". This was a great place because everyone was helping each other. Right here as I was just joining you, I saw the hackathon announcement. I thought why not. And I made my application. Here is my latest site!

I am still making various arrangements. I will be releasing the latest version soon and I am very excited about it. I will be waiting for your comments. Good luck everyone!!!
What was your win this week?
Tags: discuss, weeklyretro
Published: 2020-12-25 16:43:29

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

Happy Friday!


**Looking back on your week — what was something you're proud of?**

All wins count — big or small 🎉

Examples of 'wins' include:

- Starting a new project
- Landing a new job
- Baking something delicious... or whatever else might spark joy ❤️

---

Have a great weekend!

![You made it](https://media.giphy.com/media/OWwj1MPBNtBh6/giphy.gif)
1 Create a new template page in your Shopify store
Tags: css, shopify, json
Published: 2020-12-25 16:41:32

<ol>
<li>From your Shopify admin, go to <b>Online Store > Themes.</b></li>

<li>Find the theme you want to edit, and then click <b>Actions > Edit code.</b></li>

<li>In the <b>Templates</b> directory, click <b>Add a new template.</b></li>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gbe0ksucp7goyxyc15jq.png)

<li>Choose a type option for your new template. For example, for an alternate page template, select page. Give your template a meaningful name, which will make it easy to find when you are assigning it in the admin.</li>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w9ak31h94ny8q6uzlubf.png)

<li>Click Create a template. Your new template will open in the code editor, and the file will be populated with the default code.</li>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qtlpyjf6mrpekn0um960.png)

<li>Edit your new template as needed.</li>

<li>Click Save. 👍</li>

<br>
<hr>
<h5>I hope This information is help to create template page for your store.
Also visit our website ❤️ <a href="http://mycodemagic.com/">mycodemagic</a>  🙂 <h5>
Day-2: 30 days of code- Hackerrank
Tags: webdev, javascript, help, codenewbie
Published: 2020-12-25 15:34:36

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lmsgechbhgpb36l5y4tq.jpg)


Hey folks. On Day-2 of 30-Days of Code by HackerRank, we'll solve the question related to operators using Javascript.

Lets dive into it.

###Day-0
####Task:- 
'Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost. Round the result to the nearest integer.'

In the task, we are given the meal price, tip percent and tax percent and we have to find the total cost of the meal which would be the addition of this three things(meal+tip+tax).

####Solution:-
```js
function solve(meal_cost, tip_percent, tax_percent) {
//total cost equation basic maths
const total_cost=meal_cost+(tip_percent*meal_cost/100)+(tax_percent*meal_cost/100)

//rounding the value to the nearest integer using Math.round
const rounded_cost=Math.round(total_cost)
console.log(rounded_cost)
}
```

####Explanation:-
1. In the solution, we wrote a function solve(), which receives three parameters viz., meal_cost, tip_percent, tax_percent.
The function call for solve() is already made for us and we just have to complete the code inside the function.
2. Now, we declared a variable called as total_cost and assigned a simple mathematical equation to it to give the total meal cost.
3. Then we rounded off our total meal cost to the nearest integer using Math.round() method (which is a built-in method of javascript).

Thank you!! Stay tuned!!
Responsive Pricing Table using HTML & CSS
Tags: pricingtable, pricetable, pricingcards, pricecards
Published: 2020-12-25 15:21:03

Hello readers, today in this blog I'm going to create a Responsive Pricing Table using HTML & CSS. In my earlier blog. I have shared <a href="https://www.codinglabweb.com/2020/12/responsive-profile-cards-using-html-css.html">How to Create a Responsive Profile Card</a> and now it's time to create pricing tables.

Simply, pricing tables are the flat card designs of a particular product with products of different value and offer for the buyers. Pricing table can be a various product like mobile phones, television, hosting, and others. Basically, it is use maximum in the e-commerce website.

As you can see on the given image of this design [Responsive Pricing Tables], on the webpage. There are three cards of the price list with different colors, offers, and prices. Actually, this is the pricing table of the hosting. In detail in the top cards, there is the price of this product, the bottom of the price some major information for each value, the bottom of the information there are all offers which is given to users in different price segments. These all cards are responsive and also I have added some hover effects on the button.

<H3>You Might Like This:</H3>
<a href="https://www.codinglabweb.com/2020/12/3d-flip-card-on-hover-using-only-html.html">3d Flip Card using HTML and CSS</a>

You can download all source code files from the given link. <a href="https://www.codinglabweb.com/2020/12/responsive-pricing-table-using-html-css.html">Click Here to download all source code files.</a>
Merry Christmas Everyone 
Published: 2020-12-25 14:56:12

---
title: Merry Christmas Everyone 
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

# Merry Christmas Everyone!

Hope you all have an amazing time. Making the most of what you can, in this strange year! 

*What's your best/favourite Christmas Gif!*
I'll start 
![Merry Christmas](https://dev-to-uploads.s3.amazonaws.com/i/sk8bvxoqwmg2hh0fz6x1.gif)
Question on Logical Address & Physical Address | Operating System - M05 P11
Tags: linux, devops, beginners, tutorial
Published: 2020-12-25 14:52:35

**This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the fifth module which consists of 26 articles.**

_In this article we will see a question on logical address and physical address space, to understand the concept of paging in operating system._

***Question:*** Consider a system which has LA = 7 bits, PA = 6 bits, page size = 8 words, then calculate number of pages and number of frames.

***Answer:*** Total bits of LA = 7 bits, which means it is equal to 2<sup>7</sup>

The page size = 8 words which means 2<sup>3</sup> so we can say it is of 3 bits

Therefore, Page No. = 4 which we can say is 2<sup>4</sup> and then total number of pages = 2<sup>4</sup> = 16

While total number of bits required to respond total number of page = 4 bits.

PA = 6 bits, total size of PA = 2<sup>6</sup> = 64

Now, we know that `frame offset = Page offset`

Number of frames = 2<sup>3</sup> = 8

`Total number of entries in page table = number of pages`

`Total number of entries = 16`

`Total size of page table = 24 x 8`

_So, this was a simple question on logical address and physical address space. Hope you liked it and learned something new from it._

If you have a doubt, question, quires related to this article or just want to share something with me, than please feel free to contact me. 

### 📱 Contact Me

[Twitter](https://twitter.com/r_mishra10)
[LinkedIn](https://www.linkedin.com/in/rahul-mishra-66210b185)
[Telegram](https://t.me/rahul_mishra10)
[Instagram](https://www.instagram.com/rahul_mishra10/?hl=en)

### 📧 Write a mail
<rahulmishra102000@gmail.com>

#### 🚀 Other links

[GitHub](https://github.com/rahulMishra05)
[HackerRank](https://www.hackerrank.com/rahulmishra10201)