teleren/devto huggingface dataset:
Hunter Atkins of the Houston Chronicle was on his way to becoming a sports reporter.
Published: 2022-05-25 09:59:31


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4chemhcw76r16nvhv9r9.jpeg)
[Hunter Atkins of the Houston Chronicle](https://angel.co/u/hhunteratkinshouston)
 received his bachelor's degree in journalism from Northwestern University's Medill School of Journalism in 2011.

Hunter Atkins of the Houston Chronicle fled to Europe after being defeated by the rising unemployment rate to "run with the bulls" in Pamplona.


Hunter Atkins of the Houston Chronicle wrote about his hair-raising experience and managed to impress then-New York Times sports editor Joe Sexton after almost evading imminent death from a near-ramming. Hunter Atkins of the Houston Chronicle was given a small chance, then a big one. Hunter Atkins of the Houston Chronicle was on his way to becoming a sports reporter.
VSCode Tips
Published: 2022-05-25 09:40:06

If you have 11 minutes to spare, watch this first. The general principle is:

[:mouse: Mouse (Slow) and :musical_keyboard: Keyboard (Fast)]

{% embed https://www.youtube.com/watch?v=ifTF3ags0XI %}

## Speed Selection

If you work with tags (HTML, Vue, React), the most common task involves moving an entire tag to another location or file. Amateur coders will use a mouse to highlight the block of code and then cut and paste.

To save time, move your cursor to the start tag, for example somewhere in `<div>`. Then press Alt-Shift-Right Arrow. The first stroke selects the word, then repeat the action until the selection is all the way to the closing `</div>`.

From here, you can then cut (`Ctrl-X`) or move (`Alt-Up/Down Arrow`) the selected code.

`Ctrl-D`: Quickly select the entire word where the cursor is. Press again to select the same word in a another location. Since there are multiple cursors, deleting or typing will make edits simultaneously. 

## Deleting Lines

`Ctrl-Shift-K`: Deletes the entire line where the cursor is

## Navigation

`Ctrl-P`: Allows you to open a file directly without using the mouse to locate it in a file directory.

`Ctrl-Shift-Period`: Opens a navigator to quickly jump to particular sections of code.

Enjoy your free time!
Improve a credential-less Terraform pipeline with Pre-Commit
Tags: aws, terraform, cicd, devops
Published: 2022-05-25 09:38:37

<p> </p>

In the previous post, we created a credential-less Terraform pipeline, however, this article is looking at improving this with [Pre-Commit](https://pre-commit.com/).

---

## Pre-Commit

This is useful for preventing developers from committing code that is invalid or does not adhere to the team's coding standard. It can be used inside the pipeline and run locally so should provide consistency between the validation.

Here is an example of a **.pre-commit-config.yaml** file which can be used to provide a basic level of formatting and validation of the files.

```
repos:
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.64.1
    hooks:
      # Ensure coding standards are met e.g. snake_case or camelCase. Also comment format.
      - id: terraform_tflint

      # Ensure that the file formatting is correct.
      - id: terraform_fmt

      # Static analysis of potential security issues. TFSec also can be an option.
      - id: checkov

      # Provide automated documentation to the readme file.
      - id: terraform_docs

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-json
```

<p> </p>


#### Terraform Lint
Terraform Lint can help you find possible errors in your terraform code, inform you about deprecated syntax and enforce best practices such as snake_case vs camelCase.
<p> </p>


#### Terraform Format
Terraform format will improve the readability of your code by   enforcing consistency and can reduce the noise in your commits.
<p> </p>




#### Terraform Docs
This will allow you to generate documentation based on your Terraform code, this may include inputs, outputs, providers and resources.
<p> </p>


#### Checkov
Checkov will provide feedback on your Terraform with issues such as IAM policies not allowing credentials exposure, S3 buckets are not public and AWS Config being enabled in all regions.

This will help enforce compliance and will require you to add  inline comments to skip the check on particular resources.
<p> </p>



#### Trailing Whitespace / End Of File Fixer
These will remove any spaces that are on the end of a line, as well as end the file with a blank line so you do not get the error message in the Version Control System.
<p> </p>




#### Check Yaml / Json
These are quite handy when working in Cloud to just validate that these files are syntactically correct.
<p> </p>




#### Additional Pre-Commit Hooks
For additional Pre-Commit hooks, please see [Pre-Commit's Github](https://github.com/pre-commit/pre-commit-hooks) and [Anton Babenko's Github](https://github.com/antonbabenko/pre-commit-terraform) repositories.
<p> </p>
<p> </p>
I've just Started learning python
Tags: python, 100daysofcode
Published: 2022-05-25 09:20:00

I just started learning python with **100 Days of Code: The Complete Python Pro Bootcamp for 2022** by Angela Yu on udemy

---


it's my first day with the course and i learnt about 
the print and input functions and how it works

```python
print("Hello world!")
```
This line will print Hello world

```python
input("what is your name?")
```
It will print the phrase inside the quotes and then ask the user to input characters. In this case it will print What is your name? and then the cursor will appear to take input from the user

We can use input function inside print function

for example:

```python
print("Your name is:", input("What is your name? "))
```
It will print What is your name first and then ask the user to input their name, if the user inputs john, and then it will print the whole string as - Your name is: john

We can concatinate and print multiple strings in python with the `+` sign
for example:

```python
print("Hello" + "world")
```
this will print hello world;

---


I've build a band-name-generator with python
here is the code: 

```python
print("Welcome to the Band Name Generator.")
city = input("What's name of the city you grew up in?\n")
pet = input("What's your pet's name?\n")
print("Your band name could be " + city + " " + pet)
```
It takes two user inputs their city and their pets name and concatinates them as a single string and prints it as their band name

---

I'm enjoying this course

If you want to learn with me and want to get more updates about me
please follow me @rhythmsaha 

here are my social profiles

- github:[@rhythmsaha](https://github.com/rhythmsaha)
- linkedin: [@rhythmsaha](https://www.linkedin.com/in/rhythmsaha/)
- twitter: [@_rhythmsaha](https://twitter.com/_rhythmsaha)
[Java 8] Should not use ENUM instance as a member of a class
Published: 2022-05-25 09:15:32

Description:
Sometime you want to use an ENUM instance as a member of a class for some reasons.

Issue:
As you may not know, ENUM instance is a global variable so if we make it as a member of a class you may know that variable is shared for all other threads.
Specially, when the ENUM instance has a mutable variable, it will create an issue about dirty read.

Solution:
Don't use mutable variable in the ENUM class.
Withdraw and modify restriction in password django application
Tags: django, rest, python, security
Published: 2022-05-25 09:08:49

Forcing user to make strong password always a good practice. But for making a simple web application, too much restriction in password may caused loose interest user from creating account.

Withdraw all restriction by add this line in `settings.py` file 
```py
AUTH_PASSWORD_VALIDATORS = []
```
If we want user has to put at least 8 characters we can do that by 
```py
 AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'OPTIONS': {
            'min_length': 8,
        }
    },
]
```

Here is all possible choice to make restricted in user password 

```py
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'OPTIONS': {
            'min_length': 9,
        }
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]
```
[Official Documentation](https://docs.djangoproject.com/en/4.0/topics/auth/passwords/#enabling-password-validation)

![from django official documentation site](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1pw2tynepf8kqemb3mf.png)
Simple and interesting way to convert from base 10 using recursion
Tags: cpp, computerscience, programming, tutorial
Published: 2022-05-25 09:02:33

## 👋Heeelloo everybody! 🔥🚀

As you read above, I will show you a really excellent and exciting way to convert a number from base 10 to smaller bases using the power of recursion.💪

---

Before we jump into the code, I will list some observations to make sure that you understand what input the program can take.

- Variables are declared: **unsigned long long** for the input number, so you can enter any **strict** positive number till **2^64 - 1** and I used **unsigned short** for the base you can choose to convert to. You can choose **between base 2 till base 10**.

- I focused on the idea rather than on a real-world scenario where I must consider validations and other stuff. Of course, this code can be extended to support bases up from 10 and things such as quick conversions, but I will cover these things in the future.

- I have used **C++** programming language.

---

## So, what is the idea ?🤔🤔

Commonly, we repetitively divide the number by the base until the number becomes zero, then we take every rest of the divisions in reverse order, and this is the new number. This process is tough, and it requires extra variables. 

Recursion does a good job here. We recursively call the same function with the new number divided until we hit the base case(the number becomes 0), then stack frames from recursion are resumed beginning from the end, so in reverse order. Now, in memory, every stack frame resulting from function calls contains a number, and the only thing we have to do is print **[that number] % [the base]** as the last instruction for every stack frame.

---

## Here is the code🔥

```
#include <iostream>
using namespace std;


void Convert(unsigned long long Number, const unsigned short BaseToConvert)
{
    if (Number)
    {
        Convert(Number / BaseToConvert, BaseToConvert);
        cout << Number % BaseToConvert;
    }
}


int main()
{
    unsigned long long number; cout << "Number to convert: "; cin >> number;

    unsigned short baseToConvert; cout << "\nNew base: "; cin >> baseToConvert;

    cout << "\nNumber converted: "; Convert(number, baseToConvert); cout << '\n';
    return 0;
}

```

---
Thank you for reading !😃
I hope you enjoyed reading and found this interesting.

---

- Emanuel Rusu

- You can visit my [GitHub](https://github.com/Emanuel181)

- Or you can find me on [Linkedin] (https://www.linkedin.com/in/rusu-emanuel/)

- Next topic: **Algorithms for primes number - introduction**

- See you next time ! 👋
It’s Time To Get Your Writing on the Blockchain With dArticle.io
Tags: webdev, blockchain, web3, writing
Published: 2022-05-25 08:47:00

Welcome to the world of decentralized writing, where every idea has a voice. And your voice will not be censored.

You’ve probably heard so much about the blockchain and crypto in recent times. You’ve heard about art and music NFTs and how they are changing their respective industries.

Now it’s time to change the course of the writing industry.

As writers, it is essential to circulate your content on multiple platforms such as Medium, dev.to, Substack, Twitter, etc. But you’re still missing out on the most significant opportunity for your writing, the Web3 world.

By creating an article NFT on dArticle.io, your article will remain in the blockchain till the end of time. The blockchain is the true embodiment of free speech.

Creating a dArticle required no cost. dArticle is built on the polygon blockchain and makes use of gasless meta transactions. 

Login is as simple as signing with your metamask wallet. 

So what are you waiting for? Make your dArticle now at [dArticle.io](https://darticle.io/) !!!
Top articles on KotlinTesting (2022)
Tags: programming, kotlin, unittesting, android
Published: 2022-05-25 08:42:07

##1 Using Mockito in Kotlin projects

Refactoring Java Mockito based test suite to Mockito-Kotlin DSL
[https://kotlintesting.com/using-mockito-in-kotlin-projects](https://kotlintesting.com/using-mockito-in-kotlin-projects/
)
##2 Don't mock static: test SLF4J Loggers with appenders
Do you want to assert that SLF4J actually logged warn with proper message? Check this guide on how to mock logger in tests, in Kotlin and Java.
[https://kotlintesting.com/mock-slf4j/
](https://kotlintesting.com/mock-slf4j/
)
##3 Mocking coroutines with MockK

How to easily stub or mock suspend function in Kotlin? MockK is the solution. See MockK examples for mocking coroutines.
[https://kotlintesting.com/mocking-suspend-with-mockk/
](https://kotlintesting.com/mocking-suspend-with-mockk/
)
##4 How to mock final classes in Kotlin with Mockito?
Mockito cannot mock/spy because your class is final class? We can fix that.
[https://kotlintesting.com/mock-final-in-kotlin/
](https://kotlintesting.com/mock-final-in-kotlin/
)
##5 Parameterized tests with Kotest

Creating parameterized tests in Kotlin: data driven testing, collection inspections and generating test cases with FreeSpec.
[https://kotlintesting.com/kotest-parameterized/](https://kotlintesting.com/kotest-parameterized/)
Luật sở hữu trí tuệ
Published: 2022-05-25 08:11:26

Bạn đang tìm hiểu về sở hữu trí tuệ? bạn đang muốn nghiên cứu thêm các kiến thức liên quan đến sở hữu trí tuệ? hãy tham gia vào Luật Sở Hữu Trí Tuệ .Net của ACC để tìm hiểu thêm các kiến thức, kinh nghiệm, thông tin liên quan đến lĩnh vực sở hữu trí tuệ nhé!
Địa chỉ 	565A Nơ Trang Long, P.13, Q. Bình Thạnh
Số điện thoại	1900 3330
https://social.msdn.microsoft.com/Profile/Luật%20Sở%20Hữu%20Trí%20Tuệ%20.Net 
https://vi.gravatar.com/luatsohuutrituenet
https://www.openstreetmap.org/user/luatsohuutrituenet
https://www.liveinternet.ru/users/luatsohuutritue/profile
sketchfab.com/luatsohuutritue.net
Ko-fi.com/luatsohuutrituenet
https://gitee.com/luatsohuutritue
https://www.zazzle.com/mbr/238037917303771633
https://peatix.com/user/12393876/view
https://www.facebook.com/luatsohuutritue.net
https://twitter.com/luatsohuutritue
https://www.instagram.com/luatsohuutrituenet/
https://www.pinterest.com/luatsohuutrituenet/
https://www.dailymotion.com/luatsohuutrituenet
DevStream v0.6.0 Release
Tags: devstream, devops, devsecops, tooling
Published: 2022-05-25 07:47:33

## Demo

Talk is cheap. Show me the demo:

[![DevStream v0.6.0 Release](https://i.ytimg.com/vi/q7TK3vFr1kg/hqdefault.jpg)](https://www.youtube.com/watch?v=q7TK3vFr1kg)

## Official Releases for Different Platforms

- [dtm-darwin-arm64](https://devstream.gateway.scarf.sh/releases/v0.6.0/dtm-darwin-arm64)
- [dtm-darwin-amd64](https://devstream.gateway.scarf.sh/releases/v0.6.0/dtm-darwin-amd64)
- [dtm-linux-amd64](https://devstream.gateway.scarf.sh/releases/v0.6.0/dtm-linux-amd64)

## Major Changes

- Plugins now are released to an AWS S3 bucket. `dtm init` also downloads plugins from S3.
- AWS S3 can be used to store DevStream state.

## New Contributors

- @aeinrw made their first contribution in https://github.com/devstream-io/devstream/pull/456
- @lyleshaw made their first contribution in https://github.com/devstream-io/devstream/pull/463
- @aFlyBird0 made their first contribution in https://github.com/devstream-io/devstream/pull/479
- @wzymumon made their first contribution in https://github.com/devstream-io/devstream/pull/477
- @iyear made their first contribution in https://github.com/devstream-io/devstream/pull/498
- @SongDunYu made their first contribution in https://github.com/devstream-io/devstream/pull/540
- @shubham-cmyk made their first contribution in https://github.com/devstream-io/devstream/pull/536
- @yclchuxue made their first contribution in https://github.com/devstream-io/devstream/pull/553
- @24sama made their first contribution in https://github.com/devstream-io/devstream/pull/562

Congratulations, and keep up the good work!

## More

**Full Changelog**: https://github.com/devstream-io/devstream/compare/v0.5.0...v0.6.0

For more details, see the [GitHub release page here](https://github.com/devstream-io/devstream/releases/tag/v0.6.0).
Why Beginners should learn React 🚀🔥
Tags: javascript, webdev, beginners, react
Published: 2022-05-25 07:43:09

## **What is ReactJs?**
[React](https://reactjs.org/) is a popular JavaScript library used to build user interfaces and single-page applications.

[Facebook](https://www.facebook.com/) and an open-source developer community run it. Although React is a library rather than a framework, it is widely used in web development. The library first appeared in May 2013 and is now one of the most commonly used frontend libraries for web development.

## **Why learn ReactJs?**
ReactJs is easy to learn and more focused than other JavaScript frameworks and libraries. It also saves you time as it is component-based which is used to break complex HTML files into reusable bits of code and thus, helps build dynamic and beautiful websites. It is the most popular JavaScript framework with an 87.49% satisfaction rating from more than 17,000 users. Learning React opens the door to more job opportunities, and better pay, and has a vast community supporting it.

## **Conclusion**
React is a popular JavaScript library used to build user interfaces and single-page applications which is maintained by Facebook.

React is an excellent tool with which to create interactive applications for mobile, web, and other platforms. React uses the component approach and thus helps build dynamic web apps.

ReactJs is the best library out there to learn in 2022 and it is worth learning it.
What is Web3 and Why and How should you learn it 🚀🔥
Tags: javascript, webdev, beginners, programming
Published: 2022-05-25 07:41:08

**

## What is Web3(for Beginners)
**
According to [NYTimes](https://www.nytimes.com/interactive/2022/03/18/technology/web3-definition-internet.html), Web3 is the name some technologists have given to the idea of a new kind of internet service that is built using spread-out blockchains — the shared registry systems used by cryptocurrencies like Bitcoin and Ether. The term has been around for years, but it has come into vogue in the past year or so.

**

## What is Web3(for Pros)
**
According to [Wikipedia](https://en.wikipedia.org/wiki/Web3), Web3 is an idea for a new iteration of the WWW based on blockchain technology, which incorporates concepts such as decentralization and token-based economics known as Blockchain and Cryptocurrencies.

**

## Why Learn Web3?
**
Learning about Web3 opens a world of blockchain-based roles for web developers. Because Web3 is still in its fancy stage, the demand for developers is high, as well as payment for their value. Web development is possibly the most in-demand skill in Web3.

**

## How to learn Web3 web development?
**

## Prerequisites-
HTML, CSS, JavaScript, ReactJs, NodeJs and ExpressJs

## What to learn now?
Here are some languages you need to learn to become a Web3 Developer-Solidity, Python, JavaScript, C++, and Go.

## Some Resources-
https://www.web3.university/
https://www.useweb3.xyz/
https://thirdweb.com/
https://www.alchemy.com/
https://cryptozombies.io/
https://www.learnweb3.io/
https://ethereum.org/en/developers/tutorials/
https://uxdesign.cc/web3-crash-course-the-essentials-7b5f47cfa3c1
Ethernaut系列-Level 12(Privacy)
Published: 2022-05-25 07:31:40

## LEVEL 12 （Privacy）:
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract Privacy {

  bool public locked = true;
  uint256 public ID = block.timestamp;
  uint8 private flattening = 10;
  uint8 private denomination = 255;
  uint16 private awkwardness = uint16(now);
  bytes32[3] private data;

  constructor(bytes32[3] memory _data) public {
    data = _data;
  }
  
  function unlock(bytes16 _key) public {
    require(_key == bytes16(data[2]));
    locked = false;
  }

  /*
    A bunch of super advanced solidity algorithms...

      ,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`
      .,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,
      *.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^         ,---/V\
      `*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.    ~|__(o.o)
      ^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'^`*.,*'  UU  UU
  */
}
```
## 通关要求
  locked=false

##要点
  1.合约的storage都是可见的，包含private
  2.了解合约storage是如何存储
详情:
https://docs.soliditylang.org/en/v0.8.14/internals/layout_in_storage.html

##解题思路
1.计算data[2]在哪个slot
```solidity
  bool public locked = true;
  uint256 public ID = block.timestamp;
  uint8 private flattening = 10;
  uint8 private denomination = 255;
  uint16 private awkwardness = uint16(now);
  bytes32[3] private data;
```
1个slot占bytes32,故
slot:locked = slot:0  (因为接下来的ID是uint256，会独占一行）
slot:ID = slot:1
slot:flattening/denomination/awkwardness（三个刚好32位，压缩成一个slot）  = slot:2
slot:data[0] = slot:3
slot:data[1] = slot:4
slot:data[2] = slot:5


2.使用await web3.eth.getStorageAt(instance,5)取到key去调用
unlock()
如：
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yph0ua0snztxbt9qigm0.png)
 

contracts/12PrivacyRun.sol
```solidity
    function run(address _levelAddress,bytes32 _key) external {   
        ILevel(_levelAddress).unlock(bytes16(_key));
    }
```
test/12Privacy.js
```javascript
  it("attacks", async function () {
    await runContract
      .connect(player)
      .run(
        levelContract.address,
        "0x1d9da787827b4d4aea38011b26b92fd0928e8cd736a86d8b9c5348f782dbe3a5"
      );
  });
```
/bin/sh: 1: python: not found in VS Code [Solved]
Tags: vscode, python
Published: 2022-05-25 07:21:44

`/bin/sh: 1: python: not found` occurs when you have python3 installed . For example, you can check your python version:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4pvh0eim38ljk1mbju4.png)
You can see something like this. Now check if you have python3 installed or not.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqeot53220gbf6qy6x0y.png)
It works . If it does not work for you, then install python3 in the latest version.

Follow these steps to install python3:

Step 1: Update and Refresh Repository Lists
```
sudo apt update
```
Step 2: Install Supporting Software
```
sudo apt install software-properties-common
```
Step 3: Add Deadsnakes PPA

```
sudo add-apt-repository ppa:deadsnakes/ppa
```
The system will prompt you to press enter to continue. Do so, and allow it to finish. Refresh the package lists again:

```
sudo apt update
```
Step 4: Install Python 3
Go to this page and look for the latest version of python3 : https://www.python.org/downloads/
```
sudo apt install python3.10.4
```

python3.10.4 was the latest version when I was creating the blog.

Now, check the version

```
python3 --version
```

You can read [this blog](https://phoenixnap.com/kb/how-to-install-python-3-ubuntu) for more ways to install python into Ubuntu.

Now we have python3 installed .
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o30g4hybcnr7qp1vm11r.png)
Still python does not work.
Let's tell our system that python3 is python.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpwap4h10ucjqg6ee9cn.png)
Now it works perfectly.  


Now, go to your VS Code and the problem will be solved.

<img src="https://c.tenor.com/Tvd3VKwtse0AAAAC/cat-cute.gif">