teleren/devto huggingface dataset:
'secrets' module in Python.
Tags: python
Published: 2021-11-23 11:59:48

The secrets module is useful for generating random numbers which might be used as a password, security tokens etc. for the application. It is used to prevent against modifying cookies, forgery attacks. 

-
**Open the terminal and enter the command "python" **


```
python
``` 


![1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1637667027848/HS9tKxS4u.png)

-
**Import the secrets module**


```
import secrets
``` 


![2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1637667287698/i4MQDcwlK.png)

-
**To generate a random string of characters**


```
secrets.token_hex(16)
``` 

![3.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1637667498612/2rkttjwbt.png)

-
** The generated 16 digit string **


![4.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1637667624737/Rr9La1sP-.png)


## The above generated secret key could be used in a web application as shown below :


![5.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1637667932696/Qz8-HyjOV.png)


*Thanks for reading.*

Drop in your suggestions.

*Brickbats and Bouquets are welcome.*
What is Javascript?
Tags: javascript, beginners, programming, webdev
Published: 2021-11-23 11:18:04

I suppose it's your first time trying to read about how to code, unfortunately we will not talk about that. First of all you need to understand why JS is important and how to use JS in your daily routine.

When I started coding in JS, I realised that JS bring some new features and facilities than other languages, it's allow me to learn about algorithms and practice creating complex algorithms and run it easily with one command. Sincerely, I love JS and I usually use it when I want to learn using learning-by-doing paradigm. So, I strongly recommend you do the same as me, please you should love :).

Use cases
Javascript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive. OMG!!! client & server side, you could think that JS is the unique programming language you need to know as a developer, but NO 🥲 , JS is like a tool which you will use to fulfill some requirements for a specific task. Then, what's exactly client & server side?

Client side
![A dev beside a website,client side representation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1kba7w3vbq5tpxjjp5tx.png)

JS is usually used to allow you make interactive and modern websites, you can create HTML and prepare actions for each HTML element, it's can be really amazing since you can detect click on buttons and make different actions trying to improve UX. Here, there is some example code:

```
// detect click on some button
button.addEventListener("click", (ev) => {
   // make here your actions to make web page interactive
)};
```
Server side
![A mobile phone besides a server, server side representation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/01qxsk5pj8024vsvls1s.png)

JS is usually used with Node JS to create the most complex API with different models and different types of DDBB, getting from SQL as MySQL until NO-SQL as MongoDB

```
// detect get request
app.get(`${basic_uri}/customers`, customerController.getCustomers);

// controller function, located in other file
const getCustomers = (req, res, next) => {
  //make query to ddbb
}
```
As you can see above JS is a dynamic typed language, it's mean that data types are processing during execution time, so you will not worry about data types and how to use it. This is the reason why I really recommend JS as a first programming language since you can focus on algorithms and logic. Moreover, you have already seen that JS sintaxis is really clear and easier than other similar languages, maybe it's another reason to choose JS as a first programming language.

I hope you are enjoying reading the first post about JS, it's really important understand the use cases and how to work with JS. In the following posts we will talking about more exiting and difficult topics with more example code.
Build a “Smarter” DevOps Roadmap - The SMART Maturity Assessment Method
Tags: technology, managementandleaders, softwaredevelopment, devops
Published: 2022-07-17 13:53:43

---
title: Build a “Smarter” DevOps Roadmap - The SMART Maturity Assessment Method
published: true
date: 2021-11-23 11:14:05 UTC
tags: technology,managementandleaders,softwaredevelopment,devops
canonical_url: https://medium.com/geekculture/build-a-smarter-devops-roadmap-the-smart-maturity-assessment-method-bd7f39adfd93
---

[![](https://cdn-images-1.medium.com/max/2600/0*bqRDJFCorG-jDrfJ)](https://medium.com/geekculture/build-a-smarter-devops-roadmap-the-smart-maturity-assessment-method-bd7f39adfd93?source=rss-6e21f0d290d1------2)

A tool that helps you build your DevOps Roadmap

[Continue reading on Geek Culture »](https://medium.com/geekculture/build-a-smarter-devops-roadmap-the-smart-maturity-assessment-method-bd7f39adfd93?source=rss-6e21f0d290d1------2)
How to hack Chrome Dino Game using Javascript
Tags: javascript, programming, trick, tutorial
Published: 2021-11-23 11:11:57

#Intro
We all know the popular internet game of chrome which appears when there is no internet, there is however another way to access it that is by typing **chrome://dino** into the address bar.
So I have discovered a trick by which you can play that game without dying .

#Let's Start 
First of all go to chrome://dino
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c10qzab4szljf7k8s6j8.png)

Then right click anywhere from there select inspect![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8t83p944scilob1did6l.png)
 
From there go to console tab from the top ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bz5qpt9knx6vksqw0g4x.png)
 
and now type the following code and hit enter :
```javascript
Runner.prototype.gameOver = function(){}
```
After that when you will start playing the game you don't need to press any key and you will never die .

I hope you all enjoyed this post ! Be safe and do take good care of yourselves .

If you see this then comment "Yaay!"
Feel free to ask or give suggestions in the comments section.
Placeholder title
Published: 2021-11-23 10:50:21

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon 2021, please fill out all sections.)


### My Workflow
[Note]: # (Please make sure the project links to the appropriate GitHub Actions repository, and includes [an open source license](https://choosealicense.com/) and README.)


### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)


### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)


### Additional Resources / Info

[Note:] # (Be sure to link to any open source projects that are using your workflow!)

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any. )

[Reminder]: # (Submissions are due on December 8th, 2021 (11:59 PM PT or 2 AM ET/6 AM UTC on December 9th).
The Good Parts of AWS
Tags: aws, kubernetes, devops, webdev
Published: 2021-11-23 10:28:25

This amazing Digital Book authored by [Ex AWS engineers Daniel Vassallo and Josh Pshorr](https://gumroad.com/a/241808499) is available at Black Friday Price $15. Anyone who wants to learn from 15 years of combined experience of these ex AWS engineers should take this book.

Everything they know about AWS is shared in the book. It will be an asset for you. Consider grabbing a copy if it interests you.

Cheers
Wes Bos Black Friday 
Tags: javascript, node, gatsby, react
Published: 2021-11-23 10:23:03

Hey everyone, Wes Bos, the popular full stack web developer from Ontario, Canada is offering Black Friday discount on all of his courses. For the next 7 days, you are eligible to get 50% discount for any Wes Bos’s course you buy. This is the only time of the year when Wes Bos slashes the price of his amazing courses.

You don’t want to let this opportunity go. Do take a look at the list of popular Wes Bos courses down below and sign up for your favorite with Black Friday offer. And, the best part is, Wes Bos supports Parity Purchasing Power, so on top of black friday discount, you get additional discount if you are from a country where the price may look expensive.

<h2>List of Wes Bos Popular Courses</h2>

Master Gatsby — Build modern websites with Gatsby, React and Friends – <a href="https://mastergatsby.com/friend/GALORE">ReadMore</a> 

Beginner JavaScript – Learn Javascript from scratch – <a href="https://beginnerjavascript.com/friend/GALORE">Read More</a>

Advanced React and GraphQL — Build Full Stack Applications with React and GraphQL – <a href="https://advancedreact.com/friend/GALORE">Read More</a>

React For Beginners – The best way to learn React – <a href="https://reactforbeginners.com/friend/GALORE">Read More</a>

ES6 for Everyone — The best way to learn modern ES6 JavaScript – <a href="https://es6.io/friend/GALORE">Read More</a>

Learn Node — The best way to learn Node.js, Express, MongoDB – <a href="https://learnnode.com/friend/GALORE">Read More</a>

For each of the above courses, you get 50% black friday discount.

You can also take a look at Wes Bos’s most popular course “<a href="https://javascript30.com/friend/GALORE">JavaScript 30 — Build 30 things with vanilla JS in 30 days with 30 tutorials</a>“. It is available for free at the moment until next notice.

If you have any questions about this offer, please feel free to reach out.
Day 69/100 Project: A Platform Game
Tags: 100daysofcode, challenge, motivation, programming
Published: 2021-11-23 10:11:35


"All reality is a game."

– Iain Banks, The Player of Games

![Game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnkr7iu62rg9i4k6bz4j.png)
Currency converter calculator
Published: 2021-11-23 10:07:07

Thanks to God, I completed the work of a calculator (Abdullah) that converts currencies
When you press the (calculator) button it works as a calculator 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9nh4407h3o8nparfc3v.jpg)

And when you press the (currency converter) button, it works like a currency converter machine 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rocjflhswrzh1cd77fo6.jpg)

I named this math program after my son Abdullah

It is a gift from me to him because 💖

🎓 Excellent in Mathematics

