teleren/devto huggingface dataset:
Day-9 Valid Mountain Array
Tags: python, challenge
Published: 2020-04-21 06:12:57

---
title: Day-9 Valid Mountain Array
published: true
description: 
tags: #python #challenge 
---
This problem is a part of Introduction to Data Structures Fun with Arrays - 101. Sub-heading of the section is searching for the items in an array.

##### Problem Statement
Given an array A of integers, return true if and only if it is a valid mountain array.

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


##### Observations
1. Elements should be strictly increasing. Then a peak occurs, followed by a steady decrease. 
2. There can not be multiple mountain peaks in the array. Hence, if there exists a peak. The pattern would be as mentioned in point 1 above.
3. The minimum number of elements in the array for a mountain peak to exist would be 3.

##### Solution Approach
1. First, check the length of the array. Only if it is greater than 3. Then check the next conditions.
2. Find the peak. The peak would be the point after which the value of elements strictly starts to strictly decrease.
3. Be careful of the position of starting and ending in subsequent loops.

```
class Solution:
    def validMountainArray(self, A: List[int]) -> bool:
        result = False
        if len(A) >= 3:
            for x in range(0, len(A)-1):
                if A[x+1] > A[x]:
                    result = True
                else:
                    break
                    
            if result:
                for index in range(x, len(A)-1):
                    if (A[index+1] < A[index]):
                        result = True
                    else:
                        result = False
                        break
                        
        return result
```

##### Learnings
1. Time complexity - O(n)
2. Solve multiple scenarios using a pen and paper first. Then code. :)
Personal tribute to "Game of Life"
Tags: javascript, tribute, showdev
Published: 2020-04-21 06:09:29

---
title: Personal tribute to "Game of Life"
published: true
tags: JS,tribute,showdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/hy1i15pthxf0r3gsnbqk.png
canonical_url: https://slashgear.github.io/gol-tribute/
---

This end of the school year as a college professor is not very usual.In a few days, I’m about to give my first courses to distance students through Discord.

I don’t yet know in detail how it will work.But I’ve tried to adapt my courses on “Design Patterns” to be easier and shorter than in previous years.Indeed, I already imagine that it will be complicated to go at the same rhythm.

I had to redo a workshop on the _very classic_ MVC pattern.I must confess that I was sorely lacking in ideas.First of all, I didn’t want to make a graphical interface with _JavaFx_ (Java being the best known language of my students).Second, I wanted to use my programming language, JS.

