teleren/devto huggingface dataset:
Weekly Challenge #5 - Password Generator
Tags: codenewbie, weeklychallenge
Published: 2023-04-06 22:27:30

---
title: Weekly Challenge #5 - Password Generator
series: Weekly Challenge
published: true
tags: codenewbie, weeklychallenge,
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-04-06 21:53 +0000
---

As developers, we all know the importance of having strong passwords to keep our online accounts secure. However, coming up with strong passwords can be a challenge, especially if you have multiple accounts with different requirements. That's why this week's programming challenge is all about creating a password generator!

The challenge is simple: write a program that generates a random password of a specified length. The password should be difficult to guess, with a mix of uppercase and lowercase letters, numbers, and special characters.

To get started, you'll need to decide on a programming language to use. You can use any language you like, but some good options for this challenge might include Python, JavaScript, or Ruby.

Once you've chosen your language, start by defining the requirements for your password generator. How long should the passwords be? What types of characters should they include? How will you generate random passwords?

Next, start coding! You can use built-in functions to generate random numbers and characters, or write your own functions if you prefer. Here's an example of what your code might look like in Python:

```
import random
import string

def generate_password(length):
    # Define the characters to include in the password
    characters = string.ascii_letters + string.digits + string.punctuation

    # Generate a random password
    password = ''.join(random.choice(characters) for i in range(length))

    return password

# Generate a password with 12 characters
password = generate_password(12)

print(password)
```

In this example, we're using Python's random and string modules to generate a random password with a mix of uppercase and lowercase letters, numbers, and punctuation marks.

Once you've written your code, test it out by generating a few passwords of different lengths. Make sure the passwords are difficult to guess, and that they meet the requirements you defined earlier.

When you're happy with your code, share it on DEV Community and challenge other developers to create their own password generators. We also encourage you to customize your generators by adding additional features, such as the ability to generate pronounceable passwords or to exclude certain characters.

By participating in this challenge, you'll not only improve your coding skills, but also help to keep yourself and others safe online by generating strong, secure passwords. So what are you waiting for? Start coding and generate some passwords!