💻 To encourage him to learn programming 

You can use the calculator at the following link:
[repl: Currency converter calculator Abdalla](https://currency-converter-calculator-abdalla.husseinouda.repl.co/)
[github: Currency converter calculator Abdalla](https://husseinaoda2.github.io/Currency-converter-calculator/)

To view the code, download and share on my site:
[husseinouda.me](https://husseinouda.me/)

Hussein Ouda
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wjve4khpy9e3qrhwi1km.png)
New In Laravel - 8.72.0
Tags: php, laravel, programming, beginners
Published: 2021-11-23 10:04:15

Support for countables to the pluralizer
```php
use Illuminate\Support\Str;
use App\Models\User;

$users = User::take(1)->get();
return Str::plural('user', $users->count()); //user

$users = User::take(2)->get();
return Str::plural('user', $users->count()); //users
```
I hope you enjoy the code.
Making the chrome dino game play itself using Javascript
Tags: javascript, webdev, beginners, programming
Published: 2021-11-23 09:46:46

Hello, guys in today's blog we are gonna hack chrome dino ( automating it ) using javascript

Chrome dino game is made by Google. this game is available in chromium based browsers like brave, chrome, edge and other browsers out there

you can play this game by turning off your internet/wifi or going to **`chrome://dino`** 😊

## Anyways lets automate it

> **Watch this video to get better understanding** 
https://www.youtube.com/watch?v=r0b4j8JUVUc&t=236s

first we make a function with the name **`autoPlay()`**

**Note (these are the objects in the chrome dino game)** :-

**------ DINO ------**
**tRex** - Is the DINO

**------ CACTUS ------**
**CACTUS_SMALL** - is the smallest cactus
**CACTUS_LARGE** - is the largest cactus

**------ BIRD ------**
_The name of the bird is pretty hard 🤣_
**PTERODACTYL** - the bird

In the code i have given comments and tried to explain you each line of code :)

```js
function autoplay() {
  setTimeout(function () {
    myinstance = this.Runner.instance_;
    myobstacles = myinstance.horizon.obstacles;

    // if my tRex is ducking then
    if (myinstance.tRex.ducking) {
      // make my tRex to duck
      myinstance.tRex.setDuck(true);
    }
    if (myinstance.crashed) {
      //   When the game is over then
      console.log("Game Over... Paste the code again to automate the game");
      return;
    }
    if (myobstacles.length > 0) {
      action = "JUMP";
      obstacle_type = myobstacles[0]["typeConfig"]["type"];

      // Defining which action to perform if it match the following cases
      if (obstacle_type == "CACTUS_SMALL" || obstacle_type == "CACTUS_LARGE") {
        action = "JUMP";
        // i know its a hard name ( actually PTERODACTYL its the bird )
      } else if (obstacle_type == "PTERODACTYL") {
        if (myobstacles[0]["yPost"] == 75 || myobstacles[0]["yPost"] == 50)
          action = "DUCK";
      }

      // Making the action work
      if (myobstacles[0].xPos <= 100) {
        console.log(myobstacles[0]);

        // Perform the action
        if (action == "JUMP") {
          console.log("Jumping.. Yahoo");
          // we get the current speed of our dino
          curr_speed = myinstance.currentSpeed;
          // then making it jump
          myinstance.tRex.startJump(curr_speed);
        } else if (action == "DUCK") {
          console.log("Ducking.. Oo");
          myinstance.tRex.setDuck(true);
        }
      }
    }
    autoplay();
    // setting the timer for 20 mili seconds
  }, 20);
}
console.log('Done.. Automated the game, Now Start')
autoplay();
```

And Voila! we are done 😀👍 so i hope you guys enjoyed this blog and had fun! Have a nice day and be safe guys 💖

Dont forget to subscribe to my youtube channel for more amazing videos - https://youtube.com/codingfire?sub_confirmation=1
Data Structure and Endianness in Nodejs
Tags: javascript, endianness, memory, node
Published: 2021-11-23 09:44:19

**Data structure** is the collection of data values, the relationship among them and the functions or operations that can be applied to the data according to Wikipedia.

**Memory in Data structure**
The concept of memory is that there are finite memory slots. So it can be exhausted.
The program is always stored in a free memory slot. Memory is stored as bit and byte. 8 bits make a byte.

For example: 
```
1 represented as a byte is 0000 0001	     
2 represented as a byte is 0000 0010
3 represented as a byte is 0000 0011
4 represented as a byte is 0000 0100
```
These are represented in base 2. And that gives us a finite amount of numbers we can store because base `2^8 = 256`. So to save bigger numbers, we increase the bytes. 

In java for example, "int" is the equivalent of 4 bytes, 32 bits integer. Type "long" represents 8 bytes, a 64 bits integer.

**Endianness in Data Structure**
The concept of Endianness in computer memory storage refers to how bytes are read. It could either be the smallest byte value first called Little-endian (read from left to right) or biggest byte value first called big-endian (read from left to right). 
For example, 
```
65,000 decimal number in base 2 is: 0b11111101 11101000.
0b here helps us know it is in base 2 and not 1,111,110,111,101,000
```
The answer above is in big-endian byte because the byte with the biggest 0b11111101 is written first reading from left to right. We can confirm this by converting the big-endian padded by another byte of zeros "0b1111110100000000 to base 10" on google. The result is 64,768 which is very close to our initial number of 65,000.

For networks, the standard is Big-endian and for most PCs, the standard is Little-endian. Check this [code](https://replit.com/@emmygozi/Test-Endianness) snippet online to find out what endian your machine runs. My machine runs on Little-endian.

Endianness has largely ceased to be a matter of concern because of modern computer languages removing this needless complexity and processors which are Bi-endian and can handle both.

For further studies, please visit https://www.algoexpert.io
Is Realtek RTL8723BE Wi-Fi incredibly weak in Ubuntu?
Tags: ubuntu, networking, realtekwireless, rtl8723be
Published: 2021-11-25 17:03:08

---
title: Is Realtek RTL8723BE Wi-Fi incredibly weak in Ubuntu?
published: true
date: 2021-11-23 09:39:23 UTC
tags: Ubuntu,networking,realtekwireless,rtl8723be
canonical_url: https://stackallflow.com/ubuntu/realtek-rtl8723be-wi-fi-incredibly-weak-in-ubuntu/
---

<header>
<p><span style="font-size: 1.2em; color: initial;">networking</span><span style="font-size: 1.2em; color: initial;">realtek-wireless</span><span style="font-size: 1.2em; color: initial;">rtl8723be</span><span style="font-size: 1.2em; color: initial;">wireless</span></p>
</header>

I have a HP 14-AN001NA laptop. It came with Windows 10 installed on which the Wi-Fi worked fine anywhere in the house.

However I removed Windows 10 and installed Ubuntu 16.04 instead and since I have had terrible Wi-Fi anywhere aside from about three foot away from the router. I don’t know if it’s relevant but my Wi-Fi is not called `wlan0` but `wlo1` for some reason (I didn’t change it).

When running `lspci -knn | grep Net -A3` I get the following output:

```
05:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723]
DeviceName:  
Subsystem: Hewlett-Packard Company RTL8723BE PCIe Wireless Network Adapter [103c:81c1]
Kernel driver in use: rtl8723be
Kernel modules: wl, rtl8723be
```

#### Accepted Answer

Run in a terminal

```
sudo tee /etc/modprobe.d/rtl8723be.conf <<< "options rtl8723be ant_sel=1"

```

and reboot.

The `ant_sel` parameter enables one of the two antenna connectors of your RTL8723be adapter. Your laptop has only one antenna because the vendor is too greedy to install two. The Linux drivers can’t detect which antenna connector is in use. So we have to guess it.

In Windows either the vendor sets it up somewhere on a pre-installed system, or the Windows proprietary drivers can detect it.

If `ant_sel=1` does not help, use `ant_sel=2`. This setting tells which antenna is in use 1 or 2.

The post [Is Realtek RTL8723BE Wi-Fi incredibly weak in Ubuntu?](https://stackallflow.com/ubuntu/realtek-rtl8723be-wi-fi-incredibly-weak-in-ubuntu/) appeared first on [Stack All Flow](https://stackallflow.com).
The Best Massage Chairs
Published: 2021-11-23 09:36:13

If massage chairs are a symbol of comfort and even indulgence, shopping for one can be stressful. There are numerous models to choose from—many of which merely vibrate, rather than knead, or tout pseudoscientific and inscrutable features like “air ionization” and “chromotherapy.” After testing 12 models from some of the top brands, we think the Osaki OS-Champ is almost as good as a <a href="https://techypes.com/">real massage</a>. This chair is comfortable to sit in and sturdily built, and it massages the entire body. Plus, it outperformed more-expensive massage chairs in key areas like heating and reclining.
How to backup settings and a list of installed packages in Ubuntu?
Tags: ubuntu, backup, management, package
Published: 2021-11-25 17:02:59

---
title: How to backup settings and a list of installed packages in Ubuntu?
published: true
date: 2021-11-23 09:33:34 UTC
tags: Ubuntu,backup,management,package
canonical_url: https://stackallflow.com/ubuntu/how-to-backup-settings-and-a-list-of-installed-packages-in-ubuntu/
---

<header>
<p><span style="font-size: 1.2em; color: initial;">backup</span><span style="font-size: 1.2em; color: initial;">package-management</span></p>
</header>

If I want to make a backup of everything I have done since the fresh install of Ubuntu, what are the possible options? What all should I backup? I want to get all the settings that I changed, all the packages I installed, etc.

#### Accepted Answer

### Programs

A quick way of backing up a list of programs is to run this:

```
dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys

```

It will back them up in a format that dpkg can read<sup>*</sup> for after your reinstall, like this:

```
sudo apt-key add ~/Repo.keys
sudo cp -R ~/sources.list* /etc/apt/
sudo apt-get update
sudo apt-get install dselect
sudo dselect update
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y

```

<sup>*</sup> You may have to update dpkg’s list of available packages or it will just ignore your selections (see [this debian bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=703092) for more info). You should do this before `sudo dpkg --set-selections < ~/Package.list`, like this:

```
apt-cache dumpavail > ~/temp_avail
sudo dpkg --merge-avail ~/temp_avail
rm ~/temp_avail

```

### Settings and Personal Data

Before you reinstall, you should probably back up the settings from some of your programs, this can easily be done by grabbing folders from /etc and all the content from your user directory (not just the stuff you can see in nautilus!):

```
rsync --progress /home/`whoami` /path/to/user/profile/backup/here

```

After you reinstall, you can restore it with:

```
rsync --progress /path/to/user/profile/backup/here /home/`whoami`

```

### So all together as a pseudo-bash script.

This assumes there is only one user on the machine (remove `/'whoami'` otherwise) and that you used the same username on both installs (modify dest. of rsync otherwise).

```
dpkg --get-selections > ~/Package.list
sudo cp -R /etc/apt/sources.list* ~/
sudo apt-key exportall > ~/Repo.keys
rsync --progress /home/`whoami` /path/to/user/profile/backup/here

## Reinstall now

rsync --progress /path/to/user/profile/backup/here /home/`whoami`
sudo apt-key add ~/Repo.keys
sudo cp -R ~/sources.list* /etc/apt/
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo dselect

```

The post [How to backup settings and a list of installed packages in Ubuntu?](https://stackallflow.com/ubuntu/how-to-backup-settings-and-a-list-of-installed-packages-in-ubuntu/) appeared first on [Stack All Flow](https://stackallflow.com).
How to switch from Wayland back to Xorg in Ubuntu 17.10?
Tags: ubuntu, 1710, waylandxorg
Published: 2021-11-25 17:02:54

---
title: How to switch from Wayland back to Xorg in Ubuntu 17.10?
published: true
date: 2021-11-23 09:32:17 UTC
tags: Ubuntu,1710,waylandxorg
canonical_url: https://stackallflow.com/ubuntu/how-to-switch-from-wayland-back-to-xorg-in-ubuntu-17-10/
---

<header>
<p><span style="font-size: 1.2em; color: initial;">17.10</span><span style="font-size: 1.2em; color: initial;">wayland</span><span style="font-size: 1.2em; color: initial;">xorg</span></p>
</header>

Some of my applications don’t work on Ubuntu 17.10 Wayland. How can I switch back to Xorg?

#### Accepted Answer

When you boot your system and get to the GDM login screen you should find a cogwheel ( ![⚙](https://s.w.org/images/core/emoji/13.1.0/72x72/2699.png)) next to the sign in button. If you click on the cogwheel you should find an **Ubuntu on Xorg** option which will start an Xorg session instead of a Wayland session.

[![enter image description here](https://i.stack.imgur.com/6FtxL.jpg)](https://i.stack.imgur.com/6FtxL.jpg)

The post [How to switch from Wayland back to Xorg in Ubuntu 17.10?](https://stackallflow.com/ubuntu/how-to-switch-from-wayland-back-to-xorg-in-ubuntu-17-10/) appeared first on [Stack All Flow](https://stackallflow.com).