teleren/devto huggingface dataset:
Jekyll: Creating a blog is easy and FREE
Tags: jekyll, blog
Published: 2022-03-28 06:56:38

So, i've chosen to start blogging my experiences/insights/thoughts as a developer. Both to learn and to share knowledge.

Trying to find the right platform to start a blog was my biggest challenge.

Google didn't make in much easier, i have a feeling their algorithm favorites something called **WORDPRESS**. So i tested it out.

Making it through the first configuration, then the second configuration, then they wanted me to pay them for a domain name i already have.

At last i made it through to the end, and i was left with was a revamped version of Joomla.

Using Wordpress, there is almost no challenge, and you end up paying for something in end anyway, something i'm *_not_* interested in.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qqo9frzrkcot6ymx6wc4.gif)

I wanted the right platform, for a simple programming blog and portfolio for my future projects.

This was until i stumbled into the best place on the internet; *Reddit*, and found a post about **Jekyll**.

*For those who does not know what Jekyll is:*

>*Jekyll is a simple, blog-aware, static site generator for personal, project, or organization sites. Written in Ruby by Tom Preston-Werner, GitHub's co-founder, it is distributed under the open source MIT license*

This lightweight, easy to use, multilingual system is a perfect substitution for platforms similar to Wordpress.

### And do you know whats even better!?

Using Jekyll you can get *FREE* hosting through Github!
=======================================================
Formatting an external drive and Implementing Automatic Backup
Tags: tutorial, linux, devjournal, bash
Published: 2022-03-28 06:49:10

## Introduction

Hello! Today I decided to finally start backing up my files to a remote external drive, just in case something went wrong and it's important to periodically backup your data.  😀

The OS I'm currently using is Arch Linux but it should work on almost any flavor of Linux.

---

## Formatting the external drive

Before we can format the device we need to actually locate it.

```bash
sudo fdisk -l
```

This command will list all the devices that are connected to your machine and they will all be located under /dev (dev being short for device). The location should be noted as it will be used in the next commands. (in my case /dev/sda).

Next we need to make sure the device is not mounted before any formatting takes places, this can be done via:

```bash
sudo umount /dev/sda
```

The device may not have been mounted but it's best to make sure.
Now we can safe-fully format the device, giving the option ext4 as I'm using Linux.

```bash
sudo mkfs -t ext4 /dev/sda
```

You can check to see if it's been formatted correctly via:

```bash
lsblk -f
```

Finally we need to mount the backup device by creating a mount point and then mounting the device to that location.

```bash
sudo mkdir /mnt/backup
sudo mount /dev/sda /mnt/backup
```

---

## Creating the backup script

```bash
#!/bin/bash
# Script to backup directories to external disk

backup_files="/home /etc /root /boot /opt"
backup_location="/mnt/backup"

# Create the filename
day=$(date +%A)
file_name="backup-$day.tgz"

tar -Pczf $backup_location/$file_name $backup_files
```

What this script basically does is backup a number of directories to an external device (the one that was mounted in the previous step).

Finally make it executable. 😎

```bash
chmod +x backup.sh
```

The script can also be found below:

https://gist.github.com/ethand91/d164602f1c298178cfb2b51894045a61

Feel free to add any other directories etc that you want to backup. 😉

---

## Automating the backup process

Backups should be taken periodically, crontab can be used to make sure the script is run daily.

Make sure cron is installed on the system, after which you just need to add the task.
Caution: if you already use cron make sure not to mistake -e with -r. (I learned the hard way) 🥲 

```bash
sudo crontab -e

# Add the following one liner
0 13 * * * bash /root/backup.sh
```

Here I set it up so that the script runs daily at 13:00, which is my lunch break. 🤓

Feel free to change the backup time/script location.

---

Like me work? I post about a variety of topics, if you would like to see more please like and follow me.
Also I love coffee. 