Follow us at [CodeNewbie](https://dev.to/codenewbieteam) for more challenges, discussions, and more!
Ubuntu basic configuration
Published: 2023-04-04 14:35:23


# SetUp

## Some essential apps:

```bash
sudo apt-get install gnome-tweaks -y
```

```bash
sudo apt-get install gnome-shell-extensions
```

``` bash
sudo apt-get install gnome-shell-extension-manager
```


## Some essential extensions:
- Blur-my-shell
- Just Perfection

## Some Flatpak pakages to install

```bash
flatpak install flathub io.github.realmazharhussain.GdmSettings
flatpak install flathub org.mozilla.firefox
```

## Some usefull apps
- neovim
- vscode
- GParted
- Geary
- Calendar
- Bitwarden
- gedit
- wps

## Customizing

Create folders for customizing

.icons / .themes / .fonts

Customization websites:
- https://www.gnome-look.org/browse/
- https://draculatheme.com/
- https://www.nerdfonts.com/
- https://github.com/ohmybash/oh-my-bash
- https://github.com/sebastiencs/ls-icons


My grub theme:
https://www.gnome-look.org/p/1414997


## Setup multimedia codecs && VLC player


```
sudo apt install ubuntu-restricted-extras && sudo apt install vlc
```

## Enable minimize app from dock

```
gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'
```

## Enable firewall
```
sudo systemctl enable ufw

//for gui ufw

sudo apt install gufw
```

## Enable FlatPak:

```
sudo apt install flatpak

flatpak remote-add --if-not-exists flathub //flathub.org/repo/flathub.flatpakrepo
```

## Enable AppImage support:

```bash
sudo apt install libfuse2
```







# Special Laptop config

## Battery

### Auto CPUFrec
Install [Auto CPUFrec](https://github.com/AdnanHodzic/auto-cpufreq)

```bash
git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq && sudo ./auto-cpufreq-installer
```

Apply the deamon:

```bash
sudo auto-cpufreq --install
```

For help
```bash
auto-cpufreq --help
```

### TLP
Install [TLP](https://github.com/linrunner/TLP)
```bash
sudo apt install tlp tlp-rdw
```

Enable TLP
```bash
sudo systemctl enable tlp
```


## Close laptop lid issues

_**Method 1: Using GNOME Tweaks**_ First we have to install gnome-tweaks-tool.

```
sudo apt-get install gnome-tweaks
```

Then open the gnome-tweaks and follow below steps:

-   Go to the General tab in the sidebar
-   And **toggle off** the **'Suspend when laptop lid is closed’** button

**Method 2: Change login configuration (for advanced users)**

If you look into the content of the file **/etc/systemd/logind.conf**, you’ll see three different types of default settings for the laptop lid closing.

-   **HandleLidSwitch**: When the laptop is on battery power
-   **HandleLidSwitchExternalPower**: When the laptop is plugged into a power outlet
-   **HandleLidSwitchDocked**: When the laptop is connected to a docking station

If you want, you can change the value of those parameters to one of these as per your preference:

-   **lock**: lock when lid is closed
-   **ignore**: do nothing
-   **poweroff**: shutdown
-   **hibernate**: hibernate when lid is closed

I would suggest going with **ignore**

Then **save** the file do a **restart**.
Variáveis primitivas no JavaScript (string, number) são imutáveis
Tags: javascript, webdev, programming, discuss
Published: 2023-04-06 22:27:15

No JavaScript temos 2 tipos de variáveis:

👉 Primitivas: String, Number, Boolean, Null, Undefined, BigInt e Symbol.

👉 Não Primitivas: Objetos (objeto, array e função)

As primitivas são consideradas IMUTÁVEIS. Isso mesmo: os tipos primitivos não são alterados 😮

"Como assim, Lais??"

As variáveis primitivas são alocadas em uma região da memória conhecidas como Stack - static allocation.

Nesta área, quando uma variável é reatribuída, um novo espaço em memória é alocado para guardar o novo valor. O antigo valor não é mais utilizado e, na sequência, o Garbage Collector vai limpar o espaço em memória que não é mais referenciado.

Por isso, as variáveis primitivas são consideradas IMUTÁVEIS!!

E como eu posso testar este comportamento?

Abre o navegador, vai na aba "Console", declara uma variável:

```js
let text = "bola"
```

Na sequência tente realizar a seguinte alteração: 

```js
text[3] = "o"
```

Se fosse mutável, o seguinte console deveria retornar "bolo":

```js
console.log(text) 
```

Mas como a variável é imutável, o seguinte console continua retornando "bola":

```js
console.log(text) 
```

Li diversos artigos para entender esse comportamento. Vou indicar abaixo algumas leituras (todas em inglês):

👉[The Secret Life of JavaScript](https://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/)

👉 [Primitive X Non-Primitive](https://levelup.gitconnected.com/primitive-vs-non-primitive-value-in-javascript-82030928fd9)

👉 [How  Memory works in JavaScript](https://blog.sessionstack.com/how-javascript-works-memory-management-how-to-handle-4-common-memory-leaks-3f28b94cfbec)

Tem algo a complementar sobre o assunto? Deixa nos comentários 👇
My Tech Journey: Lessons Learned as a Junior Developer
Tags: react, javascript, webdev, beginners
Published: 2023-04-06 22:18:17


![My Tech Journey: Lessons Learned as a Junior Developer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3ncfhcu3r49qd2zd32k.jpg)

In 2021, I graduated from university with a degree in mathematics, I realized that pursuing a career in that field was not something that interested me. Instead, I found myself drawn to website development, something I had already enjoyed even before attending university. In this article, I will share my experiences as a junior developer and the lessons I learned along the way.

**Learning JavaScript and React**
In 2022, I began my journey to become a web developer by learning JavaScript, followed by React. I quickly fell in love with React — everything from its name to its popularity drew me in, building all my projects on GitHub with it. However, in hindsight, I now realize that I rushed into React without fully grasping the basics of JavaScript. This made it challenging for me to learn other aspects of frontend development.

**Getting a Job as a Junior Developer**
In March 2023, I landed a job. However, I did not get the job based on my technical competence, as the interview process focused on non-code-related topics. Although I was excited to join the team, I struggled with impostor syndrome, worrying about how I would cope with working alongside experienced coders.

**The Reality of Being a Junior Developer**
During my first week on the job, I experienced significant stress and headaches. I was working in a paid internship with a clause stating that I would retain my position if I performed well. This only added to my anxiety, as I did not want to mess up and risk losing my job. However, with the help of the internet and a React course on Udemy, I slowly began to learn and gain confidence in my abilities.

**Conclusion:**
My journey so far has taught me a few key lessons:

- Getting a job is one thing, but performing well on the job is another issue that junior developers should be prepared for.
- It’s important to learn the core basics of JavaScript before moving on to any framework, as it will give you a better foundation for understanding and working with different frameworks.
- Don’t be afraid to ask for help or seek out additional resources to broaden your knowledge and skills. The internet is a great tool for finding information and courses that can help you grow as a developer.
Day 730 : Thoughts
Tags: hiphop, code, coding, lifelongdev
Published: 2023-04-06 22:13:31

_liner notes_:
- Professional : Had a couple of meetings and spent the rest of the day working on my proof of concept demo application. I updated the code and docs for a couple of Web Components then published it. I then installed the Web Component into the PoC app and made sure things still work. Got a couple more and then I should be good with the Web Components updating.

- Personal : Went through some tracks for the radio show. Worked a little on my side project. I was researched CSS Container Queries. It could be useful for sizing the text in my side project. Finally watched the new "Vinland Saga".

![The Kangaroo Island, Australia coastline with various shades of blue water leading to the beach which quickly leads to an elevated landmass under blue skies with whispy white clouds.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvfefctz59edqggsd5vf.jpg)

Going to see what projects I want to pick up on Bandcamp. I'll buy them tomorrow since it's Bandcamp Friday and the artists get more of each sale. Going to work out the layout I want the details page. I'm thinking I may use Container Queries to help show how the info will show up. Still thinking it through and playing around with it. I've got thoughts. haha I saw there's a new "Dr. Stone" episode to start Season 3. Probably end the night watching that.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube lTj7UNIpX5c %}
Switching FROM Docker Images for Each CPU Architecture
Tags: docker
Published: 2023-04-06 22:00:00

## Introduction

This article explains how to switch Docker's FROM according to the CPU architecture when multiple CPU architectures exist.
For example, it is useful when supporting Apple Silicon.

## Exclusions for this article

Please note that this article does not cover cases where images for each platform are provided with the same tag or where architecture identification is included in the tag.

For example, the following cases:

```dockerfile
# Multiple platforms are provided with the same tag
FROM alpine:3
```

```dockerfile
# Different tags, but architecture identification is included in the tag
# - example:amd64
# - example:arm64
FROM example:${TARGETARCH}
```

These are, of course, common patterns.
The method introduced this time may also be a common pattern, but it was difficult to find, so I would like to share it.

## Motivation

When building multiple platform images with `docker/build-push-action` in one step of GitHub Actions, it is necessary to prepare separate images for each CPU architecture.
If you prepare an image for each architecture, `docker manifest` and other tools require some effort to distribute multiple platform images with the same tag. ※1
Therefore, if you can combine it into one step, you can maintain a very simple workflow.

While writing this article, I am thinking that a method that can be easily done without doing such a strange thing may have already been born.

## How to switch FROM according to CPU architecture

This article explains how to switch Docker's FROM according to the CPU architecture, using ubuntu:22.04 for amd64 and alpine:3 for arm64 as an example.

Before creating the final product, you can switch images to different ones for each CPU architecture by preparing stages such as amd64 and arm64.

```dockerfile
FROM ubuntu:22.04 as amd64
RUN ...

FROM alpine:3 as arm64
RUN ...

FROM ${TARGETARCH} as app
```

Although only variables provided in advance such as ARG and TARGETARCH can be specified for FROM itself, you can switch FROM by preparing stages such as amd64 and arm64.

It's obvious, but I was struggling for about an hour, so if you want to do something else, please refer to it.

## Conclusion

This article explains how to switch Docker's FROM according to the CPU architecture.
By using this method, you can develop more efficiently when multiple CPU architectures exist.
Top-down PostgreSQL 15 Top Features
Tags: apache, postgres, age, tutorial
Published: 2023-04-06 21:38:33

Today we are starting a series of deep talks about the database in general. In most scenarios, we go with a bottom-up approach unlike now we want some creativity we start from a top-down approach leaving your brain in a WOW mood for a while and configuring then I came with the cold water to flush your brain with "what makes a lot of sense" the Architecture of their database that support such a feature In was you want to start your own business now you got the things that blow everyone minds. 

## "jsonlog" logging format

Surprisingly, PostgreSQL 14 and previous versions didn't have a handle output format for the logs- was just plain text, leaving the developer to do some redundant work of converting the plain text to JSON format to be useful. I am not going to talk about the importance of having structured data- but what I can say is truly important. 

## Server statistics in shared memory

Back to school where you studied the OS class and how you were amazed by connecting two programs doing some functionality over the same memory. it is the case here, in earlier versions there was a separate process called the statistics collector, which would periodically query the server for performance data and store it in a separate file on disk. This approach could result in increased disk I/O and network traffic, as well as increased CPU usage by the statistics collector process itself. the new approach directly leaves the user with great control and flexibility over the memory with fast and efficient customized statistics to be later monitored or analyzed. although we introduced the "jsonlog" format but still the output of the shared memory is plain text.
You can ask PostgreSQL directly through their website about that, as I can't feel the worth of not changing the output format- maybe they have already posted an issue doing so LOL.

we are not done yet next time we will have a talk about more top features and by the end, we will start the series of discovering the Architecture that supports such Top features.

### Reference 
1- My brain 
2- [PostgreSQL Doc](https://www.postgresql.org/docs/current/install-procedure.html)
Thanks for reading :>)
FUTURE AI
Tags: ai
Published: 2023-04-06 21:09:38

Consider the possibility of dedicating oneself to enhancing an artificial intelligence without relying on external APIs, but rather utilizing only the refinement techniques developed by oneself. It is my pleasure to inform you that I have accomplished this feat! I believe that this approach can be highly challenging, yet rewarding, as it presents a unique opportunity to test one's abilities and enhance one's understanding of the techniques and concepts involved in creating high-quality AI. Additionally, I believe that this experience may provide you with a deeper and more comprehensive understanding of the subject, enabling you to achieve even more impressive results in the future
The "suspension of the request" technique with Axios
Tags: javascript, axios, react, frontend
Published: 2023-04-06 20:53:56

Use the "suspension of the request" technique to increase your loading time in a fronted local project by some codes into the axios interceptor:


There is a great way to enhance the loading time in your local project with customizable time, which is better than the network tab (in developer tools)!

When you are working on a local full-stack project, you may notice that the loading time is so fast that you cannot see the loading component UI. Alternatively, your network loading time may be fast, and you cannot see the skeleton component when you finished a section or a page .


- The advantage of this technique is that it eliminates the need to set specific loading times for each API call in your component every time. Instead, you can set a global configuration with your interceptor.
- If you are working on a local full-stack project or your local website loads quickly  , this technique can be used.
- You no longer need to manually change the loading state to view the final outcome.
- This technique differs from the network tab and is superior to it in terms of observing the loading component, as you can specify custom seconds and milliseconds. 


It's pretty interesting, isn't it ?! 

Therefore, add the bottom script to your axios interceptor:

```
--------------------------------


function reaquestSuspender (time = 2000) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve();
    , time);
  });
}


--------------------------------


import axios from "axios";

const _axios = axios.create({
  baseURL: 'https://some-domain.com/api/',
  timeout: 1000,
  headers: {'X-Custom-Header': 'foobar'}
});

// Add a request suspender to interceptor
_axios.interceptors.request.use(async function (config) {
    await requestSuspender(2500);

    return config;
  }, function (error) {
    return Promise.reject(error);
  });

export default _axios;

```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3zclej7gykxxb8qpa8l.png)
Looking for a simple web app that has a system monitoring feature on read-only for Linux
Tags: linux, python, sysadmin, devops
Published: 2023-04-06 20:43:46

---
title: Looking for a simple web app that has a system monitoring feature on read-only for Linux
published: true
description: Hello! I'm back again, with a new things to share. For the past week, I'm looking for a simple web app that has this system monitoring (CPU Usage, Memory, Disk, etc.) feature on read-only for Linux. 
tags: linux, python, sysadmin, devops
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqcpknbq5aq5c66aax56.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-04-06 19:57 +0000
---
Hello! I'm back again, with a new things to share. 

For the past week, I'm looking for a simple web app that has this system monitoring (CPU Usage, Memory, Disk, etc.) feature on read-only for Linux. 

I found one [Webmin](https://webmin.com/), it has a cool dashboard though! The thing is, you need to be careful using this tool since it will expose a lot of things on the server or machine that you installed it on.

Here are the reasons why I'm not inclined to use Webmin on the servers that I'm working on:

1. Yes, there are many ways to make it as secured though, I'm still in doubt with it because even you delete the root user that has access for everything, it will still have these features that modify the server since all I want is a dashboard for system monitoring.

2. The dashboard for the system monitoring is only available for that server, meaning if you have cluster of servers you'll need to check it one by one to get the info you want.

That being said, I came up with this thing named [TailStat](https://github.com/LordDashMe/tailstat). The current goal features for this right now are:
- Super lightweight dashboard for system monitoring
- Fully read-only access
- To support multiple server monitoring (WIP)

I'm hoping that this will also help others who have been searching for the same features that I have mention. 

This is open for any contribution and I prepared some straight forward instruction how to get started with it, though I know it is not that thorough that it should be.

Thanks for reading this one.

Happy crafting :smile:!
Project 2 Week 11 Blog
Published: 2023-04-06 20:43:31

# Homework week 11 blog post:
# 
## Link for today's code check in:
https://codepen.io/jessicagroblewski/pen/LYJqJLM

### How did you start?
- We started project 2 by devising a timeline to complete our project. We wanted to have certain aspects of the webpage (Heading, search, badges, etc.) done at different week check points. For this week we are attempting to set up our badge like it is displayed on the webpage.

### What did you decide to attack first?
- We started with the formatting for the webpage. We added a heading and search bar first since we were the most comfortable with those two aspects. 

### What issues have you had?
- We have had issues setting up the badges since we do not have much experience with it.

### What concepts translated from Project 1's card?
- Definitely the creation of a "card". We have been treating the webpage as if it is a card. 
 
### What's your next priority?
- Our next priority is finishing up the badges and attempting the backend portion of the project. Also working out some design issues.

### What problems are you unsure of how to solve?
- The creation of a badge and how to format it to look like the sample one. Also, setting up the frontend and backend portion.