teleren/devto huggingface dataset:
Add SSH Public Key to Vagrant
Tags: ssh, unix, vagrant, vm
Published: 2021-01-18 13:07:34

---
title: Add SSH Public Key to Vagrant
published: true
date: 2020-11-06 00:00:00 UTC
tags: ssh, unix, vagrant, vm
canonical_url: https://tech.serhatteker.com/post/2020-11/add-ssh-public-key-to-vagrant/
---

You can access your *Vagrantbox* via:

```bash
$ vagrant ssh
```

However if you want to access it via usual `ssh` cli, how can you do that?

By default **Vagrant** binds your `localhost`'s `2222` port to your *Vagrantbox*'s `22` port.

So you can access your *box* by;

```bash
$ ssh -p 2222 vagrant@localhost
```

It is same thing as `vagrant ssh`.

But before you can do that you need to add your `ssh pub_key` to your vagrant host.

## ssh-copy-id

The best way to add your *pub_key* is to use `ssh-copy-id` binary/command:

```bash
$ ssh-copy-id -i ~/.ssh/id_rsa.pub -p 2222 vagrant@localhost
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/<username>/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
vagrant@localhost's password:
```

After you prompt your *vagrant* user password, *pub_key* will be appended.

```bash
Number of key(s) added: 1

Now try logging into the machine, with:   "ssh -p '2222' 'vagrant@localhost'" and check to make sure that only the key(s) you wanted were added.
```

> **INFO**
> Default credentials are:
> 
> - user: vagrant
> - password: vagrant


## Other Methods

You can use some manual unix cli magic:

```bash
$ cat ~/.ssh/id_rsa.pub | ssh -i ~/.ssh/id_rsa.pub -p 2222 vagrant@localhost 'cat >> .ssh/authorized_keys && echo "SSH key copied."'
```

Or, you can use **Vagrant**'s *provision*:

```ruby
Vagrant.configure(“2”) do |config|
  config.vm.provision "shell", inline: <<-SHELL
    cat /home/<username>/.ssh/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys
SHELL
end
```

Now you can access your *Vagrantbox* via `ssh` without password:

```bash
$ ssh -i ~/.ssh/id_rsa.pub -p 2222 vagrant@localhost
```


All done!
Check whether folder exists on the path using Node Js
Tags: node, tutorial, webdev, beginners
Published: 2020-11-19 18:18:35

---
title: Check whether folder exists on the path using Node Js
published: true
date: 2020-11-06 00:00:00 UTC
tags: nodejs, tutorial, webdev, beginners
canonical_url: https://jsmates.com/blog/check-folder-exists-on-the-path-using-node-js
---

`fs` module in Node Js has methods to check whether a folder exists in the path. We will use `fs.existsSync` to check whether the folder exists or not.

```js
const fs = require('fs');

// Check folder
const checkFolder = folderPath => {
  // Throw error if folder path doesn't exist
  if (!folderPath) throw Error('folder path is required');

  // Check folder exists in the path using `fs.existsSync`
  const isFolderExist = fs.existsSync(folderPath);
  return isFolderExist;
};

console.log(checkFolder('blog')); // True
console.log(checkFolder('sunrises')); // False
```

This way, you can check whether a folder exists or not in Node Js.

{% codesandbox folder-exists-check-zn3q8 %}
How to add spacing or padding to the beginning of a string in JavaScript?
Tags: javascript
Published: 2020-11-06 00:00:00

---
  title: How to add spacing or padding to the beginning of a string in JavaScript?
  published: true
  tags: JavaScript
  date: Fri Nov 06 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/add-spacing-or-padding-to-beginning-of-string-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-b8bed36a2a3b3626db64847cbb5d28ce.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/add-spacing-or-padding-to-beginning-of-string-javascript)
  
To add spacing or padding to the beginning of a string, you can use the `padStart()` string method in JavaScript.

Consider this string,

```js
// a string
const str = "Hello";
```

