teleren/devto huggingface dataset:
SSH into your EC2 instances
Tags: aws, cloud, devops, beginners
Published: 2021-06-16 06:36:22

# What is ssh?

SSH is a remote management protocol through which you connect to your remote servers and modify them. This allows you to access your remote servers securely. 

So let us see how we can connect with our EC2 instances securely using SSH

* First see what your public IP address is from your ec2-instance.
![Instance details](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1n60obliashc7b6uz6zk.png)

* After that if you are a Linux or Mac user open your terminal and run the following command ssh username@public-ip for me the public IP is 13.233.33.232 and default ec2 user is `ec2-user` so the final command becomes 

```bash
ssh ec2-user@13.233.33.232
```

* Once you run it you will get the following message
```
The authenticity of host '13.233.33.232 (13.233.33.232)' can't be established.
ECDSA key fingerprint is SHA256:BudJr8YMxFu8ylCGragb1BfW04/VI6+hX017siHF19w.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
```
Type yes and agree to it. After this you will get a message like this 
```
Warning: Permanently added '13.233.33.232' (ECDSA) to the list of known hosts.
ec2-user@13.233.33.232: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

```
It's still not working but that is a good thing because if this allows us to ssh then anyone can ssh into our EC2 instance if he knows our public IP.

* In the last exercise we downloaded a pem file while creating our EC2 instance we need to use that pem file to login into out EC2 instance. to use that we run ssh -i path-to-file username@public-ip
```bash
ssh -i EC2test.pem ec2-user@13.233.33.232
```

* It will still not allow you to signin and because permissions are to open. This is because right now our EC2 test.pem file permissions 0644 which allows any user to write on it. EC2 is complaining that even the root user should have read only permission so that no one can change our key file.

* This can be easily resolved just do
```bash
chmod 400 EC2test.pem
```
* Which resolves the permissions issue now run the above command again.
```bash
ssh -i EC2test.pem ec2-user@13.233.33.232
```

* Now you will be logged into your ec2 instance.

This is it for how to remote access to your ec2 instance. In the next article in the series we will study more about the different EC2 instances and there advantages.
Suppression d'une référence vers Google
Tags: python, selfhosting
Published: 2021-06-16 06:29:50

Je me suis aperçu aujourd'hui que le blog envoi une requête vers le domaine googleapi.com. Argh ! Sacrilège !  
Le thème du site renvoyait effectivement vers une [feuille de style CSS](https://fonts.googleapis.com/css?family=Open+Sans:400,600,700), pour la police d'écriture Open Sans. Ni une, ni deux, la ligne de code

`
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>
`

a été remplacé par

`
<link href='../theme/css/police.css' rel='stylesheet' type='text/css'>
`

contenant tout le nécéssaire. Ouf, inspire et expire, ça va mieux.

Désolé pour ce petit désagrément. Une bonne chose de faite !

EDIT DU 13/11/19 : j'ai depuis remplacé ces polices par [Luciole](http://www.luciole-vision.com/)
What is the things you do when tests fail on CI?
Tags: testing, devops, microservices, distributedsystems
Published: 2021-06-16 06:29:22

Hey everyone,

Considering the importance of CI in the development cycle, gaining observability into the CI pipeline is getting more critical. Failed tests are a huge issue for the pipeline.

What is the first thing you do when a test fails on CI? Checking logs? Re-running? Or etc?

Cheers
Reading: Mastering Vim Quickly: From WTF to OMG in no time
Tags: vim
Published: 2021-06-16 06:28:04

I already had experiences since one year with Vim; but I didn't put real effort to be efficient with my beloved text editor.

The newsletter "Mastering Vim Quickly", which I read since weeks, give overviews of the content of the book and different tips. So with the black Friday, I have bought a digital version and read it. This book showed me how vim works and how to get efficient.

This is my first major step to become a Vim Ninja and to turn Vim+Bash into a efficient IDE.

## Mastering Vim Quickly : An easy and rich reading

Well I have to admit: this book is well written. Concise enough to get to the point and it shows the most important know-how to be independant with Vim. There is a lot of content, no doubt about it; even if I want more :)

From basics command for file editing, modes, multiple file editing (Hi _netrw_ <3), vimrc, folding and other topics; it covers every aspect needed to be efficient with the least effort.

