teleren/devto huggingface dataset:
Disaster Recovery Maturity Model
Tags: distributedsystems, disasterrecovery, cloud
Published: 2021-10-22 20:01:21

#Points to be consider while setting up DRMM.

###Catalog your applications: 
Make sure you are aware of all applications that exist in the ecosystem and that they have assigned owners along with their contact information. Also, make sure that the application owner is made aware of their responsibilities E.g. in case of an emergency, they or whoever they nominate on their behalf may be contacted for remediation.


###Document standard recovery procedures: 
For each application, make sure recovery procedures are documented and more importantly, well understood
Define a strategy: Make sure that the RPO and RTO for each application is defined i.e. a backup is defined.


###Categorize applications into resilience categories:
Not all applications are created equal. Define resilience categories and slot each application into one of them. For e.g. the payments application for a credit card company may be more important to recover than a reporting application. Be aware of legal and compliance regulations for your domain. DR strategies come at a cost. An active-active deployment will likely cost more money than a cold standby. Make sure your business stakeholders are aware and participate actively in this categorisation process.


###Practice!: 
Ideally all the time as part of your automated deployment pipeline. Take your DR drills seriously. 
* Can you really recover if things start going south?

###Automate!:
Infra as Code, automated configuration and secrets management, automated deployment, 'nuff said!
AWS' Well Architected Framework has a reliability pillar which talks about planning for disaster recovery that you may find useful.

##Do maturity Assessment:
###Areas to consider for maturity assessment (AWS context):

* Applicable across all inventory -- application, network, infra, CI, storage, test-environments, etc. Any system that gets used today, needs a DR strategy -- including test systems, CI/CD, toggle/configuration stores, doc repos, etc.. because they ALL play an important role in keeping the Software running and Development process (machinery that creates software) running. (This is borrowed from Security thinking, where keeping non-Prod systems is very important too).

* Are components in one AZ, multi-AZ, or cross Region (is cross region level complexity needed?)
For their business what are the RPO/RTO requirements? Each component then needs to be assessed against those goals -- to get a "heat map" for the whole inventory -- where are we today, vs where do we want to be, vs how will we get there, and what are the priorities? The RPO/RTO goals are usually not the same for all components, since some sub-systems are more critical than others.

* What is the level of automation (to support the RPO/RTO objectives)? 

* How frequently is the automation tested?

* Do they have automation/checks in place that can detect new features/configurations that are no longer meeting RPO/RTO objectives, because DR/Backup/Restore scripts have become out-of-date/obsolete? ("DR Automation obsolescence drift"). Think Poka-Yokes.
CAN YOU DESIGN MULTICOLOURED STAR USING PYTHON??
Tags: python
Published: 2021-10-22 19:52:26

PYTHON TURTLE IS AN AMAZING LIBRARY .
##**Introduction**

*turtle* is Python’s pre-installed library that enables users to create small games, animations, etc., with easy-to-understand codes.

With minimal and easy-to-understand codes that create beautiful shapes, it is a great way for kids to start their coding journey
##**Get started with turtle**

###1. Import the module

*turtle* is a pre-installed library in Python; therefore, we don’t need to install it explicitly.

The turtle module and its methods can be used in a program once it is imported into your Python environment, which can be done as follows:
    ```  
    import turtle 
 
    ```

###2.Create a canvas

Since turtle will perform graphic actions, it requires a canvas or separate workspace area to act on our commands. The turtle canvas or screen can be initialized, as shown below:
    ```   
    screen=turtle.Screen()

    ```
###3. Create a turtle

We need a turtle to perform actions on the canvas. turtle object is instantiated by the creation of an object of the Turtle class defined in the turtle module.

The turtle object is created as follows:
    ``` 
    t=turtle.Turtle() 
    ```
  
   


##CODE AS FOLLOWS:

```
import turtle
col=['yellow','red','green','blue','white','orange']
t=turtle.Turtle()
screen=turtle.Screen()
screen.bgcolor('black')
t.speed(30)
for i in range(100):
    t.color(col[i%6])
    t.forward(i*4)
    t.left(150)
    t.width(1)

```
JS practice: day2 - password decoder
Tags: encryption, password, javascript, regex
Published: 2021-10-10 16:12:17

---
title: JS practice: day2 - password decoder
published: true
description: a basic decoding script for my previous password generator
tags: encryption, password, js, regex
//cover_image: https://direct_url_to_image.jpg
---

