teleren/devto huggingface dataset:
what's WSLg
Published: 2021-10-09 09:47:55

<sub>Photo by <a href="https://unsplash.com/@fakurian">Fakurian Design</a> on <a href="https://unsplash.com/s/photos/sound-wave">Unsplash</a></sub>

[This blog post](https://arstechnica.com/gadgets/2021/10/the-best-part-of-windows-11-is-a-revamped-windows-subsystem-for-linux/) highlights the new features in WSLg coming with Windows 11.

The big news is ... WSL now supports graphics and sound !

[This blog post](https://devblogs.microsoft.com/commandline/wslg-architecture/) explains how it works.

[Scott Hanselman has made a video](https://www.youtube.com/watch?v=b1YBx1L8op4) to present this.


Hope this helps !
How to Get list of All Environment Variables' key Used in a Golang Module or Project
Tags: go, beginners, tutorial, programming
Published: 2021-10-09 09:29:32

In this article we're about to write a program which helps us to get the all environment variables which is used in your project.

Why I created this program?
So recently in my current company we've decided to separate the modules which is not dependent on anycode, because the project structure was become larger that's why we decided to separate modules.

We moved code successfully but now comes problem how will you gonna get how many environment variables that separated module needed to run without causing any runtime issue.

So we decided to write a script to get the list of used environment variables used in that module.

How we are going to achieve this let's see the steps we needed to get the list of environment variables from module

1. We're about to use command line argument which is going to be 
   path of the module or project
2. Reading module repository recursively using the filepath.Walk() 
   function and only extracting the golang files full path.
3. Here comes the main part, we're going to use regular expression 
   for that because we know pattern of accessing environment 
   variables in golang which is os.Getenv() function.

So let's start Writing Code Now:


Step 1.

``` ```
	dirPath := os.Args[1]

	if &dirPath == nil {
		fmt.Println("Argument can't be nil..")
		os.Exit(2)
	}```


Step 2.

```err := filepath.Walk(dirPath,
		func(path string, d os.FileInfo, err error) error {
			if err != nil {
				return err
			}

			f := strings.Split(d.Name(), ".")
			if f[len(f)-1] == "go" {
				dir = append(dir, path)
			}
			return nil
		})
	if err != nil {
		fmt.Println("Error to open directries..")
		return
	}```


Step 3.

```for _, f := range dir {
		file, err := os.Open(f)
		if err != nil {
			e := ErrorArray{
				Err:  err,
				File: f,
			}
			ErrArr = append(ErrArr, e)
		}

		scanner := bufio.NewScanner(file)
		scanner.Split(bufio.ScanLines)
		for scanner.Scan() {
			re := regexp.MustCompile(`os.Getenv(.*)`)
			en := re.FindString(scanner.Text())
			if len(en) == 0 {
				continue
			}
			if strings.Contains(en, "+") {
				n := strings.Split(en, "+")
				for _, v := range n {
					if strings.Contains(v, "os.Getenv") {
						str := Replaced(v)
						_, exists := MapArr[str]
						if exists {
							MapArr[str]++
							continue
						}
						MapArr[str] = 1
					}

				}
				continue
			} else if strings.Contains(en, ",") {
				n := strings.Split(en, ",")
				for _, v := range n {
					if strings.Contains(v, "os.Getenv") {
						str := Replaced(v)
						_, exists := MapArr[str]
						if exists {
							MapArr[str]++
							continue
						}
						MapArr[str] = 1
					}

				}
				continue
			}
			str := Replaced(en)
			_, exists := MapArr[str]
			if exists {
				MapArr[str]++
				continue
			}
			MapArr[str] = 1
		}
		file.Close()
	}```

If Have Any Queries Then Lemme Know
Read More : https://kdsingh4.blogspot.com/2021/10/how-to-get-list-of-all-environment.html

Also Subscribe My Channel To Support Me : https://www.youtube.com/channel/UCXhmNqWQ50zitqIdTgS7s8Q
Hack WiFi Passwords using Kali
Published: 2021-10-09 09:19:34

How to Hack WiFi passwords [Using Kali Linux]

　ツ

Tools need to be downloaded:-
Hcxdumptool
Hcxpcaptool
Hashcat
Steps:-
1] Request PMKID from the router
Unlike older techniques where you had to wait until a user connected to the access point so that you can capture the 4-way handshake that is of EAPOL.This new method for finding out the password credentials does not require that anymore. The attack works on the RSN-IE or Robust Security Network Information Element. It only uses one frame which it requests from the wireless router.
2] Install Hcxdumptool & Hcxpcaptool
This is a tool that will help you to capture the PMKID packet from the access point. After capturing the frame, it can also dump it into a file for you. Below are some features of Hcxdumptool:
Can easily capture identities and usernames from a WLAN.Can easily capture passwords, plain master keys, handshakes and PMKIDs from traffic on WLAN.
After installing this tool run the below command in the CLI.
$ ./hcxdumptool -o test.pcapng -i wlp39s0f3u4u5 –enable_status
The command displayed above will dump the frame to a file.
3] After doing the above step now you will need to extract some contents from the frame file. This will be in the pcapng format. You can easily convert this into a hash format which the popular program ‘Hashcat‘ can accept. Use the below command to extract the pcapng file.
$ ./hcxpcaptool -z test.16800 test.pcapng
4] Using Hashcat to Crack the Wifi Password (WPA PSK Pre-Shared Key Recovery)
Hashcat is a tool used a lot in the security and penetration testing field. It is used by both hackers and researchers for finding out passwords by cracking their hash. After finding out the hash of the password you can enter the password in hashcat and it will find it out for you. It will take some time depending on how complex the password is of the wireless network. Enter the cmd below and run hashcat.
$ ./hashcat -m 16800 test.16800 -a 3 -w 3 ‘?l?l?l?l?l?lt!’
Now you need some brain, basic knowledge and patience
Learn Python-Django , Node-Express , React or Vue
Tags: python, javascript, beginners, codenewbi
Published: 2021-10-09 09:13:37

Hi my dev community, 

I am a web developer for more than 3.5 years and before that I was a mechanical engineer. Though I was interested in software development from very early age , due to some personal and financial circumstances, i was not able to pursue the software Development field.

But after doing approx 3 years of mechanical job , I finally decided to move to software development field.

I learn everything from online resources (Youtube , stackoverflow.com,  github, documentation of different libraries and frameworks, medium posts , also specially dev.to posts )

But when learning online , the main disadvantages were , not having any path or guidance in the learning process. There is too much info , languages ,frameworks,  libraries ,and above all , the way to implement things also vary a lot.

So i decided to make a group for young professionals,  who are currently entering into the market . And those want some guidance in learning different things or even guidance. 

I have to say that , I am not an expert in the field . What my intention is , to help others who needed help in different phases of developer life. 



I will create the group with  these points in mind:

1. Everybody is welcome here , even if you have no coding experience. I will try to help you best of my abilities. 

2. I will try to do weekly 2 online classes for those who have very little experience or no experience in software development.

3. Totally free for ever. no money involvement for ever.

3. Regular guidance for those , who really need to learn from the scratch . And occasional online group meeting , meet-ups for others.

4. I will help others on technologies like : python ,Django , javascript,  Node.js , React.js,  Vue.js , mysql,  pgsql , mongo , docker , redis  etc 

you can fillip this google form : https://forms.gle/kHULRAxb5jFABjQo7
or 
To contact me , sent an email to : subhadip1203dev@gmail.com

Upon seeing group members number , will decide to make whatsapp , slack or other group in future
Yup Schema for Nigeria Phone Mobile Number
Tags: react, javascript, yup, regex
Published: 2021-10-09 09:08:19

I was trying out Regex to validate Nigerian mobile numbers without the country code (+234). 
Here is what I came up with. 
Not sure if it is perfect though. Any other ideas?


```js
import * as yup from "yup";

/*
Regex to match Nigeria mobile number with the country code +234
It matches:
08053303925
09055303925
08145327190
*/
const phoneRegExp = /^([0]{1})[0-9]{10}$/

cconst schema = yup.object().shape({
  phone: yup.string().matches(phoneRegex, "Invalid phone number."),
});

export default schema;


```
Laravel Spatie Roles and Permissions Tutorial from Scratch
Tags: laravel, role, permission
Published: 2021-10-09 08:55:08

Today our leading topic is laravel 8 roles and permissions tutorial. In this article, we will implement a laravel 8 spatie user roles and permissions tutorial. i explained simply step by step laravel 8 spatie/laravel-permission. step by step explain laravel 8 acl tutorial.

we are using spatie github package for roles and permissions in laravel 8 application. just follow bellow step to create acl in laravel 8.

Spatie role permission composer package provide way to create acl in laravel 8. they provide how to assign role to user, how to assign permission to user and how to assign permission assign to roles. i will write step by step creating roles and permissions in laravel 8 application.

I also posted on tutorial for ACL User Roles and Permissions using entrust package, you can see here : Laravel - User Roles and Permissions (ACL) using entrust package.

Roles and Permissions through you can create several types of users with different role and permission, i mean some user have only see listing of items module, some user can also edit items modules, for delete and etc.
In this examples i created three modules as listed bellow:

User Management

Role Management

Product Management

After register user, you don't have any roles, so you can edit your details and assign admin role to you from User Management. After that you can create your own role with permission like role-list, role-create, role-edit, role-delete, product-list, product-create, product-edit, product-delete. you can check with assign new user and check that.

You need to just follow few step and you will get full example of ACL:

https://www.codecheef.org/article/laravel-spatie-roles-and-permissions-tutorial-from-scratch
Python callable()
Tags: python, programming, codenewbie, tutorial
Published: 2021-10-11 13:52:59

---
title: Python callable()
published: true
date: 2021-10-09 08:30:00 UTC
tags: #python #programming #codenewbie #tutorial
canonical_url: https://itsmycode.com/python-callable/
---

ItsMyCode |

The **`callable()`** function in Python returns **`True `** if the object passed appears to be callable. Otherwise, it returns **`False`**.

## callable() Syntax 

The syntax of the **`callable()`** method is 

```python 
**callable(object)**
```

## callable() Parameters

The **`callable()`** method can take only one argument, i.e., an object.

## callable() Return Value

The **`callable()`** function returns

- **`True `** – if the object appears callable
- **`False `** – if the object is not callable.

**Note:**  There may be few cases where **`callable()`** returns **True** , but the call to the object may fail. But in case if **`callable()`** returns **False** , the calling object will never succeed.

## **Example 1:**  How does callable() works?

Here, the object  **`number `** is not callable. And, the object  **`getData `** appears to be callable (but may not be callable).

```python 
# returns false as the object of integer is not callable
number = 10
print(callable(number))

def getData():
  print("Hello World")

# returns true as the variable is callable
obj = getData
print(callable(obj))
```

**Output**

```python 
False
True
```

## Example 2: When an Object is callable 

The built-in **`callable()`** method checks if the argument passed is either of the below two cases:

- An instance of a class having a _` __call__ `_ method.
- It is of a type that indicates callability, such as in functions, methods, etc. or has a non-null _`tp_call `_(c struct) member.

```python 
# Python program to demonstrate callable()
class Test:
  def __call__ (self):
    print('Hello World !!!')

# Suggests that Test class is callable and returns True
print(callable(Test))

# This proves that class is callable
TestObject = Test()
TestObject()
```

**Output**

```python 
True
Hello World !!!
```

## Example 3: When an Object is NOT callable 

The **`callable()`** method returns **True** , suggesting that the  **Test**  class is callable, but the instance of  **Test ** is not callable, and it returns a **TypeError: ‘Test’ object is not callable**

```python 
# Python program to demonstrate NOT callable()
class Test:
  def printdata(self):
    print('Hello World !!!')

# Suggests that Test class is callable and returns True
print(callable(Test))

# The object will be created but returns error while calling
TestObject = Test()
TestObject()
```

**Output**

```python 
True

Traceback (most recent call last):
  File "c:\Projects\Tryouts\main.py", line 11, in <module>
    TestObject()
TypeError: 'Test' object is not callable
```

The post [Python callable()](https://itsmycode.com/python-callable/) appeared first on [ItsMyCode](https://itsmycode.com).
Enhanced social share card | @dsabyte.com
Tags: react, node, javascript, webdev
Published: 2021-10-09 08:06:44

## Share blog after writing it, with just one click
![Alt-Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oz8dwgubf9e9oyif44hd.png)

Previously, there was just social media icons, but now the card has a personalize message.
Part 2 - Dockerise your Blockchain app
Tags: aws, blockchain, cloud, docker
Published: 2021-10-09 08:00:55

---
title: Part 2 - Dockerise your Blockchain app
published: true
description: You have created a blockchain. Now let's dockerize it!
tags: aws, blockchain, cloud, docker
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vv865kzcah8f7lc03xc7.jpg
series: Your very own blockchain
---

In the previous article, we've built an Ethereum blockchain on AWS using Ganache-CLI. The blockchain is up but it requires to be manually started with your terminal tab always running `ganache`. What if we can have the blockchain running in background on the EC2 server, and add a custom domain to its IP address, and then secure it with an API token. So that's what we will be working on in this part.

Here is where Docker comes in.

## Containerise your blockchain app

Docker is useful when you need to run an app pre installed with all its dependencies.

1. `ssh` into your EC2 instance and install docker by running these commands
    ```shell
    $ sudo apt-get update

    $ sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg \
        lsb-release

    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

    $ echo \
    "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

    $ sudo apt-get update

    $ sudo apt-get install docker-ce docker-ce-cli containerd.io

    $ sudo docker run hello-world
    ```
    You should be able to see this output after the last command. 

    ![Docker hello world](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e41ags1zhnoyd1d32i7o.png)

2. Create a Dockerfile

    Create a new file named `Dockerfile` at your current folder. In the file add these lines,

    ```dockerfile
    # node:alpine will be our base image to create this image
    FROM node:alpine

    # Set the /app directory as working directory
    WORKDIR /app

    # Install ganache-cli globally
    RUN npm install -g ganache-cli

    EXPOSE 8545

    # Set the default command for the image
    CMD ["ganache-cli", "-h", "0.0.0.0", "--port", "8545", "--networkId", "5777"] 
    ```

3. Build and run Dockerfile

    We are now ready to build and run the blockchain in the background!

    ```shell
    # Builds the docker image with the name ganache
    sudo docker build -t ganache .

    # runs the app. -d will detach the app so that it will in background
    sudo docker run -d -p 8545:8545 ganache

    # checks if ganache has run successfully
    sudo docker logs ganache
    ```

## Your app is up and running!

Visit your AWS public IP on port 8545 (`http://<YOUR_EC2_IP_ADDRESS>:8545`).
Hide node_module from side menu of vscode
Published: 2021-10-09 07:58:06

Most of the time we don't' need to look at node_module, But sometimes we see that folder is opened and we just need to collapse it again.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jtgbq4gvai5y68s0rs4.png)

There is a vscode extension for hiding file and folders from the context menu. Just right click on file/folder and make them hide.
https://marketplace.visualstudio.com/items?itemName=chrisbibby.hide-node-modules

Be happy now ;)
Is Microservices a good choice ?
Tags: help, discuss, microservices, architecture
Published: 2021-10-09 07:41:00

# Context

I work on a big 10 year old application (500k blocs of code) with some really bad choices: 
- No unit tests
- an Anemic architecture 
But in a great company:
- A QA team who test regressions
- A small team (5 dev only)
- Times to make clean code
- A project of rewriting the application with new technologies
As you imagine, the QA teams are a big bottleneck and everything that can reduce test regression is good.

# The rewriting

With rewriting the CTO wants :
- unit tests :)
- A Microservices architecture with :
    - One service by feature with duplications between services
    - A single database
    - A single repository, but one makefile by service