It shows that a lot of plugin are unecessary too: they can be avoided (hi _NerdTree_).

At the end, some productivity tips are given. It is not always what I wanted (or I already knew it), but it has shown me some possibilities and the power of Vim.

## Not enough to become a Vim Ninja

However, more knowledge is necessary to be more effective than Visual Studio Code IMHO. Thus this book is not a magic potion; but the best starter to get skilled. It saves a lot of time and this is the most important with this book: it avoids all the initial confusion of vim. It brings you where you want to be : conformtable with the tool.

## Road to Vim Ninja: all the way

So I read it now, I need to learn more about vim because this tool is so powerful. But like Lego, everything has to be built or at least set up. So I will share my experiences with you throughout the adventure :)

As people I respect says : "the road is long but the way is free". It is true for vim.

PS : Always a pleasure to have an IDE starting in 0.15 seconds with all the plugins 😃
LeetCode 152. Maximum Product Subarray
(javascript solution)
Tags: algorithms, javascript
Published: 2021-06-16 06:10:20

###Description:
Given an integer array nums, find a contiguous non-empty subarray within the array that has the largest product, and return the product.

It is guaranteed that the answer will fit in a 32-bit integer.

A subarray is a contiguous subsequence of the array.

###Solution:
Time Complexity : O(n)
Space Complexity: O(1)

```javascript
var maxProduct = function(nums) {
    // Max product in the current contiguous array
    let currentMax = nums[0];
    // Mind product in the current contiguous array. We need this value in case we encounter 2 negative numbers whose product could potentially give us the max product of the entire array
    let currentMin = nums[0];
    // Max product of a contiguous array
    let finalMax = nums[0];
  
  for(let i = 1; i < nums.length; i++){
    let temp = currentMax
    // Because we are looking for a contiguous subarray product, the current max must contain the current number in the array. 
    currentMax = Math.max(Math.max(currentMax * nums[i], currentMin*nums[i]), nums[i])
    // Use temp here in case the previous currentMax was negative
    currentMin = Math.min(Math.min(temp * nums[i], currentMin*nums[i]), nums[i])
    // Record highest max at the end of every contiguous subarray
    finalMax = Math.max(currentMax, finalMax);
  }
  
  return finalMax;
};
```
Weekly web development resources #78
Tags: webdev, weekly
Published: 2021-06-16 05:59:59



______