Let's add 5 spaces to the beginning of the string using the `padStart()` string method like this,

```js
// a string
const str = "Hello";

// add 5 spaces to the beginning
// of string using padStart() method
const paddedStr = str.padStart(10);

console.log(paddedStr); // "     Hello"
```

Now you might think why did we use `10` instead of `5`. Because the `padStart()` method starts counting characters from the start of the string. Since we already had `5` letters and passing `5` won't do the trick.

```js
// a string
const str = "Hello";

// ❌ passing 5 won't make 5 spaces we have
// to accomodate for the whole string
const paddedStr = str.padStart(5);

// 😕 Not what we expected
console.log(paddedStr); // "Hello"
```

But if you don't want to hardcode like this, there's another way to automatically pad `5` spaces to the beginning of the string.

It can be done using the `length` property of the string. First, get the length of the string then add 5 spaces like this,

```js
// a string
const str = "Hello";

// add 5 spaces to the beginning
// of string using padStart() method
const paddedStr = str.padStart(str.length + 5);

console.log(paddedStr); // "     Hello"
```

Nifty Trick 🔥. Right?

You can also choose to have any string instead of spaces by passing the string as the second argument to the `padStart()` method like this.

```js
// a string
const str = "Hello";

// add 5 spaces to the beginning
// of string using padStart() method
const paddedStr = str.padStart(str.length + 5, "*");

console.log(paddedStr); // "*****Hello"
```

See this example live in [JSBin](https://jsbin.com/xarokikemo/edit?js,console).

Key things to take away using the `padStart()` string method:

- It requires the absolute number of spaces or padding to be added to the beginning of the string as the first argument.
- You can have an optional string to be used instead of spaces if provided as the second argument to the `padStart()` string method.
- the method returns a new string

### Feel free to share if you found this useful 😃.

---
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2020-11-05 23:53:19

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

@indoor_keith has some really valuable thoughts on [finishing projects](https://dev.to/codybrewer/how-do-you-finish-your-projects-lc7)
{% devcomment 17dk7 %}

This is a win worth celebrating, @jmau111. A11yship has to start somewhere — and this is a great spot to do just that! 
{% devcomment 17dbg %}

Welcome to DEV, @kichi! Sounds like you're making great progress in your coding journey. 
{% devcomment 17i18 %}

Great job with Hacktoberfest, @dawntraoz! So glad you found the celebration motivating and useful.
{% devcomment 17g2i %}

Thanks for the tip on [where to find illustrations](https://dev.to/madza/where-do-you-get-your-illustrations-2lfe), @joeczubiak 👀  
{% devcomment 17fpn %}

See you next week for more great comments ✌
This repository on ML operations has free talks, books, papers and more
Tags: mlops, programming, mmachinelearning, ai
Published: 2020-11-05 22:46:48

This repository on ML operations has free talks, books, papers and more: https://thepythoncoding.blogspot.com/2020/11/memory-life-cycle-heap-stack-and-call.html


#MLOps #Python #programming #100DaysOfCode #MachineLearning  #100DaysOfMLCode #![ElhLi8iWkAAK-TF](https://dev-to-uploads.s3.amazonaws.com/i/irswt27i7y7cnpao8qtt.png)
 #javascript #womenwhocode #RStats #CodeNewbie #DataScience #DEVCommunity
The Rules of fast learning you can grasp from Musk
Tags: leadership, webdev, learn
Published: 2020-11-05 22:45:35

Elon Musk is a philanthropist and an example of pure genius (That's no secret why ? ) <br />
He mastered the skills of fast learning. As an entrepreneur, he views problems in a different way than any other entrepreneur.  <br>
Here we will talk about 2 rules that he uses to learn faster. 🤘
<hr>
Do you want development news right on your default chrome or firefox page? Then get the amazing  [daily.dev](https://api.daily.dev/get?r=rahxul) extension. There are only PROS of getting this extension no CONS. 
<hr>
# First Rule

### Have A Strong Foundation

Musk is a master of understanding what is at the core of each of the sectors his entrepreneurial ventures sit it. 
> In other words -> Before learning the in-depth stuff, he makes sure to learn the basics right 

**The Same Goes For Us**

- Learning half Javascript and then skipping to react will not get you anything it will just waste your time and you'll be left with nothing.  
- So, Basics first (HTML, CSS AND JS) then moving to frameworks(React, Angular etc). 

# Second Rule

### Connect Stuff

> "You can't remember what you can't connect" - <br> Elon Musk

Musk never learns a piece of information at random. Everything he intakes, he connects back to some deeper, more solid base. 
Musk plants trees every day, which turn into the woods of knowledge. 

-> You can do the same by implementing his two rules that are worth and free. 
<br />
<hr> 
This short post is for you for fast and effective learning. If you find this useful comment, react and follow. 
<hr>
Thanks.
Day 250: Closer
Tags: hiphop, code, coding, lifelongdev
Published: 2020-11-05 22:45:28

_liner notes_:
- Professional : Today was the first day of VueConf Toronto 2020. Got to listen to a bunch of really interesting talks. And in between, spoke with some folks at our virtual table. Great day. I could only imagine how cool it would be if I got to go in-person. While the talks were happening, I worked on some documentation. Pretty productive day.

- Personal : Last night, I edited the recording of the show and submitted it to the station. I also went through a few tracks. Got the preliminary design for the front page of my new project worked out, I think. I'm sure it will change, but it's a start.

![Looking out into the ocean at Marine Street Beach, CA, USA at sunset with 5 seagulls flying across.](https://dev-to-uploads.s3.amazonaws.com/i/mzimjjbahm7u1nb17sy4.jpg)

The election is STILL going on! haha I want every vote counted, but why was the race even this close?! haha For me, it just illustrates how much closer the 2 major party candidates are getting. haha Going to do a demo of my side project with an event organizer. Hopefully we can get a real event to test it out! When I was preparing for the demo, I found out that I forgot to add a chat section to a page, haha. Good thing I separated it out as it's own component, so all I had to do was copy and paste it into the page and it worked! After the demo, I'll probably work on the radio show for this week and probably redefine the design for the new project.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Tb9fkGCCV1o %}
Password Hashing with bcrypt (easiest explanation) 
Tags: bigdata, javascript, react, tensorflow
Published: 2020-11-05 22:38:35

Password Hashing with bcrypt (easiest explanation) 
https://thepythoncoding.blogspot.com/2020/11/password-hashing-with-bcrypt-easiest.html
#AI, #Analytics, #BigData, #CloudComputing, #DataScience, #DataScientist, #IoT, #Java, #JavaScript, #Linux, #MachineLearning, #Programming, #Python, #ReactJS, #RStats, #Serverless, #TensorFlow
Convert .flac to .mp3 with ffmpeg
Tags: linux, ffmpeg, audio
Published: 2020-11-05 22:36:47

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5d23bug0rkvwnoxr8tk6.jpg)
```bash
ffmpeg -i input.flac -ab 320k -map_metadata 0 -id3v2_version 3 output.mp3
```
Talk Me Off the Ledge - I Want to Write Another Book
Tags: help, discuss, projects
Published: 2020-11-05 22:24:49

---
title: Talk Me Off the Ledge - I Want to Write Another Book
published: true
description: 
tags: help, discuss, projects
//cover_image: https://direct_url_to_image.jpg
---

Ever meet someone who has a tattoo and is satisfied with just that one?

Me either. Only writing books is feeling like that.

So a while ago I took a writing class because I was tired of feeling like I should update my blog more. By the end I decided that I should write a book. I signed up for NaNoWriMo and published my [first book](https://amzn.com/B08462H4KW) last February.

I've been thinking about writing another book. Though smaller this time. More like a booklet.

I'm thinking of doing either more dev career ones, or more about the stuff I do as a consultant in software orgs.

Tell me to stop, tell me what you'd read, HALP.
coding challenge websites Down pointing backhand index

Tags: javascript, react, python
Published: 2020-11-05 22:23:39

coding challenge websites Down pointing backhand index
-Codewars
-Hackerrank
-Projecteuler
-Top coder
-Coderbyte
-Codechef
-Leetcode
Do you know any other?
 #CodeNewbie #javascript #NodeJS #reactjs #Python #technology #DataScience #AI 
https://thepythoncoding.blogspot.com
Creating awesome carousels with SWIPER JS
Tags: webdev, javascript
Published: 2020-11-05 21:58:18

Creating carousels for a website can be a complicated and stressful process. Well, this  problem can be solved using [SWIPER JS](https://swiperjs.com/)
Swiper is a cool and easy to use JavaScript Library.
 It is a modern touch slider which is focused only on modern apps and web platforms to bring the best experience and simplicity. The documentation is very easy to understand.


### Steps in creating a carousel with Swiper JS
- Getting Started

**Using CDN**
```
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css">
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">

```

```
<script src="https://unpkg.com/swiper/swiper-bundle.js"></script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

```

**Using NPM**


```
from the terminal
$ npm install swiper

```
- HTML Layout

```
<!-- Slider main container -->
<div class="swiper-container">
    <!-- Additional required wrapper -->
    <div class="swiper-wrapper">
        <!-- Slides -->
        <div class="swiper-slide">Slide 1</div>
        <div class="swiper-slide">Slide 2</div>
        <div class="swiper-slide">Slide 3</div>
        ...
    </div>
    <!-- If we need pagination -->
    <div class="swiper-pagination"></div>

    <!-- If we need navigation buttons -->
    <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>

    <!-- If we need scrollbar -->
    <div class="swiper-scrollbar"></div>
</div>

```

- Intialize Swiper Js

new Swiper(swiperContainer, parameters)

```
var mySwiper = new Swiper('.swiper-container', {
    speed: 400,
    spaceBetween: 100
});

```

### Here are some demos of carousel

- Simple 


{% codepen https://codepen.io/coded_fae/pen/MWeVYKv %}


- Pagination

{% codepen https://codepen.io/coded_fae/pen/rNLKvgY %}

- Scrollbar

{% codepen https://codepen.io/coded_fae/pen/PozaaGP %}


- Vertical Slider

{% codepen https://codepen.io/coded_fae/pen/LYZrrxa %}

- Fade Effect

{% codepen https://codepen.io/coded_fae/pen/GRqGGQo %}

- 3D Cube Effect

{% codepen https://codepen.io/coded_fae/pen/eYzKwxY %}


- 3D Coverflow Effect

{% codepen https://codepen.io/coded_fae/pen/ExyRqdw %}

- 3D Flip Effect

{% codepen https://codepen.io/coded_fae/pen/RwRBbLw %}

- Thumbs Gallery

{% codepen https://codepen.io/coded_fae/pen/XWKBrPx %}

 - Lazy Loading


{% codepen https://codepen.io/coded_fae/pen/MWeBjBe %}


For more Demos,  check [HERE](https://swiperjs.com/demos/)

### Credits
- [Swiper JS](https://swiperjs.com/)

- [Images from Canva](https://www.canva.com/)

- [Here is the GitHub Repository for the article](https://github.com/Abiola-Farounbi/Creating-Carousels-with-SwiperJs)

If you have any other questions you can send me a message on [Twitter](https://twitter.com/abiolaesther_?s=08)

*Thanks 😊*
[Atomic Dev Tips] Be a Problem Solver
Published: 2020-11-05 21:51:39

**Atomic Dev Tips is an ongoing series of short, actionable, high-leverage posts on how to be the best developer you can be.**

This is the first in that series of posts. Follow me here on Dev or on your social media platform of choice if you'd like to keep up with the series and any other content I create.

One of the most valuable things I've learned in my 6 years as a developer is the importance of viewing your primary role as being a problem solver.

You should not think of yourself as a developer, coder, or engineer. You should think of yourself first as someone who solves problems for people.

Code is just the tool you use to accomplish that goal.

This idea will bleed out into everything you do if you can make it a foundational part of your identity.

Instead of wondering what sample projects to build for your portfolio, start noticing annoyances in your own life and the lives of others.

When assigned a new project at work, you can have valuable input and feedback into the development cycle if you look at your role as a problem solver, not just someone who codes up someone else's solutions.

Cultivate the skill of being able to identify these problems and flesh out software-based solutions to them.

This problem-solving mentality is a major factor in success not only as a developer but in any career you choose, whether working for someone else or yourself.

This is one of the main principles at work in my workshop, [Create & Connect](https://kenrogers.co/cc), teaching aspiring developers how to land their first jobs.

Cultivating this mentality is how you can set yourself apart from other people who are just developing without understanding the underlying reasons behind why they are building things.

So, starting today, take note of the problems you see in your life. Keep an ongoing idea notebook, digital or analog, doesn't matter, and start writing them down.
Twitch Recap: POI Details Part 2 + Search Autocomplete!
Tags: techtalks, wecoded, html, codenewbie
Published: 2020-11-05 21:45:34

This week, my fellow Dev Advocate, Jose, and I created a great example project on mapping businesses and displaying place information. Check out our [recap here](https://www.twitch.tv/videos/793072859), on our Twitch channel-- we stream every other week, and answer your questions on all things coding and maps, live! 

In one of our past Devisodes, we built an example with a clear UI to fetch and display POI information from our map. It looks like this!

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

As you can see from the sidebar, we show how to take information businesses provide to data sources, such as phone numbers, website links, photos and reviews, and display them in a readable format. While our example doesn't look fancy, it's made to show a start into making a UI after learning more basics about using the the Maps APIs.

In this episode, focused on adding Search Autocomplete. This means that when a user types in the search bar, two key things happen.

1. Results are narrowed to a radius within the map window (assumingly, the user's location).

2. The results shown are taken from the best-match business names and categories in the immediate area.

This allows us to add even more precise results to our project. See it in action here!

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

Lastly, we wrapped up by adding a colored perimeter to the search result we select as a user, providing some visual feedback on the map confirming our choice of POI. We ended the episode looking up Nando's in London, because why not.

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

This is a great example project for someone wanting to create a web-based map project which allows users to search for places around them -- to find the perfect salon, restaurant, shop, and so on!

Be sure to follow us at [twitch.tv/tomtomdevs](twitch.tv/tomtomdevs), and tune into our upcoming Devisodes for the rest of 2020!

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

Happy Mapping!
[Video] How to install the latest stable MariaDB version on CentOS 8
Tags: sql, linux, cloud, devops
Published: 2020-11-05 21:41:16

This video shows you how to install the latest MariaDB available on CentOS!

{% youtube mmE4_X_xo1k %}

Useful links:

* Affiliate link for $100 free credit for DigitalOcean so you could spin up your own servers:

https://m.do.co/c/2a9bba940f39

* Blog post going through all of the steps from the video:
https://www.digitalocean.com/community/questions/how-to-install-the-latest-stable-mariadb-version-on-centos-8

* More information on MariaDB and CentOS:
https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-centos-8
need help
Tags: help, python, django, javascript
Published: 2020-11-05 21:37:31

If you are here to help then this is the deal!!! 
We are looking for software developper who are interested to develop an opensource software in the field of GIS.
This software should containing the most important tools integrated in esri product as well as Qgis.

If you are intersted, don't hesitate to comment 
https://thepythoncoding.blogspot.com/2020/11/memory-life-cycle-heap-stack-and-call.html
https://thepythoncoding.blogspot.com/2020/11/react-redux-in-typescript-complete.html