[![“Buy Me A Coffee”](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/ethand9999)
JavaScript 3D project
Tags: javascript, showdev, webdev
Published: 2022-03-28 06:42:15

Hello! Thank you for making my dev.to experience extremely positive. Today, I would really like to show you one of my recent JavaScript projects.

Here is just a preview of the project:
![THREE.JS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ndjjzin3ly20g4wc10r.png)

You might be able to tell that the project is made with THREE.JS, if so, then you're right! The moon is a photo mapped, and those bumps you see is a normal map.

You can generate a normal map online with a free normal map generator, and you can import a normal map to an object as following:

`  const material = new THREE.MeshStandardMaterial({ normalMap: normalTexture });` 

I'm just a THREE.JS beginner, if you're more experienced, please leave some tips down below. :) I promise I will read every single comment, and follow everyone that follows me! :)

As usual, stay safe, and keep coding with enthusiasm!
Graph Algorithm - Cycle Detection in Undirected Graph using DFS
Tags: beginners, programming, tutorial, productivity
Published: 2022-03-28 06:34:26

## What is a cycle

In graph theory, a path that starts from a given node and ends on the same node is a cycle.
Cycle Detection in an Undirected Graph
A graph is said to be undirected if it is bidirectional. It is a set of vertices and edges connected where edges are bidirectional.
The cycle in a graph can be detected using graph traversal algorithms.
Let us discuss the cycle detection using Depth-First Search Algorithm.

## DFS Algorithm for Cycle Detection in an Undirected Graph

📌 Initialise a visited boolean array with all nodes unvisited.
Below is a disconnected graph of nodes from 0 to 9 with a , visited array initialised.


![DFS Code start](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6716tabk8fpqv9cvfhgr.png)


📌 Run a loop from 0 to 9 and start our DFS recursive function when the node is not visited passing the current node, -1 where -1 is the previous node initially.
📌 Inside the recursive function - dfs(graph, node, previousNode)
📎 Mark the node as visited.
📎 Traverse through the children of the current node.
📎 If the child is not visited, call the recursive dfs function passing the child and the current node. The current node will be the previous node of the child node.
📎 If the child is visited and the previous node = child node, our dfs function returns false, denoting no cycle is detected.
📎 If the child is visited and the previous node != child node, this means we reached our child through some other path which will result in a cycle. Our dfs function returns true which denotes the function has detected a cycle.
📌 If we continue with our algorithm and the recursive function returns false at the very end, we haven't detected any cycle throughout the graph, or else we have detected a cycle in the graph.


![DFS Recursion flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z6pztf4t2s206a2r9j2q.gif)


## Time and Space Complexity

* We are traversing through all the nodes and edges. So time complexity will be O(V + E) where V = vertices or node, E = edges.

* We use a visited array, queue, and an adjacency list for the graph. So the space complexity will be O(V) + O(V + E) + extra space for the recursion stack.

## Code

![Java Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfcm2hrhgblxm8hrv7bp.png)