# What's I think

I agree that Microservice can avoid regression, but I think it's too complicated. I don't want to have to manage database conflicts or update 200 services each time I change the database...
My guess is, with: 
- Unit tests
- Open/Close principle
- DDD
- And maybe SOA (1 service by bound context)
We can almost avoid regressions and it will be a better start if we really need microservices. What do you think?
How to Monitor If an Image Loads Completed - HTML and Javascript Tips

Tags: javascript, webdev
Published: 2021-10-09 07:28:25

function handleImageLoad(imgDom, fn) {

if (imgDom.readyState == "complete") {

fn.call(this);

} else {

imgDom.onreadystatechange = function() {

if (imgDom.readyState == "complete") {

fn.call(this);

}

}

} }


[Used Prado Diesel Right Hand](https://zamansafi.com/used-prado-diesel-right-hand/)

[Used Toyota Land Cruiser](https://zamansafi.com/used-toyota-land-cruiser/)
How To Gain Assignment Helper Malaysia


Tags: assignmenthelp
Published: 2021-10-09 07:25:41

Students are often confused about the hiring of an Assignment Helper Malaysia. There are hundreds of websites on the internet that claim to be the number one service, provider. How can they all be at number one? Scholars have this thought in their mind and they all need clarifications about the same. It is not possible to select any one portal when you have hundreds of websites in front of you.

https://www.assignmenthelppro.com/my/
Stuck using API's in react
Tags: react, ionic, javascript, webdev
Published: 2021-10-09 07:23:15

My question is how to fetch and render multiple level API calls.
for example, I called an api using axios, got an array of data. With that array of data got, again called the api's. The same things happens 3-4 times. 
The problem is not, how to render this data. But, at the last level, i have to render the data in the form of checkbox and radio. So how to save answers in that case.

You can understand it better with the code...

import {
  IonButton,
  IonCard,
  IonCardContent,
  IonCardHeader,
  IonContent,
  IonHeader,
  IonItem,
  IonPage,
} from "@ionic/react";
import axios from "axios";
import React, { useEffect, useState } from "react";
import { useParams } from "react-router";
import DisplayQuestion from "../Questions/DisplayQuestion";

const PerformChecklist = () => {
  const checkId = useParams();
  const [checklist, setChecklist] = useState({
    groupIds: [],
    id: "",
    title: "",
  });
  const [group, setGroup] = useState([]);
  const [question, setQuestion] = useState([]);
  const [choice, setChoice] = useState([]);
  // fix on which user the checklist is performed, userId
  // fix on which vehicle the checklist is performed., vehicleId.

  //   loading checklist data.
  useEffect(async () => {
    const response = await axios.get(`/checklist/${checkId.id}`);
    const checklistData = response.data.data;
    setChecklist({
      groupIds: checklistData.groupIds,
      id: checklistData._id,
      title: checklistData.title,
    });
  }, []);

  //   loading category data.
  useEffect(() => {
    checklist.groupIds.map(async (items) => {
      const response = await axios.get(`/group/${items}`);
      const groupData = response.data.data[0];
      console.log(groupData);
      setGroup((group) => [...group, groupData]);
    });
  }, [checklist]);

  //   loading question data.
  useEffect(() => {
    group.map((items) => {
      items.questionId.map(async (questionId) => {
        const response = await axios.get(`/question/${questionId}`);
        const questionData = response.data.data;
        setQuestion((question) => [...question, questionData]);
      });
    });
  }, [group]);

  useEffect(() => {
    question.map((items) => {
      items.choices.map(async (choiceId) => {
        const response = await axios.get(`/choice/${choiceId}`);
        const choiceData = response.data.data;
        setChoice((choice) => [...choice, choiceData]);
      });
    });
  }, [question]);

  return (
    <IonPage>
      <IonHeader className="ion-padding activityHeader">
        <h1>Perform Checklist</h1>
        <IonButton
          size="small"
          color="warning"
          routerLink="/performactivity"
          className="backButton"
        >
          Back
        </IonButton>
      </IonHeader>
      <IonContent>
        <h4>{checklist.title}</h4>
        <div></div>
      </IonContent>
    </IonPage>
  );
};

export default PerformChecklist;