##[Astro](https://astro.build/)
[![Astro](https://wweb.dev/weekly/content/78/astro.jpg)](https://astro.build/)
A tool to build websites with your favorite JavaScript framework and ship the minimum amount of JavaScript.

______

##[BootStarters](https://www.bootstarters.com/)
[![BootStarters](https://wweb.dev/weekly/content/78/bootstarters.jpg)](https://www.bootstarters.com/)
An open source collection of free themes for Bootstrap 5.

______

##[Beginner JavaScript Notes](https://wesbos.com/javascript)
[![Beginner JavaScript Notes](https://wweb.dev/weekly/content/78/beginner-js.jpg)](https://wesbos.com/javascript)
A free resource for getting started or improving your JavaScript skills.

______

##[The perfect link](https://www.a11y-collective.com/blog/the-perfect-link/)
[![The perfect link](https://wweb.dev/weekly/content/78/link.jpg)](https://www.a11y-collective.com/blog/the-perfect-link/)
A nice article on how to create the perfect link.

______

##[GitHub Flat Data](https://octo.github.com/projects/flat-data)
[![GitHub Flat Data](https://wweb.dev/weekly/content/78/flat.jpg)](https://octo.github.com/projects/flat-data)
A tool to bring working sets of data to your repositories.

______

##[Mail Studio](https://mailstudio.app/)
[![Mail Studio](https://wweb.dev/weekly/content/78/mail-studio.jpg)](https://mailstudio.app/)
An application for designing responsive emails that work everywhere.

______

##[Open Tags](https://opentags.io/)
[![Open Tags](https://wweb.dev/weekly/content/78/opentags.jpg)](https://opentags.io/)
A website to analyze and debug your meta tags.

______

##[Handwriting Generator](https://www.handwriting-generator.com/)
[![Handwriting Generator](https://wweb.dev/weekly/content/78/handwriting.jpg)](https://www.handwriting-generator.com/)
A tool to automatically generate images or GIFs of handwriting from text.

______

##[Ness](https://ness.sh/)
[![Ness](https://wweb.dev/weekly/content/78/ness.jpg)](https://ness.sh/)
A CLI to easily deploy web sites to your AWS account.

______

##[The right tag for the job](https://localghost.dev/2021/06/the-right-tag-for-the-job-why-you-should-use-semantic-html/)
[![The right tag for the job](https://wweb.dev/weekly/content/78/semantic-html.jpg)](https://localghost.dev/2021/06/the-right-tag-for-the-job-why-you-should-use-semantic-html/)
An article on why you should use semantic HTML.

______

To see all the weeklies check: [wweb.dev/weekly](https://wweb.dev/weekly)
Python's Collections Module: OrderedCounter
Tags: python, codenewbie, collections
Published: 2021-06-16 05:19:05

## What are we trying to achieve?

If you recall from last post, here's the Method Resolution Order of Counter class:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mgo2kaaynbi3gcfbj073.png)There's no way we can swap the priority order. One option is to be cheeky 😛 and make use of the `__repr__` method of `builtins.dict`


## Option1: Casting a `Counter` Object to `dict`

By casting the `Counter` to `dict`, `print` will use`__repr__` method of `dict` which will make sure, order is maintained!

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8vczzpb5d6p0g6v89ddp.png)But this doesn't draw the idea home, I mean what if a novice looks at this code? He has no idea why we are casting the `Counter` to `dict`. 
So a better approach would be to create our own custom `OrderedCounter` class for *clarity*.

## Option 2: Creating a custom `OrderedCounter` class
We can create a class that inherits from `Counter` and implement it's own version of `__repr__` method, 

The idea is still the same: cast the `Counter` to `dict` but this time by providing *abstraction* and thereby improving the *readability* of code.

```python
class OrderedCounter(Counter):
    'Counter that remembers the order elements are first encountered'

    def __repr__(self):
                        # casting 'self' to dict will do the job
        return '%s(%r)' % (self.__class__.__name__, dict(self))

    def __reduce__(self):
        return self.__class__, (dict(self),)
```
Here, the instantiation(creation) of `OrderedCounter` Object will be done by the `__init__` method of `Counter` class. This means a object of type `OrderedCounter` contains the count of values in iterable passed a.k.a behaves like `Counter`. 

The `__reduce__` method implementaton is necessary for 'PICKLING' purpose which we will discuss in some other post. 

## `OrderedCounter` in action!

```python
# creating Ordered Counters
ordered_c0 = OrderedCounter('kkkaaaajjjjkkaaakklll')
ordered_c1 = OrderedCounter(["oranges", "apples", "apples", "bananas",
                             "kiwis", "kiwis", "apples"])


print(ordered_c0, ordered_c1, sep='\n')

"""OUTPUT => Order Maintained 

{'k': 7, 'a': 7, 'j': 4, 'l': 3}
{'oranges': 1, 'apples': 3, 'bananas': 1, 'kiwis': 2}
"""
```

> There  are some other ways too, but knowing these two ways are more than enough!

## References:
https://stackoverflow.com/questions/35446015/creating-an-ordered-counter
Everything you wanted to know about the Security+ SY0-601 but were afraid to ask
Tags: security
Published: 2021-06-16 04:48:22

CompTIA Security+ is the pinnacle cyber protection certification. Security+ certification is in high demand and maintains to serve as a fundamental certification for experts beginning an IT career or others looking to construct a profession in cybersecurity. On top of that, Security+ certification is also authorized using the Department of Defense (DoD) to satisfy Directive 8570.01 -M requirements.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cyv2wzc5qanuxit2ozl.jpg)

If you’re looking for employment within the government, then it's far a required certification. CompTIA Security+ SY0-501 is the present-day Security+ examination and maybe to be had to take till the Spring of 2021. However, the Security+ SY0-601 is scheduled to be launched in October of 2020. If you’re an IT security professional and you’re seeking to decide which certification is nice for you or if you’re simply trying to research extra about every examination, check out the statistics under:

###What is on the modern-day CompTIA Security+ SY0-501?

The SY0-501 examination specializes in these talent regions:

•	Threats, attacks, and vulnerabilities
•	Tools and technology
•	Architecture and design
•	Identity and get entry to management
•	Risk control
•	Cryptography and PKI

The <a href="https://dumps4free.com/SY0-601-exam-questions-pdf-vce.html">SY0-601 Exam</a> will cover the equal talent regions pondered within the SY0-501. However, some of these areas will consist of extra information. Expect to see changes in the following regions:

•	Threats, assaults, and vulnerabilities
•	Hands-on use of Tools and Technologies
•	Risk Management

###The additional information is predicted to consist of the following:

•	Cloud assist
•	Security for modified virtualization systems
•	Mobile tool safety problems
•	In intensity evaluation of tracking equipment
•	Additional data on the network get right of entry to manage fashions
•	Common cell tool manufacturer issues
•	Questions overlaying SSO multifactor authentication strategies and equipment
•	Best practices for Cyber Security threats
•	Penetration assessments
•	Vulnerability scans

Also, expect to peer extra overall performance-based questions (PBQs) on SY0-601.

###Which exam must you take?

Professionals need to determine to take every examination based on their man or woman's needs and timeline. Both assessments will train you on how to recognize and manipulate security threats, but if you’re equipped properly now SY0-501 is the most effective examination to be had until October.

If you can wait till October, the SY0-601 will include updates based totally on the nature of the current cyber protection environment and troubles that cyber protection specialists are combating these days. If you decide to put together for <a href="https://www.comptia.org/certifications/security#examdetails">SY0-601</a> make certain that your examination education is appropriate to that exam!
I build a minimal Conway's Game of Life with JavaScript
Tags: javascript, showdev, algorithms
Published: 2021-06-16 04:46:51

{% codepen https://codepen.io/pontakornth/pen/wvJReey %}

It's minimal version I can come up with for now. Currently, starting positions of cells are hard coded. But, the game is working correctly.

I wish to add a feature where I can toggle cell by clicking. I see why Conway's game of life become an example project for WASM with Rust. It's difficult to do it efficiently. For example, to change state of the grid, I created a whole new array just to store next state. It can be done more efficiently by storing change instead.

The code is not really consistent for now. But, I will left it be because I need to reference it when I improve the code in another project.
Git Hack: Make commit with a past date
Tags: github, productivity, computerscience, career
Published: 2021-06-16 04:45:06

Hello reader! 

*Ever wanted to commit something to a git repo with a past date? Here’s how you could do it.*

If you are working on a project and missed a commit yesterday or you accomplished the task but GitHub for Windows bailed on you? Well, this little hack can solve your problem.

Check the YouTube video tutorial for live demonstration and better Understanding.
 
{%youtube cSwgkUHk_Qo%}

Pre-Step.
*Pull all data from remote to the local repository.*

For the same, we are using the --amend and --date switches.
The exact command is as follows:

```$ git commit --amend --date="YYYY-MM-DD HH:MM:SS"```

Simple isn't it!

And with that, it's a wrap!  I hope you found the article useful! Share in the comments below.
I create content about **Career, Blogging, Programming, and Productivity**, If this is something that interests you, please share the article with your friends and connections. You can also subscribe to my newsletter to get updates every time I write something!

Thank you for reading, If you have reached so far, please like the article, It will encourage me to write more such articles. Do share your valuable suggestions, I appreciate your honest feedback!

I would strongly recommend you to Check out the [YouTube video](https://www.youtube.com/watch?v=cSwgkUHk_Qo) of the same and **don't forget to subscribe to my Channel**. I would love to connect with you at [Twitter](https://twitter.com/ayushi7rawat) | [LinkedIn](https://www.linkedin.com/in/ayushi7rawat/).

You should definitely check out my other Blogs:

- [Python 3.9: All You need to know](https://ayushirawat.com/python-39-all-you-need-to-know)
- [GitHub CLI 1.0: All you need to know](https://ayushirawat.com/github-cli-10-all-you-need-to-know)
- [How to make your own Google Chrome Extension](https://ayushirawat.com/how-to-make-your-own-google-chrome-extension-1)
- [Run Javascript from Python](https://ayushirawat.com/run-javascript-from-python)
- [Automate WhatsApp using Python](https://ayushirawat.com/automate-whatsapp-using-python)
- [Automate Cowin Vaccine slots Availability using Python](https://ayushirawat.com/automate-cowin-vaccine-slots-availablity-using-python)
- [What is Competitive Programming](https://ayushirawat.com/what-is-competitive-programming-or-beginners-guide)


See you in my next Blog article, Take care!!
[Webinar]Link Your Charts and Grids in 20 Minutes with JetBrains + Syncfusion
Published: 2021-06-16 04:39:40

Join us for our upcoming joint webinar on linking your charts and grids with @jetbrains and [Syncfusion](https://www.syncfusion.com/ "Syncfusion")!

Register now: https://register.gotowebinar.com/register/8146814229482411023

![webinar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cbfixgt5mz2mjzgweive.jpg)
Creating Complete Server-Side and WebAssembly Blazor Applications Using Syncfusion Controls
Tags: blazor, webinar, syncfusion, webassembly
Published: 2021-06-16 04:30:03

Don't miss out on our encore Blazor webinar this week in celebration of BlazorDay! Create apps quickly and easily with [Syncfusion](https://www.syncfusion.com/ "Syncfusion").
Sign up now: https://bit.ly/3gqEbIc

![Blazor webinar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hdl0iv7zw4tt94eyzcz.jpg)
How to Deploy React App to a Shared Hosting (CPanel) in Less Than 4 Minutes.
Tags: react, softwaredevelopment, deploy
Published: 2021-06-16 04:15:40

![Deploy ReactJs App](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/detaga9vztq7plk5gxrk.jpg)
Learn how to deploy your react app on a shared hosting platform. In this video, you will need to create a production build. Production build is a pack of all your react code and its dependencies. In most shared hosting we put our site/app inside a public_html directory so if we hit www.yourdomain.com it serves the code from public_html directory. Follow along with this short video to get your react project up and running in less than 4 minutes.
YouTube: https://www.youtube.com/watch?v=xUqvXaiCmHI
Getting Started with Flutter DateRangePicker in 10 Minutes
Tags: flutter, daterangepicker, tutorial, mobile
Published: 2021-06-16 04:02:48

This new tutorial about Syncfusion #Flutter [DateRangePicker widget](https://www.syncfusion.com/flutter-widgets/flutter-daterangepicker) shows you how to change picker views, switch selection modes, and get selected dates.

Watch now
{% youtube 3TyuUVExuPs %}
Attention this, attention that
Tags: machinelearning, naturallanguageprocessing
Published: 2021-06-16 03:07:29

This post is for people who are working on or learning in deep learning with natural language processing. Minimum knowledge level: [Hugging Face - Transformer](https://huggingface.co/course/chapter1) or equivalent. 

Who have read 3 followings papers are beneficial:
- [Neural Machine Translation by Jointly Learning to Align and Translate](https://arxiv.org/pdf/1409.0473.pdf)
- [Effective Approaches to Attention-based Neural Machine Translation](https://arxiv.org/pdf/1508.04025.pdf)
- [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf)

There are 3 style of attention mechanism should not be confused with namely:

| Name | Tensorflow implementation | PyTorch implementation | Paper |
|:-----|:-----|:-----|:-----|
|  Bahdanau attention | [AdditiveAttention layer](https://keras.io/api/layers/attention_layers/additive_attention/) | [Attention Decoder](https://pytorch.org/tutorials/intermediate/seq2seq_translation_tutorial.html#attention-decoder) | [Neural Machine Translation by Jointly Learning to Align and Translate](https://arxiv.org/pdf/1409.0473.pdf) | 
| Luong attention | [Attention layer](https://keras.io/api/layers/attention_layers/attention/) | [Decoder's Attention](https://pytorch.org/tutorials/beginner/deploy_seq2seq_hybrid_frontend_tutorial.html#define-decoders-attention-module) | [Effective Approaches to Attention-based Neural Machine Translation](https://arxiv.org/pdf/1508.04025.pdf) | 
| MultiHeadAttention | [MultiHeadAttention layer](https://keras.io/api/layers/attention_layers/multi_head_attention/) | [MultiheadAttention layer](https://pytorch.org/docs/stable/generated/torch.nn.MultiheadAttention.html#torch.nn.MultiheadAttention) | [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf) |

Reading list recommendation:
- [What is the difference between Luong attention and Bahdanau attention?](https://stackoverflow.com/questions/44238154/what-is-the-difference-between-luong-attention-and-bahdanau-attention)
- [The illustrated Transformer](http://jalammar.github.io/illustrated-transformer/)

**NOTE**: Please comment any attention mechanism not included in this post as well as paper, implementations.