Originally Published on : [LinkedIn Newsletter](https://www.linkedin.com/newsletters/graph-algorithm-6905161199672025088/)

## Practice Problem

[Cycle Detection in undirected graph](https://practice.geeksforgeeks.org/problems/detect-cycle-in-an-undirected-graph/1)

## Github Link

{% github https://github.com/Rohithv07/LeetCodeTopInterviewQuestions %}
CSS art sucks
Tags: css, art
Published: 2022-03-28 06:33:00

CSS "art" has a very distinguish pro vs. anti vibe going on, and I'm never really sure why.

First, let's dive into what CSS art is or what it means to me.

CSS Art is a creative outlet of using CSS to style elements on a page to look appealing visually.

Some people use it to recreate existing designs, artworks, or figures and some people go from an empty canvas.

The result is always some stunning magical piece of art that is powered by CSS.

## It's useless

The most common thing you'll hear is people saying, but it's useless. It has no purpose and even can be seen as a waste of time.

I'm always blown away by these remarks.

So are you saying art, in general, is useless?
What's the purpose of a painting?

What's the purpose of a sculpture?
Or a bit more relevant these days, what's the purpose of an NFT?

I'll leave it up to you to decide, though.

## Why I do CSS art

I'm not sure if my ones contemplate "art", but let's state it is.

For me, it's a super lovely outlet to try unique and not often used CSS techniques.

By making CSS art, my general CSS knowledge improves and becomes better.

For instance, creating this artwork taught me about double border-radius and how it works.

{% codepen https://codepen.io/rebelchris/pen/rNOWbbK %}

Or another one I did helped me understand the frosted effect.

{% codepen https://codepen.io/rebelchris/pen/WNGpVEZ %}

These are often elements I can use in my day-to-day CSS work but in a more obvious way.

## How to get started?

I think this is one of the most asked questions, and it depends on what you are looking for.

For instance, if you'd like to get into pixel art, the process might be different.

I believe in creating to grow, and I find this the way that works for me.

Meaning, start by doing and exploring.

When I created the Totoro above, I started with an image and overlayed my CSS on this.
Then when I got stuck, I asked Twitter for help, which helped me improve the piece.

So my best advice is to start with an image and overlay the image with divs and start working from there.

And as always, start small, take small steps, and work your way up to more significant pieces.

Another great way can be to indulge in CSS art challenges, you can find their pop-up more and more, and they are a great starting point for your first CSS artwork.

## Learn from others

When trying to get into CSS art, keep a closeout for other people.

They might have techniques you haven't seen before and can help you become better at them.

And like always you can learn from each other, they might find certain aspects of your works fascinating and the other way around.

With this said, share some of the works you are super proud of!
Love to see them on Twitter 💖

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Generated Bitcoin Address and Private key (hdwallet)
Tags: python, bitcoin, hdwallet, privatekey
Published: 2022-03-28 06:29:22

## Bitcoin HDWallet Generator (Privatekey + address)
Bitcoin wallet creat and check private key and address , with total transaction (use HDWallet)

[View Full Source Here](https://mmdrza.com/generated-bitcoin-address-and-private-key-hdwallet/)
----

![Bitcoin HDWallet Generator (Privatekey + address)](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/btchdall.jpg)
----

- genereted bitcoin wallet private key and address

- genereted from random private key (hexer)

- check wallet details and all transaction without apikey 

- save wallet > 0 on text file

- easy install windows and linux (00INSTALL.cmd and 00INSTALL.sh)

----
for install package on windows `./00INSTALL.cmd` or this:

```
pip install colorama
pip install hdwallet
pip install lxml
pip install requests

```

for install package on Linux `./00INSTALL.sh` or this:

```
pip install colorama
pip install hdwallet
pip install lxml
pip install requests

```
can use easy running with loop:
use `btcHDall.cmd (btcHDall.py)` For Genereted and  Checked 4 type Address All in One (p2pkh + p2sh + p2wpkh + p2wsh)
```
./btcHDall.cmd
./p2pkh.cmd
./p2sh.cmd
./p2wpkh.cmd
./p2wsh.cmd
```
Linux:

```
sh btcHDall.sh
sh p2pkh.sh
sh p2sh.sh
sh p2wpkh.sh
sh p2wsh.sh

```
----

Genereted p2pkh address use p2pkh.py or `p2pkh.cmd` or `p2pkh.sh` [p2pkh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2pkh.py) 

![bitcoin p2pkh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p2pkh.jpg)
----

Genereted p2wpkh address use p2wpkh.py or `p2wpkh.cmd` or `p2wpkh.sh` [p2wpkh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2wpkh.py)

![bitcoin p2wpkh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p2wpkh.jpg)

----

Genereted p2sh address use p2sh.py or `p2sh.cmd` or `p2sh.sh` [p2sh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2sh.py)

![bitcoin p2sh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p3sh.jpg)

----

Generated p2wsh address use p2wsh.py or `p2wsh.cmd` or `p2wsh.sh` [p2wsh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2wsh.py)

![bitcoin p2wsh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p2wsh.jpg)

----
[View Full Source Here](https://mmdrza.com/generated-bitcoin-address-and-private-key-hdwallet/)
```
# ================================================
# DONATE (BTC) : 16p9y6EstGYcnofGNvUJMEGKiAWhAr1uR8
# Website : Mmdrza.Com
# Email : X4@mmdrza.Com
# Dev.to/Mmdrza
# Github.com/Pymmdrza
# ================================================
```
bitcoin wallet generated wait random private key (HDWallet)
Tags: python, bitcoin, privatekey, hdwallet
Published: 2022-03-28 06:27:57

## Bitcoin HDWallet Generator (Privatekey + address)
Bitcoin wallet creat and check private key and address , with total transaction (use HDWallet)

[View Full Source Here](https://mmdrza.com/generated-bitcoin-address-and-private-key-hdwallet/)
----

![Bitcoin HDWallet Generator (Privatekey + address)](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/btchdall.jpg)
----

- genereted bitcoin wallet private key and address

- genereted from random private key (hexer)

- check wallet details and all transaction without apikey 

- save wallet > 0 on text file

- easy install windows and linux (00INSTALL.cmd and 00INSTALL.sh)

----
for install package on windows `./00INSTALL.cmd` or this:

```
pip install colorama
pip install hdwallet
pip install lxml
pip install requests

```

for install package on Linux `./00INSTALL.sh` or this:

```
pip install colorama
pip install hdwallet
pip install lxml
pip install requests

```
can use easy running with loop:
use `btcHDall.cmd (btcHDall.py)` For Genereted and  Checked 4 type Address All in One (p2pkh + p2sh + p2wpkh + p2wsh)
```
./btcHDall.cmd
./p2pkh.cmd
./p2sh.cmd
./p2wpkh.cmd
./p2wsh.cmd
```
Linux:

```
sh btcHDall.sh
sh p2pkh.sh
sh p2sh.sh
sh p2wpkh.sh
sh p2wsh.sh

```
----

Genereted p2pkh address use p2pkh.py or `p2pkh.cmd` or `p2pkh.sh` [p2pkh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2pkh.py) 

![bitcoin p2pkh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p2pkh.jpg)
----

Genereted p2wpkh address use p2wpkh.py or `p2wpkh.cmd` or `p2wpkh.sh` [p2wpkh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2wpkh.py)

![bitcoin p2wpkh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p2wpkh.jpg)

----

Genereted p2sh address use p2sh.py or `p2sh.cmd` or `p2sh.sh` [p2sh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2sh.py)

![bitcoin p2sh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p3sh.jpg)

----

Generated p2wsh address use p2wsh.py or `p2wsh.cmd` or `p2wsh.sh` [p2wsh.py (source)](https://github.com/Pymmdrza/BTC_HD_Wallet_Checker/blob/main/p2wsh.py)

![bitcoin p2wsh address generator privatekey](https://raw.githubusercontent.com/Pymmdrza/BTC_HD_Wallet_Checker/main/p2wsh.jpg)

----
[View Full Source Here](https://mmdrza.com/generated-bitcoin-address-and-private-key-hdwallet/)
```
# ================================================
# DONATE (BTC) : 16p9y6EstGYcnofGNvUJMEGKiAWhAr1uR8
# Website : Mmdrza.Com
# Email : X4@mmdrza.Com
# Dev.to/Mmdrza
# Github.com/Pymmdrza
# ================================================
```
Here's Why Companies Still Opt for Private Cloud
Published: 2022-03-27 19:32:48

 With the heavy presence of cloud computing that allows companies to run their applications with minimum efforts while storing their data in the cloud, some companies still opt for a private cloud model and below are some reasons why:

1. **Control:** Companies want to be in control of the data they generate. This might be in line with compliance or regulatory requirement.  A public cloud is fully controlled by the cloud provider from monitoring to maintenance to patching to storage model, e.t.c. Companies still want to be in charge of their datasets in which case, they will opt for a private cloud.

2. **Sensitivity and Security:** Although most cloud providers have put in good efforts to ensure the security of their datacenters, clients still have to access these services using internet connections. A private cloud provides security and privacy for sensitive data. The private datacenters are exclusive to the company IT.

3. **Customization:** This is tricky as cloud providers make provision for autoscaling of resources deployed however, a structured company already understands its business infrastructure needs like storage capacity, networking features, size of the datacenter, cooling system, e.t.c. A private cloud will allow for these customizations in line with the business requirement.

4. **Location:** Cloud providers are not in every region of the world yet. There are some countries where cloud providers aren't present yet e.g. Nigeria. Although cloud providers provide cache close to clients' users, this doesn't beat down a standard on-premise datacenter responding to requests.

The best cloud model (public, private or hybrid) is hugely dependent on the unique need of a company. A private cloud allows you to own your own datacenter, lets you be in full control. This comes with some cons I will share much later.

Let me know if this was helpful. I love feedback.
JavaScript .call() .apply() .bind() simplified.
Tags: javascript
Published: 2022-03-28 05:47:30

These three methods are part of the `Function.prototypes`. Basically, what they do is change the reference of `this` so it points to the "object target".

```javascript
const sayHi = function() {
  console.log(`Hi ${this.name}!`);
};

const person = {
  name: "foxy",
};

sayHi.call(person);   // Hi foxy!
sayHi.apply(person);  // Hi foxy!
sayHi.bind(person)(); // Hi foxy!
```

In this example, the 3 methods are referencing the `person` object so `this.name` is now `person.name`. And notice that the object reference is passed as the first argument.

---

## .call()

Takes 1 or more arguments. The 2nd argument onward will be passed to the function.

```javascript
const addItems = function(item1, item2){
  this.items.push(item1, item2);
};

const cart = {
  items: [],
};

// Add items to cart
addItems.call(cart, 'lettuce', 'watermelon');
```

p.s. we can use `arguments` instead of `item1, item2`:

```javascript
const addItems = function(){
  this.items.push(...arguments);
};
```

---

## .apply()

Takes 1 or 2 arguments. The 2nd argument must be an array.
```javascript
addItems.apply(cart, ['egg fried rice', 'cucumber']);
```

---

## .bind()

Takes only 1 argument. In contrast with the above methods, this method will not call the function at once. It returns a new function instead, so you have to call it later manually.

```javascript
// Make a new function
const boundAddItems = addItems.bind(cart);

// Call it here
boundAddItems('milk', 'jellybeans', 'more jellybeans');

// Or pass it to another function
document.querySelector('button')
  .addEventListener('click', boundAddItems)
```

---

## Bonus example

Let's say we want to add an event listener to the entire `<button>` in a document. We can use `.querySelectorAll()` to retrieve the buttons, which will return a NodeList. A NodeList doesn't contain functions like `.map()` or `.forEach()`. But we can borrow these functions from Array.prototype and use it like this:

```javascript
const buttons = document.querySelectorAll('button');
Array.prototype.forEach
  .call(buttons, (el) => el.addEventListener('keydown', ...))
```

In javascript, Array is just an object. And so NodeList! Therefore, using the prototype methods of Array with an object is fine, as long as it is an array-like object.

A NodeList contains a collection of incrementing numbers, and a `length` property, which is why it is similar to an Array.

Thanks for reading!

Links:

[Function.prototypes.call() | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call)

[Function.prototypes.apply() | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)

[Function.prototypes.bind() | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)

[NodeList | MDN](https://developer.mozilla.org/en-US/docs/Web/API/NodeList)
Mental model for developers
Tags: discuss, model, programming, beginners
Published: 2022-03-26 16:00:56

I recently came across the term mental model. This is not a new term yet in the context of the developer it is. Let us understand what the Mental model is by using a theory of first principles.[Link to the theory of first principles](https://fs.blog/first-principles/)

What is a Mental model:  

A mental model is simply a representation of how something works. We cannot keep all of the details of the world in our brains, so we use models to simplify the complex into understandable and organizable chunks.

[Link to blog about Mental models](https://fs.blog/mental-models/)

Another paper that explains the mental model put it as follows. 

Mental models are personal, internal representations of external reality that people use to interact with the world around them.

[Link to paper (https://www.ecologyandsociety.org/vol16/iss1/art46/main.html#WHATISAMENTALMODEL%C2%A0?8)


We developers part of computer science need a model of our own. There are a vast number of practices in computer science where we can use. For now, let us see the most important one which we do on daily basis: code. 

The mental model allows us to understand the codebase. There might be thousands of lines of code in an application you build. But it is humanly impossible to remember every line of code. But what we can remember is the parts of the code that interact with other parts. And using those interactions we can have a memory map of how the application works. 

It is very important that a developer who has just joined a project cannot inherit a memory model from a developer who has been in the project for a long time. The process of model creation may differ from one developer to another. There can be other factors too that come into play like the speed of understanding new things. 

Readability is important when developing and this goes a long way in helping others to achieve a model. We want better results in the end.

We have all come across data models, designs, patterns in development, but is it possible to apply some of these principles to our mental model. The process of creating an application is a mental task you may say, but understanding an application that is already built takes a lot of effort.