Yesterday [I wrote a script](https://dev.to/nedzen/js-practice-day1-password-generator-4o7h) for generating passwords based on a priming word. It's a basic function that uses Regex to match vowels and consonants. Next, it ads each into separate arrays, then does some counting, addition, and multiplication on the initial numbers. Ultimately, it scrambles it all in a single array which I then `join('')` into the returned string.

It's not rocket science, but it's fun and useful. Today I wrote a little script to decode these passwords; let's get into it.

```JS
// the RegExp patten that matches all letters and one digit after
let decodeRegex = new RegExp('[a-z][0-9]','gi');

const decodePW = (c) => {

  let chainInitial = [], chainArranged = [];
  // initial array containing pairs of letters and indexes 
  chainInitial = c.match(decodeRegex);
  
  chainInitial.map((el) => { 
    // get a var that contains only numbers
    let index = Number(el.substring(1))
    // get a var that contains only letters
    let letters = el.substring(0,1)
    // reassign indexes in the array
    chainArranged[index] = letters
  });
  
  // make it a string
  let primedWord = chainArranged.join('').toLowerCase()
  return primedWord
};

console.log(decodePW(pwString));
```

And this is pretty much it. This script has a limitation; the priming word needs to be a maximum of ten characters; otherwise, the decoding will not work. That is due to the Regex pattern that I use here `let decodeRegex = new RegExp('[a-z][0-9]','gi');`. It will select only one number after the letter. Feel free to comment if you can make it work with longer words.

Thanks for reading.
How to capture a screenshot of the single window you want (using command line).
Tags: linux, screenshot
Published: 2021-10-22 19:34:09

---
title: How to capture a screenshot of the single window you want (using command line).
published: true
description: If you find a way to capture a screenshot via CLI. Or if the way using `xwd` command does not work well. This article might be your friend.
tags: linux, screenshot,
//cover_image: https://direct_url_to_image.jpg
---

## Introduction.

GIMP is very useful, but sometimes doing not well. Or you find a way to capture screenshots via CLI, but the way using `xwd` command does not work.

In such a case, this article might be your friend.
Also it would be useful when you use some environment that does not have the "ScreenShot" key, such as a laptop.

This article provides you the way to capture screenshots using [`xwininfo`](https://linux.die.net/man/1/xwininfo) and [ImageMagick](https://imagemagick.org/index.php).


## Prerequisite.

As previous, `xwininfo` and `import` of ImageMagick are required.

On Debian and Ubuntu, it needs to install [x11-utils](https://packages.debian.org/sid/x11-utils) and [imagemagick](https://packages.debian.org/sid/imagemagick) packages. To install these, run:

```shell
sudo apt install x11-utils imagemagick
```

Now, we are ready to do!

## Step 1. Get "Window ID" using `xwininfo`.

To get "Window ID", run following command in a terminal:

```shell
xwininfo
```

Immediately prompts shown like following:

![prompts of xwininfo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/74mnwtz5m7dve97qcwjb.jpg)

Select the window you want to capture by clicking a mouse. Then information of the selected window is displayed following the prompt.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ufumetx0qkclop4w62j.jpg)

The **most important is the first line** including "Window id: ...". So the hexadecimal is a Window ID. In the previous example, Window ID is 0x4000001!


## Step 2. Capture a screenshot using `import`.

To capture a screenshot of the selected window using `import` command, it needs to pass "Window ID" with `-window` option.

Run:

```shell
import -window 0x4000001 screenshot.jpg
```

Finally, the screenshot is saved in the current directory!

![screenshot of windows id 0x4000001](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cigfsolhtnygx4rcgiw5.jpg)

## One more thing.

I will show you "How to capture the whole desktop" by CLI. 

Passing `root` keyword to `-window` option:

```shell
import -window root screenshot_whole_desktop.jpg
```

Enjoy!
Leetcode 451. Sort Characters By Frequency
Tags: leetcode
Published: 2021-10-22 19:27:10

https://leetcode.com/problems/sort-characters-by-frequency/

## Problem Statement

Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.

Return the sorted string. If there are multiple answers, return any of them.

Example

Input: s = "tree"
Output: "eert"
Explanation: 'e' appears twice while 'r' and 't' both appear once.
So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer.

## Solution

```
    public String frequencySort(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char ch : s.toCharArray()) {
            if (map.containsKey(ch)) {
                map.put(ch, map.get(ch) + 1);
            } else {
                map.put(ch, 1);
            }
        }
        List<Map.Entry<Character,Integer>> list = new LinkedList<Map.Entry<Character,Integer>>(map.entrySet());
        Collections.sort(list, (a, b) -> b.getValue() - a.getValue());
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<Character, Integer> entry : list) {
            for (int i = 0; i < entry.getValue(); i++) {
                sb.append(entry.getKey());
            }
        }
        return sb.toString();
    }
```
What is AWS Step Function?
Tags: aws, serverless, programming, beginners
Published: 2021-10-22 18:43:49

AWS Step Functions provides server less orchestration for modern applications. Orchestration centrally manages a workflow by breaking it into multiple steps, adding flow logic, and tracking the inputs and outputs between the steps. As your applications run, Step Functions maintains the application state, tracking exactly which workflow step your application is in, and stores an event log of data that is passed between application components. That means if the workflow is interrupted for any reason, your application can pick up right where it left off.

What is State?

Step Functions is based on state machines and tasks. A state machine is a workflow. A task is a state in a workflow that represents a single unit of work that another AWS service performs. Each step in a workflow is a state.

States are elements in your state machine. A state is referred to by its name, which can be any string but it must be unique within the scope of the entire state machine. Individual states can make decisions based on their input, perform actions, and pass output to other states.

States can provide a variety of functions in your state machine: 

Perform some work in your state machine.
Make a choice between branches of activity.
Stop an activity with a failure or success.
Simply pass its input to its output or inject some fixed data.
Provide a delay for a certain amount of time or until a specified time or date.
Begin parallel branches of activity.
Dynamically iterate steps.

Different types of states

AWS Step Functions supports eight different types of states. Choose the image to learn about each state and choose the arrows to go through each state in the stack.

Why Use AWS Step Functions?
AWS Step Functions helps with any computational problem or business process that can be subdivided into a series of steps. Application development is faster and more intuitive with Step Functions, because you can define and manage the workflow of your application independently from its business logic. Making changes to one does not affect the other. You can easily update and modify workflows in one place, without having to struggle with managing, monitoring, and maintaining multiple point-to-point integrations. Step Functions frees your functions and containers from excess code, so you can write your applications faster and make them more resilient and easier to maintain.

Step Functions features

Step Functions is a AWS managed serverless service. To learn more about the serverless service features, such as scaling, availability, pay per use, and security and compliance, choose each of the four tabs.
CSS Gradient Loading Animation
Tags: css, webdev, beginners, tutorial
Published: 2021-10-22 17:50:28

In this article we are gonna build a loading spinner for you website stay tuned for that first let's look what are we building -

![preview](https://i.imgur.com/uPnDE58.gif)

We just need simple div to create this animation. For this animation we have used pseudo classes and a normal keyframe in which we just rotate the div.

**HTML**

```html
<div class="loader"></div>
```

**CSS**

```css
.loader {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 10rem;
  border: 3px solid white;
  background: linear-gradient(#eb31b0, #e4c352, #7df8d6);
  box-shadow: 0px 0px 100px -50px black;
  animation: animate 1s linear infinite;
}

.loader::before {
  position: absolute;
  content: "";
  background: #fff;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  border-radius: 10rem;
  border: 3px solid white;
  box-shadow: inset 0px 0px 100px -70px #111;
}

@keyframes animate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
```

**Codepen is Here**
{% codepen https://codepen.io/j471n/pen/eYWGeMy %}

### Conclusion

So after that you can use it anywhere in your project. And let me know what do you think about it. If you like it then consider a follow.

- [Some Javascript Methods you should know](https://dev.to/j471n/some-javascript-methods-you-should-know-i15)
- [10 Git Commands everybody should know](https://dev.to/j471n/10-git-commands-everybody-should-know-3322)
- [Convert Next.js app to PWA](https://dev.to/j471n/convert-nextjs-app-to-pwa-3fd)
Day 37/100 Full Design System
Tags: 100daysofcode, codenewbie, programming, challenge
Published: 2021-10-22 17:41:10

Today making the whole design system not only gives specific task but contributes to the full access to utilities and components. Learning in a different module makes everything interesting and new approach to apply the code. Above all, I have full access and Thank god, the construction site in front of the apartment finally had common sense!

![design system](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eoz43u2lkiiklf7smp1f.png)
Blog Post #5:Learning Week of 10/18/2021
Published: 2021-10-22 17:12:32

  Hello everyone, week of October 18-22 was ups and downs.  Tears, tears, and more tears because I was still having trouble with the coding language in Ruby(Codecademy) and how it applies in real life.  As a former CPS teacher I had tools to use in class whether it was classroom management, how to speak, how to facilitate and how to execute the curriculum to my students.  In this IT world I am having a difficult time learning what first_prisms, Blocks, Procs, Lambdas mean.  Interpolation was another one!
  
  Towards the end of the week I began another lesson called "Object-Oriented Programming" which was interesting and fun.  Here's a syntax I learned in Ruby that describes @ symbol before a variable to signify that it is an instance variable.
```ruby
class Person
  def initialize(name)
    @name = name
  end
end
matz = Person.new("Yukihiro")
```
  Another syntax I learned was that the attributes in a parameter correspond to what makes up a vehicle, see example below.
```ruby 
class Car  
  def initialize(make, model)
    @make = make
    @model = model
  end
end
Kitt = Car.new("Pontiac", "Trans Am")
```
Cheat Sheets that always save my time during web development 🚀
Tags: css, javascript, react, webdeveloper
Published: 2021-10-22 17:00:02

During Coding I often forget exact properties and at that time searching on google take time at least for me ( because I don't know about you 😁😅).

So I always prefer cheatsheets because in 90% of cases I got my answer from them.

So today I'm going to share a list of top cheatsheets that save my time during development.

#### 1. [HTML Cheatsheet ](https://htmlcheatsheet.com/)- 

This Cheat Sheet contains useful code examples and developer tools, markup generators, and more on a single page. 

This is a helpful quick guide for those who already know how to work with these languages.


#### 2. [CSS Cheatsheet ](https://htmlcheatsheet.com/css/)- 

This Cheat Sheet contains the CSS properties, text-shadow generators, color picker, and some common code snippets.  

#### 3. [Grid Layout](https://grid.malven.co/) - 

This one is not only a time saver but it is really a lifesaver because whenever I'm working with grid layout, most of the time I need a cheat sheet.

#### 4. [FlexBox](https://flexbox.malven.co/) - 

Another visual-based cheat sheet for CSS flexbox, this one contains all the flexbox properties with visual examples.

#### 5. [JavaScript](https://htmlcheatsheet.com/js/) - 

This Cheat Seet contains useful code examples on a single page. Find code for JS loops, variables, objects, data types, strings, events, and many other categories. 

#### 6. [JavaScript](https://ilovecoding.org/blog/js-cheatsheet) - 

This cheat sheet contains basic to advanced concepts. ES6+, simple explanations, DOM API, Event loop, functions, array, object, Type and so much more.

#### 7. [React](http://www.developer-cheatsheets.com/react) -

This single cheat sheet contains various code examples to boost your react development.

#### 8. [Git](http://git-cheatsheet.com/) - 

This cheat sheet contains a list of handy git commands to make your life easier!


### Conclusion - 

Cheat Sheets are best for taking quick references and boosting productivity. I hope you found this article useful and you enjoyed the reading.


Let's connect with me on 

- [twitter](https://twitter.com/Ali6nX404)
- [Linkedin](https://www.linkedin.com/in/mahesh-patidar-34a982192/)
A session on Introduction to SparkAR
Published: 2021-10-22 16:43:12

I conducted a session on Introduction to Spark AR where we travelled through all the steps right from prerequisites to publishing an effect.

Most of the folks attending the session were new to Augmented Reality so they were quite interested to learn how it works and how they themselves can create their own AR Filter.

There were about 30-40 active folks who learnt something new in the session and also I got some requests 

![Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b58fvoj53ctclbxl68lp.png)

Also got some important reviews which will help me to improvise my upcoming events also shared about Hack This Fall 2.0 at the event which will be helpful for the students to kickstart their hackathon journey.
How to check if a string is empty in Bash
Tags: bash, linux
Published: 2021-10-23 23:25:31

---
title: How to check if a string is empty in Bash
published: true
date: 2021-10-22 16:36:15 UTC
tags: Bash,Linux
canonical_url: https://donaldfeury.xyz/how-to-check-if-a-string-is-empty-in-bash/
series: Small Bytes of Bash
---

 ![How to check if a string is empty in Bash](https://images.unsplash.com/photo-1629654291663-b91ad427698f?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDJ8fEJhc2h8ZW58MHx8fHwxNjM0OTIwNDU4&ixlib=rb-1.2.1&q=80&w=2000)

To check if a string is empty in a Bash script, use the `-z` conditional which returns 0 (true) if the length of the string is 0 and 1 (false) if it is greater than 0.

```
myVar="hello"

if [[-z "$myVar"]]; then
	echo "myVar is empty"
else
	echo "myVar is not empty"
fi

```

Alternatively, you can check if a bash string is NOT empty using `-n` and take the opposite using `!`.

```
myVar=""

if [[! -n "$myVar"]]; then
	echo "myVar is empty"
else
	echo "myVar is not empty"
fi

```

### Related

- [All my posts on Bash](https://donaldfeury.xyz/tag/bash)

* * *

Did you find this information useful? If so, consider heading over to my [donation](https://donaldfeury.xyz/donate/) page and drop me some support.

Want to ask a question or just chat? Contact me [here](https://donaldfeury.xyz/contact)
Do computer languages have common sense??
Tags: coding
Published: 2021-10-22 16:35:38

Learning any computer language is one thing. Integrating all that one has learned into professional-level software is a different cup of tea. Many books teach us other concepts in languages that computer understands in their various garbs. With practice, can one quickly master any norms and start how the program’s layout should be? But believe me, putting the whole logic across to the computer is an altogether different story! With all the super-intelligence of the laptop, it still lacks commonsense, which plays a leading role in crucial matters. While our faculties allow us to judge by sight what needs to come where, the same is done on the computer by reading, verifying, counting, comparing, checking, and finally deciding what should be written.
*Don your starched thinking caps and go head to work out the logic independently.*