I hope that by the time you read this article, the [Coronavirus](https://en.wikipedia.org/wiki/Coronavirus_disease_2019) crisis that hit the world in early 2020 is over.As of today, we are still in the middle of it.I even read recently that [Jon H. Conway](https://wikipedia.org/wiki/John_Horton_Conway), the creator of the famous “Game of Life” died of this disease.

![animation by xkcd](https://imgs.xkcd.com/comics/rip_john_conway.gif)

> “Eureka !”

It didn’t take me long to set up a little _game of life_ in JS and without framework.The concept of the game is very simple.With the _canvas_ API, in a few minutes I was able to recreate this well known game.

So here’s the demo I was going to share with my students as an example:

 <iframe src="https://game-of-life-demo.now.sh/" frameborder="0" style="position:absolute;width:100%;height:100%;left:0; position: absolute; top: 0; left: 0; width: 100%; height: 100%; "></iframe> 

Link to the demo: [https://game-of-life-demo.now.sh/](https://game-of-life-demo.now.sh/)

All I had to do was to put it in the shape of a workshop so Students could do it themselves.As all my classes are open, here it is [available on Github](https://github.com/PolytechLyon/isi3-mvc-gol)

I don’t know if [Jon H. Conway](https://wikipedia.org/wiki/John_Horton_Conway) had any idea (when he designed this game) that it would become such a _“reference”_ in the computer science world.By introducing my students to it, I hope it will stay that way.

Feel free to share with me your implementations of the [“Game of Life”](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) in other languages or on other platforms.

Gif credit: https://xkcd.com/2293/
Disaster recovery of single node Kubernetes control plane
Tags: aws, kubernetes, sre
Published: 2020-04-21 05:52:52

*This post originally was posted at [https://vorozhko.net/disaster-recovery-of-single-node-kubernetes-control-plane](https://vorozhko.net/disaster-recovery-of-single-node-kubernetes-control-plane)*

## Overview 

There are many possible root causes why control plane might become unavailable. Lets review most common scenarios and mitigation steps.

*Mitigation steps in this article build around AWS public cloud features, but all popular public cloud offerings have similar functionality.*

## Apiserver VM shutdown or apiserver crashing

### Results
* unable to stop, update, or start new pods, services, replication controller
* existing pods and services should continue to work normally, unless they depend on the Kubernetes API

### Mitigations
#### In case of apiserver crash
* Apiserver is a POD, so it's responsibility of kubelet to restart the pod.
* Kubelet itself is monitored by systemd which will restart kubelet in case of failure.

#### In case of VM shutdown
AWS Cloudwatch approach based on instance status check:
* Create Cloudwatch Alarm
* Choose EC2 Per-Instance metrics "StatusCheckFailed_Instance"
* Select threshold StatusCheckFailed_Instance >= 1 for 2 datapoints within 2 minutes
* Set EC2 action "Reboot this instance" when check is in "Alarm"

## Apiserver backing storage lost

### Results

* apiserver should fail to come up
* kubelets will not be able to reach it but will continue to run the same pods and provide the same service proxying
* manual recovery or recreation of apiserver state necessary before apiserver is restarted

### Mitigations
* Use EBS volumes
* Setup etcd backup. See previous post on [Backup of etcd](https://vorozhko.net/high-available-kubernetes-cluster-with-single-control-plane-node)

## Network partition

### Results
* partition A thinks the nodes in partition B are down; partition B thinks the apiserver is down. (Assuming the master VM ends up in partition A.)
* existing pods and services should continue to work normally, unless they depend on the Kubernetes API

### Mitigations
* Option 1. Re-provision control plane node in reachable availability zone(AZ). To restore etcd server data see previous post on [Backup of etcd](https://vorozhko.net/high-available-kubernetes-cluster-with-single-control-plane-node)
* Option 2. Setup control plane node in the same AZ as worker node.

## References
* https://kubernetes.io/docs/tasks/debug-application-cluster/debug-cluster/#a-general-overview-of-cluster-failure-modes
A Small Warning About Unsplash
Tags: writing
Published: 2020-04-21 05:48:05

[Unsplash](https://unsplash.com/) is a great website. It's a free and open library with a ton of beautiful pictures. You can use them however you wish and you don't need to add attribution, though I'm sure your readers will think more highly of you if you do.

## Sounds perfect, so where is the catch?
It's so great that it's the go to source of graphics for a lot of bloggers. The same images are reused over and over again.

I feel like this guy keeps following me everywhere:

![Frustrated](https://dev-to-uploads.s3.amazonaws.com/i/mre7duzug8ft51ku0ql1.jpg)
![This guy](https://dev-to-uploads.s3.amazonaws.com/i/oxbypg6gsfq53lzg3od0.jpg)

I used that very same picture for my own article not long ago. Then I saw someone else using it as well. And then I saw it again. And again...

## They know
Unsplash is well aware of the high volume of reuse and in December 2019 they decided to [capitalize on it](https://medium.com/unsplash/introducing-unsplash-for-brands-3b60d1b4ad0c).
![They know](https://dev-to-uploads.s3.amazonaws.com/i/86vbu48c1qrmmgrfr54h.jpg)

## What can you do?
Don't want your article to be part of a clone army? Then at least check your image with Google's Reverse Image Search before publishing.

## Resources

- [Unsplash](https://unsplash.com/).
- [Introducing Unsplash for Brands](https://medium.com/unsplash/introducing-unsplash-for-brands-3b60d1b4ad0c).
- [A few 80/20 tips for writing](https://syften.com/blog/post/writing-style/).
- [How to start a blog](https://syften.com/blog/post/blog/).
Things to Do in Malang - Your Key to Fun During Your Holidays
Tags: traveling
Published: 2020-04-21 05:35:34

Malang is one of the most popular and sought after tourist destinations of all the states in Indonesia. Many tourists from all over the world come here every year, either to spend a few days in Malang or to spend their whole vacation in this destination. There are many things to do in Malang to make your trip a great experience.

One of the first things to do in <a href="https://travelingpin.com/tag/malang">Malang</a> is to get yourself to the ruins. The ruins of these temples and mosques are the first thing that you should see while you are here. A lot of these ruins can be seen within walking distance from the Malang bus station. In fact, most of the major tourist attractions of this place are located close to the Malang bus station.

If you want to have an even more interesting experience while you are in this place, you should try to visit the famous mosque of Bunge, which is about 20 kilometers away from the city. This mosque is believed to be one of the oldest mosques in the world. Its architecture was unique since it was constructed in the form of an octagon.

Apart from these famous places, there are other things to do in Malang to enjoy. Here you can also enjoy water sports like boating and fishing. Or if you prefer walking or bike riding, you can find several hiking trails around the city that will make your trip even more enjoyable.

One thing that you need to remember while you are visiting Malang is that the temperatures in this place can get a bit extreme. Therefore, you should dress appropriately for the weather and try to avoid wearing things that will easily get damaged. For instance, don't wear a swimming suit in the winter season. There are a lot of other things that you can do to enjoy your holiday in this place.

One of the things that people really love to do in Malang is to go snorkeling. You can simply hire a <a href="https://perahubunaken.com"> scuba diving</a> gear in this place or you can simply buy one. Most of the tourists here like to go scuba diving during their stay in this place.

Of course, another thing that people do when they visit Malang is to eat a buffet. Although the dishes are not of much quality, they can definitely satisfy the taste buds of the tourists. A lot of people who are on their <a href="https://travelingpin.com">vacation in this destination like to eat </a> such heavy meals. You can find several restaurants here that offer buffets.

These are just some of the things to do in Malang that will help you enjoy your vacation here. Of course, there are many other things to do in this place. Take the time to <a href="https://travelingpin.com"> explore </a> these things and you will surely find the best things to do in Malang.
Just Another Front-end web developer roadmap - absolute beginners learn here
Tags: webdev, javascript, react, beginners
Published: 2020-04-21 05:30:18

Just another front-end web developer roadmap for absolute beginners, but I think I just curated the things in a friendly manner, by priority and swap the labels...

[Read New Version](https://dev.to/justaashir/just-code-2020-front-end-web-developer-roadmap-announcement-55ge)


So here it is:
{% twitter 1252467047302299648 %}


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



Follow me on Twitter: [@justaashir](https://www.twitter.com/justaashir)
Why I am starting over with JavaScript.
Tags: javascript, junior
Published: 2020-04-21 04:55:38

---
title: Why I am starting over with JavaScript. 
published: true
description: Why I am starting over with JavaScript
tags: JavaScript, JS, Junior
---
# Why am I starting over with JavaScript? #

Well to start, I am a junior developer in the making. I have been through tutorial purgatory and survived. I then decided to go through a bootcamp course on Udemy. The course itself was amazing and I learned so much. From HTML, CSS, JavaScript and jQuery. Then to NodeJS, Express, MongoDB and others. *Wait* you just said you learned JavaScript so why are you starting over?

Well, I *thought* I learned JavaScript. I realized I didn’t learn enough when I started with React. I started with a simple React app just a SPA that was really a follow along to get familiar, and that’s when it hit me. *I have no clue what I am doing*. 

Now, to be honest I brought it on myself; I have been naive with how much I thought I was learning. Simple JavaScript with HTML and CSS was fairly simple but when I had to start creating my own functions to handle things I was lost. *LOST* which caused severe issues when it came to React. 

##SO##

I am starting over with JavaScript. From the beginning and slowly studying to ensure I grasp the fundamentals and really understand it. No tutorials on this one, strictly reading and note taking. I don’t want to fall into the false sense of thinking I’m learning because I’m making a cool project happen by following someone else coding. This is the first step towards my dream and realizing I set myself up for failure the first time is the first step in correcting my journey.
mp4 to gif
Tags: mp4, gif
Published: 2020-04-21 04:43:50

---
title: mp4 to gif
published: true
description: Use ffmpeg
tags: mp4, gif
---
I converted mp4 file to animation gif.
ffmpeg is better than imagemagick on my purpose.

At first I tried `convert` command (imagemagick). It took 5 minutes and more, 100x file size, and it didn't finish!
`convert from.mp4 to.gif`

mp4 size is 5MB, 30 seconds.

Next I try ffmpeg. It took 10 seconds. It's enough for me.
`ffmpeg -i from.mp4 to.gif`

https://askubuntu.com/questions/648603/how-to-create-an-animated-gif-from-mp4-video-via-command-line
Angular 9 Application to display Random Jokes
Tags: angular, webdev, typescript, api
Published: 2020-04-21 04:37:55

---
title: Angular 9 Application to display Random Jokes
published: true
description: Angular app to consume Jokes API.
tags: Angular, Webdev, Typescript, API
---

Quarantine times are the worst! Guess what I built an Angular App based on a free API for Jokes which I found on GitHub. I built the application and hosted it on GitHub Pages.

Here is the link for the web app: https://jumpman-pradeep.github.io/ReddyPi/

Here is the link for repository: https://github.com/jumpman-pradeep/ReddyPi

Feel free to comment, fork it, play around or collaborate on something useful and interesting
How to create your own nginx cheatsheet using the waterdeep.io command line interface
Tags: nginx, devops, cli
Published: 2020-04-21 04:30:09

### Here's a guide on how to create your nginx cheatsheet using the waterdeep.io CLI

1. Install the [CLI](https://github.com/yasuf/waterdeep-cli)

```
npm install -g waterdeep-cli
```

2. Sign up and create an account at [waterdeep.io](https://waterdeep.io)

3. Create a new file in with name `nginx_cheatsheet.txt`

4. Copy and paste the following content to the editor:

```
### Nginx Cheatsheet

[Start service]
systemctl start nginx

[Stop service]
systemctl stop nginx

[Restart service]
systemctl restart nginx

[Reload config]
systemctl reload nginx
```

3. Save the file with "Save Script"

4. Now you can retrieve that file using the CLI:

```
$ water get [your username]/nginx_cheatsheet.txt
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
```

As a side note, remember you can also retrieve a list of all your files on waterdeep by using:

```
$ water get [your username]
```
Have you ever experienced a state of flow? How did you get there?
Tags: discuss
Published: 2020-04-21 04:24:18

---
title: Have you ever experienced a state of flow? How did you get there?
published: true
description: A discussion on flow states and fully immersing yourself into your work.
tags: #discuss
---

I'm curious, how many of you have experienced a flow state or fully immersing yourself into an activity? What criteria and/or environment allowed for it to happen?
GraphQL: A solution for connecting data
Tags: graphql, opensource, letstalk, startup
Published: 2020-04-21 04:19:51

You may wonder why a startup like Hasura(@hasurahq) is able to raise almost $10 million to simplify GraphQL for developers.  In that same breath, I should say I am very grateful to developers like Christian Nwamba(@codebeast) who are helping developers understand these concepts.  Before we talk about what it can do, though, let's talk about what it is.	
GraphQL is an open-source query and data manipulation language for APIs.
It, presently, contains the five built-in types:
1.	String
2.	Boolean
3.	Int
4.	Float
5.	ID

These data types provide a foundation for building schemas or documented representations of data entities and their interactions.  
So where does GraphQL fit into your current architecture?  Putting a GraphQL server in front of a data source can help create minimal architecture.  GraphQL can be used as a light wrapper around existing APIs.  In other words, GraphQL APIs allow us to efficiently connect data—reducing complexity.  Thinking in graphs is about thinking about the data and the connections among the different entities.

**References**:
1.	Hasura raises $9.9M Series A to simplify GraphQL for developers.  https://techcrunch.com/2020/02/26/hasura-raises-9-9m-series-a-to-simplify-graphql-for-developers/.  Last Accessed: 4/20/2020.
2.	Get Started Building GraphQL APIs With Node.  https://css-tricks.com/get-started-building-graphql-apis-with-node/.  Last Accessed: 4/20/2020.
3.	Advice from a GraphQL Expert.  https://www.netlify.com/blog/2020/01/21/advice-from-a-graphql-expert/.  Last Accessed: 4/20/2020.
Hosting a Static Blog on Netlify
Tags: static
Published: 2020-04-21 06:33:29

---
title: Hosting a Static Blog on Netlify
published: true
date: 2020-04-21 03:00:00 UTC
tags: static
canonical_url: https://daily-dev-tips.com/posts/hosting-a-static-blog-on-netlify/
---

In Yesterday's post, we learned how to [create a static blog with eleventy](https://daily-dev-tips.com/posts/building-a-static-blog-with-11ty/), but having a blog local doesn't really bring us much fun, does it?

To give you some recap [Netlify](https://www.netlify.com/) is an awesome static host. There are about a million more options, but I like to explore Netlify today since that is what I am using.

And the best of all they offer a free tier, see more on their [pricing page](https://www.netlify.com/pricing/).

So let's see how we can host our created blog on Netlify.

## Deploying our Static blog with Netlify

### Creating an account on Netlify

Head over to [Netlify Signup](https://app.netlify.com/signup) and log in using your preferred method of authentication.

I am using GitHub because my project is on GitHub.

### Creating a new site on Netlify

Once we set up and created our account on Netlify we can go ahead and add a new site from Git.

This way, our website can incorporate automatic deployments later on.

I'm choosing GitHub here as an option; it will now ask you to authenticate with GitHub and asks you which repository you would like to use. Let's choose the blog we created [yesterday](https://daily-dev-tips.com/posts/building-a-static-blog-with-11ty/).

### Netlify build settings

Netlify is amazing enough to help us get started to it will help us set a build command:

```
npx eleventy

```

And set the Publish directory to be `_site` for our project.

Now click **Deploy site** and wait a couple of seconds.

### Netlify extra's

Netlify comes with some amazing options

- We can set up a custom domain like https://daily-dev-tips.com
- We can secure the website (Highly recommended!)
- We can add [Forms](https://www.netlify.com/products/forms/)
- We can even add [Netlify functions](https://www.netlify.com/products/functions/)

## Viewing our deployed website

Once the project is deployed, click and visit your website.

[See our website here!](https://romantic-torvalds-af350e.netlify.app/)

## Auto deployment

Because we linked Netlify to our GitHub project every time we publish to the Master branch, we will automatically deploy to Netlify, isn't that just great? 🔥

### 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)
I need some help with a software engineering research paper!
Tags: help
Published: 2020-04-21 04:19:30

## *Hey everyone!* :wave:

**Edit:**
Thank you to everyone who has sent me their contributions! The requirement for my paper has been fulfilled and everyone has been a great help to me.

<hr>

As a senior in high school, one of my requirements for graduating this semester is completing a *vocational research paper*. Essentially, I research and write about a field I would like to enter, and obviously I decided to write about software engineering!

Part of the paper is having someone (or multiple people) currently in the field of software engineering/development complete a *questionnaire* inquiring about their job.

As great as this is for receiving experience and answers to common questions about entering the field of software, I do not personally know anyone who works in developing software. So I've decided to reach out here and see if anyone would like to contribute!

## The details

The questionnaire is simply a short (8 questions) list of questions that you would type out the answers to and send back to me via email.

Your answers will not be used in any manner outside of submitting the paper to my school. Your name will be the only disclosed information.

If you are interested in helping out a budding software developer, **please reply below!** I'll send out the questionnaire to the email that is public on your profile.

And of course, your time and answers are extremely valuable to me. I am passionate about software development and engineering, and I would love *any* advice you can give.

### Thank you! :smile: