teleren/devto huggingface dataset:
Easily Manage Dot Files (Config Files)
Tags: configmanagement, configs, dotfiles, dotfilesmanagement
Published: 2021-04-13 02:27:22

---
title: Easily Manage Dot Files (Config Files)
published: true
description: 
tags: configManagement, configs, dotfiles, dotfilesManagement
//cover_image: https://direct_url_to_image.jpg
---

Whenever I migrated from an old laptop to a new laptop or re-installed the whole OS, I always ended up copying all the config files(Ide configuration, bash history, app profiles, etc) in a hard disk.

I either ended up copying all unnecessary configs(by zipping all) from the home folder or if I pick particular configs, I keep on missing things.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68e5ru668x7zolg7sqzs.png)
 

Even if I manage to zip all those things, storing them was another big challenge for me. Storing data comes with a cost as one would need to preserve it by storing locally or in any cloud. Updating the configs is even harder as I have to manually repeat all these steps.

So I started using Git to track my config files, so I created a Private Repo where I could push my all config files.

At first, I created a bash script with the name `sync. sh` inside directory dotfiles

`sync.sh`

```
#
#!/bin/bash
declare -a filesToSync=(".bashrc" ".bash_history" ".zshrc" ".zsh_history" ".gitignore_global" ".gitconfig")
## now loop through the above array
for i in "${filesToSync[@]}"
do
   cp ~/$i ~/dotfiles/$i
   # or do whatever with individual element of the array
done
declare -a foldersToSync=(".config/Terminator",".config/JetBrains") 
## now loop through the above array
for i in "${foldersToSync[@]}"
do
  cp -r ~/$i ~/dotfiles
   ## or do whatever with individual element of the array
done
```

So after running bash `sync.sh` the script would copy all my local config files and folders into the directory into the folder dotfiles.

Now all I need to do is run `git add . git commit -m “message” git push -u origin master` these commands to push to my Git Repository.

Then I again wanted to automate the above manual process on a weekly basis, so I created a file inside the same dotfiles directory with the name

`cronscript.sh`

```
#
#!/bin/bash
cd ~/dotfiles
bash syncfile.sh
git add .
git commit -m “weekly changes”
git push -u origin master -f 
```

Finally, I created a weekly Cron job with `crontab -e`

`0 0 * * 0 bash /home/ujwal/dotfiles/cronscript.sh`

## Conclusion
Every week my config files are getting synced automatically and I don't need to remember at all.

There are other great tools for managing dotfiles that have many more features than the above script like https://github.com/jbernard/dotfiles.
I simply made my own script as I could learn bash scripting side by side too.
Data Types and Mathematical Operations in Python
Tags: python, 100daysofcode, programming, beginners
Published: 2021-04-13 02:20:04

Today we are going to see the following topics in python.
* Data Types
* Type Check
* Type Conversion
* Mathematical Operations

# Data Types

In python, we have 4 types of data we usually refer to them as data types.

### 1. Strings
It is just a string of characters, and when we create it we have to put them in double quotes. example:
```
print("Hello world")
```
We can also get a specific element from a string by passing its index in [], this method is called **subscript**. 
An example is below:

```
name = "John"
print(name[2]) 

# The out will be "h"
```
> Always remember, indexes in python start with 0.

We can also check the length of a string by using len() function. An example is below:
```
name = "john"
print(len(name))

# The output will be "4"
```
> len() only works with strings.

### 2. Integer
Integers are just whole numbers, and we don't need to put them in double quotes.
Example:
```
age = 24
```

### 3. Float
Integers are just decimals numbers, and we don't need to put them in double quotes.
Example:

```
bill = 124.5
```

We can also determine the number of decimals by using the round() function. 

For example, our bill is "99.22425" and we want to display only 2 decimal numbers, we can do that in the following way.

```
bill = 99.22425
print(round(bill, 2))

# The output will be "99.22"
```
> First we have to add the decimal value, and then the number of decimals we want.

### 4. Boolean
It is a simple data type and we define it by **True** and **False**.

It is mostly used to check the authenticity of conditions and logic in code.

# Type Check

We can check the data types by using type() function.

```
print(type("Hello World"))
```

# Type Conversion

We can convert data types of values by using some default python functions.

> We need to convert data type in certain cases. For example, if we want to concatenate the age and name of any person. It won't happen unless both data types are "string", because we can only concatenate strings. For this, we have to change the data type of age from integer to a string.

```
int() function is used to change the data type to integer.
str() function is used to change the data type to string.
float() function is used to change the data type to floating numbers (with decimals).
```

# Mathematical operations

We can mathematical operations in python by using normal math symbols.

* "+" for addition
* "-" for substraction
* "*" for multiplication
* "/" for division
* "**" for exponent (power of any number)

Mathematical operations are work according to "**PEMDAS**" rule. This means they'll perform in the following sequence:

- Parentheses (first)
- Exponents (second)
- Multiplication (third)
- Division (forth)
- Addition (fifth)
- Subtraction (last)


> We can't perform a mathematical operation on strings and booleans.
Unity Dev? Where are you?
Tags: unity3d
Published: 2021-04-13 01:55:51

Where are all the unity developers at? I am a technical recruiter that is looking to help a venture backed VR startup find 2 amazing unity developers to join their team. They are based in NYC but this role can be remote. 

Sr. Unity Developer with at least 5 years experience.

Unity developer for mobile

Backend Engineer as well.

$130k-$160k
Please reach out to me at shannon@tribaja.co
Trying to Keep Comfy  - A React Native 5-Day Trial-by-Fire
Tags: reactnative, 100daysofcode
Published: 2021-04-13 01:53:44

#School is in Session!

To kick off 100 days of code, I chose to dive into learning a new framework- enter React Native.

After having tackled React, RN seemed like a natural stepping stone. As I quickly learned, the similarities between the two were enough to keep me tethered to what I knew about developing React apps while the new components, styling, and dependencies kept me on my toes. 

I really tried to broaden my horizons on this project, soliciting user input via SurveyMonkey and using this data to shape my user stories and what ultimately constituted an acceptable MVP. Keeping my end-users' desired specifications in mind was a rewarding, albeit challenging, requirement during my build process. 

## What's Comfy Classroom?
My repo details the inspiration and approach I chose to pursue for this project. My sister, currently an 8th grade Civics teacher in Chelsea, MA, has told me on numerous occasions that her students' families were hit particularly hard by the COVID-19 pandemic, both in terms of financial hardship and the tragic loss of loved ones. I wanted to develop an application that could assist teachers as their students returned into what was once a familiar and, hopefully, somewhat comfortable environment. 

The top portion of Comfy Classroom's homepage consists of two buttons that render informational modals, respectively displaying app instructions and COVID-19 resources for teachers. Below that, a text input field allows teachers to take notes on their students. Notes can pertain to their students' emotional health (i.e. feeling anxious, upset, excited) COVID-19 status (i.e vaccinated, not vaccinated, had an ill parent), their academic status (i.e. struggling with Spanish, excelling in Math) and lastly, a special field where an educator can quickly denote if a student may need extra help. 

## Comfy Classroom Home Page: 
<img width="300" alt="homepage_loaded" src="https://user-images.githubusercontent.com/63027187/114330955-e513e380-9b10-11eb-89e9-7182077db843.png">

## Student Details:
<img width="300" alt="student_detailed" src="https://user-images.githubusercontent.com/63027187/114330976-f3fa9600-9b10-11eb-9221-f10fa4d91478.png">

## A React Native Retrospective 

While RN wasn't a cakewalk, it was more manageable than I had expected. In my opinion, once you have a grasp on state and component-oriented design via experience with React, I think a degree of RN competency is well within reach. 

I certainly couldn't have pulled this product off as seamlessly without my use of Native Base. I additionally think that setting up my build environment with Expo.io saved me a lot of trouble compared to use of the RN CLI interface.

It wasn't the comfiest project to tackle in five days, but it certainly taught me how to manage delivering a user-centric product on a tight deadline. I haven't sent the end project to my sister and her colleagues yet, but when I do, I'll be sure to publish a follow-up. 

## Want to see more? Check out my repo! 
{% github mgtz505/comfy-classroom %}
Final Ruby on Rails project for Flatiron School
Tags: ruby, rails, sql, codenewbie
Published: 2021-04-13 01:32:23


For my final Ruby on Rails project, I created an app for a small business that deals with building maintenance and small  repairs in NYC. 

##Features

This app can track employees as they complete work orders: 
* You can create work orders for each employee and assign tasks and an address where they will do the repairs.
* Employees can comment and reply in the work order. This is a nice feature in case you want to ask someone for an idea or you want to give a description to your boss of what was done. 
* This app will also track the hours the employee works each day. They will be able to punch-in and punch-out.

* Employees and admins can login and logout.
* Only admin can create an account for an employee. Once an account is created, the employee can login with a username and password or Facebook single-sign on. 

##Lessons learned
 
I built this app for my school project but I'm planning to use it in real life. I have to learn more about security and I know it is risky to expose personal information with it. Before, when I used to visit a website like a bank, Home Depot or Facebook, I didn't pay too much attention to the details. Now I know there is a lot of security involve behind these website. I want to get more experience in authenticating and validating to protect the database of my apps.


##Conclusion

It is clear to me that security in a website is everything, because a website that expose the users information is a broken website. I have to learn a lot about how to protect the users information and ruby on rails has a lot of tools for this.
Should we use microservices?
Tags: microservices, devops, monolith, architecture
Published: 2021-04-16 11:21:45

---
title: Should we use microservices?
published: true
date: 2021-04-13 00:00:00 UTC
tags: microservices,devops,monolith,architecture
canonical_url: https://jhall.io/archive/2021/04/13/should-we-use-microservices/
---

 **Microservices vs Monolith**

It’s an age-old question. Or at least a couple years old.

Microservice architectures are certainly _popular_. But are they better than monolithic architectures? Which direction should you go if you’re embracing DevOps?

The truth is…

**it doesn’t really matter!**

Both approaches have certain benefits, and both have certain drawbacks. And for a large majority of applications out there, those benefits and drawbacks exactly cancel each other out. That’s because, at a basic level, the difference between the two is a question of _where do you want to manage your dependencies_?

Generally speaking, the dependencies are the same. They’re just handled at a different part of the software delivery life cycle.

So unless you’re building an application where one architecture pattern provides _clear_ and _immediate_ benefits, choose whichever pattern you and your team are most comfortable with (which probably means a monolith for most teams these days). Besides, a well-designed monolith can fairly easily have microservices split off of it as business requirements change.

* * *
If you enjoyed this message, [subscribe](https://jhall.io/daily) to _The Daily Commit_ to get future messages to your inbox.
How to remove a directory asynchronously using Node.js?
Tags: node
Published: 2021-04-13 00:00:00

---
  title: How to remove a directory asynchronously using Node.js?
  published: true
  tags: Nodejs
  date: Tue Apr 13 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/remove-directory-asynchronously-using-nodejs
  cover_image: https://melvingeorge.me/_next/static/images/main-af3d5296b1f259745b6cb5772d3bbcbd.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/remove-directory-asynchronously-using-nodejs)
  
To remove a directory or a folder, we can use the `rmdir()` method from the `fs` (filesystem) module Node.js. This will asynchronously remove the directory.

```js
// Remove directory asynchronously
fs.rmdir("./FilesDirectory", { recursive: true }, () => {
  console.log("Successfully deleted directory!");
});
```

For exampe let's consider a directory called `FilesDirectory` like this,

```js
// require fs module
const fs = require("fs");

// path
const path = "./FilesDirectory";
```

Now let's use the `fs.rmdir()` function and

- pass the path as the first argument
- optional `options` object with a property of `recursive` set to boolean `true` as the second argument. This is done so that any files or directories inside the directory are also deleted. If you don't want a directory with files not to be deleted, you can remove the `options` object completely.
- and an error first callback function as the third argument

to the function like this,

```js
// require fs module
const fs = require("fs");

// path
const path = "./FilesDirectory";

// remove directory by passing path
// as the first argument to the function
fs.rmdir(path, { recursive: true }, (error) => {
  // if any error
  if (error) {
    console.error(error);
    return;
  }

  console.log("Successfully deleted directory!");
});
```

See this example live in [repl.it](https://replit.com/@melvin2016/remove-directory-using-nodejs#index.js).

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

---
Ansible
Published: 2021-06-18 03:14:26

---
title: Ansible
published: true
date: 2021-04-13 00:00:00 UTC
tags: 
canonical_url: https://www.lifewaza.com/posts/ansible/
---

I’ve been playing with ansible off and on for several years now, usually in fits and starts. Ansible is a tool for managing computers. It lets you do things like setup a new web server in _exactly_ the same way you setup your old web server, or make sure that your new laptop has all the software you routinely use installed, or configure a cluster of computers identically regardless of their underlying operating system, package manager, or authentication system.

In short, it’s a super powerful tool for automating everything about all your computers.

Every time I manually provision a new server I tell myself, “this time I’m going to use ansible”, and every time I start I end up getting frustrated that it’s so hard to get started using ansible and I just provision the sever manually, again. Finally, I found a course on pluralsight (thanks $EMPLOYER) that walks you through setting up ansible to manage just your local machine. This was the guide I needed. It gave simple instructions that clearly told you how to get ansible working for just this one machine, from there it was pretty easy to apply the same learnings to several machines and I’m now happy to say that I’m using ansible to manage:

- my work laptop
- my personal laptop
- my home router/firewall

This means that if I ever need to replace my router, I can just run the router playbook that I’ve created on the new machine and my router will be provisioned exactly the same way as my current router. It also means that if one of my laptops kicks the bucket, I can be up and running again on a new machine quickly. I won’t need to remember all the stuff I usually have to install, I won’t need to remember the special way I have to configure my local smtp server to relay outgoing mail to my real smtp server. I won’t have to spend time trying to get my firewall rules just right. As long as I keep only using ansible to manage these machines, I’ll have no snowflakes!

It also means that I can reuse the work I’ve done to get these machines setup to get my other machines setup as well. The ones that are left to do are:

- smtpd server
- httpd server
- minecraft server
- vpn server

Each of those has their own unique tweaks that I’ll have to port to ansible before I can fully use it to provision them, but there will also be a fair amount of overlap from the work I’ve already done.

If you have a pluralsight license, I can happily recommend this course: [Getting started with ansible](https://www.pluralsight.com/courses/getting-started-ansible) and if you don’t [here’s a blog post](https://blog.laurentcharignon.com/post/laptop-setup-with-ansible/) that takes a similar approach (i.e. managing your personal laptop with ansible). Finally, [the ansible docs](https://docs.ansible.com/ansible-core/2.10/user_guide/index.html) are a useful if daunting resource.
Quick and dirty carousel
Tags: webdev, javascript
Published: 2021-04-13 15:52:10

---
title: Quick and dirty carousel
published: true
date: 2021-04-13 00:00:00 UTC
tags: webdev, javascript
canonical_url: https://thomasxbanks.com/articles/quick-and-dirty-carousel/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekf924ze502fvjs851a4.jpg
---

One thing I find myself looking up time and time again, is;

> How do I move the first item of an array to the end? 🤔

So, in the spirit of _If I write it down, I'll never forget it_, here's a quick and dirty carousel that does just that.

```javascript

const duration = 5000

const carousel = document.querySelector('[data-carousel]')

const slides = [...carousel.querySelectorAll('[data-slide]')]

const initCarousel = (carousel, slides) => {
  slides.push(slides.splice(0,1)[0])
  carousel.innerHTML = ''
  carousel.insertAdjacentElement('afterbegin', slides[0])
}

setInterval(() => initCarousel(carousel, slides), duration)

```

## Let's break that down&hellip;

First we set the duration, 5000 milliseconds (5 seconds) should be good enough.

```javascript
const duration = 5000
```

Next, identify your elements. Your common or garden carousel consists of a container (`<div data-carousel />` in this case) and some slides (`<article data-slide />` in this case).

```javascript
const carousel = document.querySelector('[data-carousel]')

const slides = [...carousel.querySelectorAll('[data-slide]')]
```

Now, here's where the magic happens!

We have a smol function that moves the first item in the array to the end of the array then replaces the entire `innerHTML` of the container with the first slide in the array.

```javascript
const initCarousel = (carousel, slides) => {
  slides.push(slides.splice(0,1)[0])
  carousel.innerHTML = ''
  carousel.insertAdjacentElement('afterbegin', slides[0])
}
```

Finally, we run the function over and over again, every 5 seconds…
```javascript
setInterval(() => initCarousel(carousel, slides), duration)
```

## Conclusion

And that's it!

OK, sure, it doesn't have any fancy transitions but hopefully I'll remember the magic formula! 🙏

```javascript
arr.push(arr.splice(0,1)[0])
```

<p class="codepen" data-height="265" data-theme-id="dark" data-default-tab="js,result" data-user="thomasxbanks" data-slug-hash="xxgWQoj" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Quick and dirty carousel">
  <span>See the Pen <a href="https://codepen.io/thomasxbanks/pen/xxgWQoj">
  Quick and dirty carousel</a> by thomas×banks (ツ) (<a href="https://codepen.io/thomasxbanks">@thomasxbanks</a>)
  on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://cpwebassets.codepen.io/assets/embed/ei.js"></script>
Microservice vs Monolith 
             Architecture
Published: 2021-04-12 23:38:34

**Mircoservice Architecture**

Microservice architecture (better known as microservices) is an architectural style that gives structure to application as a collection of services. 
 -**Benefits of Microservice**
 - Enables each service to be created and developed independently by a team that is focused on that service.
 - It helps solve the problem of complexity by breaking down application into a much more manageable service. This makes it much faster to create and develop, which makes the application much easier to understand and manage.
 - It heavily reduces the barrier of adopting new technologies. 
 - Microservices also enable each of the services to be scaled independently.

-**Downsides of Microservices**

 - Microservice architecture makes you have to choose and implement an inter-process communication mechanism.
 - Microservice has a partitioned database architecture.
 - It is much more complex in the case of monolithic web application.
 - It is more difficult to implement changes that span multiple services.
 - Microservices is much more complex to deploy.

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

**Monolithic Architecture**

Monolithic applications are designed to handle multiple related tasks. This is the traditional unified model for the design of a software program. It is self-contained, and the components of the program are interconnected and depend on each other rather than loosely coupled.

 -**Benefits of Monolithic Architecture**
 - Simple to develop.
 - Easy to test.
 - Simply to deploy. All you have to do is copy the packages application to a server.
 - Simple to scale horizontally by running multiple copies behind a load balancer. 

-**Downsides of Monolithic Architecture**
 - Has a limitation in size and complexity due to its simple approach.
 - This application is far too large and complex to fully understand and make changes with ease and efficiently.
 -You have to redeploy the entire application on each update.
 - Slow times for start-up.
 - Continuous deployment is difficult.
 - Can be be difficult to scale when different modules have conflicting resources requirements.
 - A barrier to adopt new technologies.

YouTube Tutorial- https://youtu.be/yJUokLcMiVs 

**Links Used** 
- https://articles.microservices.com/monolithic-vs-microservices-architecture-5c4848858f59
- https://medium.com/startlovingyourself/microservices-vs-monolithic-architecture-c8df91f16bb4
- https://whatis.techtarget.com/definition/monolithic-architecture
- https://microservices.io/

















**