teleren/devto huggingface dataset:
Como listar Usuários e Permissões no MongoDB
Published: 2023-03-09 19:31:18

---
title: Como listar Usuários e Permissões no MongoDB
published: true
description: 
tags: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ha623f0l67iqsbqwe8u.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-24 20:07 +0000
---
## Listando usuários e privilégios no MongoDB
Fala pessoALL, já precisaram listar os usuários e seus privilégios em um ambiente MongoDB?

Em ambientes pequenos ou com poucos usuários isso pode parecer mais fácil, porque podemos ir diretamente em alguns usuários. Mas em ambientes maiores, com muitos usuários e também privilégios isso com certeza será uma tarefa difícil.

Para facilitar a vida vamos a um pequeno script para iterar sobre nossos usuários e privilégios.
### Primeiramente, boas-práticas...
Ao utilizar o MongoDB, podemos criar usuários e privilégios em qualquer base de dados do cluster, mas por boa-prática (e acreditem, isso facilita muito), centralizamos as criações na base de dados *admin*.
### Usuários e privilégios
Os usuários podem ter um ou mais privilégios (roles) e o script abaixo faz uma iteração para cada usuário e também dentro de cada role.
#### Dentro do mongosh
```javascript
use admin;
db.getUsers().forEach(user => {
   print(user.user);
   user.roles.forEach(role => {
       var roleDetails = db.getRole(role.role, { showPrivileges: true });
       printjson(roleDetails);
   });
});
```
### E é isso...
Sim, rápido e simples... claro que o script pode ser totalmente aprimorado, incluir algumas condições e tudo mais!

Espero que ajude e não esqueça de adicionar ao **cinturão de atividades** e compartilhar!
Insane 🤯 Websites 🌐 for Developers 👨‍💻
Tags: webdev, beginners, python, productivity
Published: 2023-03-09 19:28:56

- In every industry, there are at least a handful of experts considered authorities on the subject. 

- These professionals have gained their expertise through years of experience and study in the field, making them sought-after sources of advice and information. 

- Most authorities have a blog or website to share their knowledge with others interested in learning more about the topic. 

- For developers, these experts can be invaluable resources when it comes to staying up to date on trends and technologies related to programming languages such as Java, C++ or [Python](https://youtu.be/2VRXU2H4q0c). 

- By reading blogs written by experienced developers specialising in specific topics within the development, budding programmers can gain insight into best practices for coding projects and tips for troubleshooting issues that may arise during development cycles.
 
- Experienced coders also benefit from keeping tabs on what’s happening across various platforms so they can stay ahead of any changes that could impact how they work or affect project timelines moving forward. 
  
- Websites like Stack Overflow are great places where developers can go not only get answers from other users but learn more about certain aspects of coding through discussions between peers who know each other's strengths and weaknesses better than anyone else does - this is especially true when looking for solutions related to open source software libraries like [React.JS](https://youtu.be/VrkvIdvl29Y) which require an understanding beyond just basic syntax rules found online tutorials alone cannot provide. 

- Additionally, following prominent figures within your chosen language community will help ensure you don't miss out on essential updates regarding new releases, bug fixes etc... 

- In conclusion, having access to many different authority sources available online gives today's developers unprecedented opportunities compared to even ten years ago!




###### Insane 🤯 Websites 🌐 for Developers 👨‍💻 

🎥 {% youtube eseirOiTWuk%}


#### Bonus

###### Uncover the Top Secret 🤫 Websites 🌐 Every Software Developer 👨‍💻 Needs to Know!

🎥 {% youtube dstvtdaxeRI%}


### Connect with Me 😊

#### 🔗 Links

[![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/mahmoud-el-kariouny-822719149/)

[![twitter](https://img.shields.io/badge/twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/Mahmoud42275)
Postman API: Streamlining API development.
Tags: postmanapi, postman, webdev
Published: 2023-03-09 19:20:11

Postman API is an essential tool for developers who are designing, testing, and documenting APIs. Its various features make API development a streamlined and efficient process.

One of the key features of Postman API is the API Builder. It supports API-first development and enables developers to design their API in Postman, allowing for easy creation and testing of API requests. The API Builder also allows for API documentation, ensuring that it is clear and easy to understand for other team members or external users.

Another powerful feature of Postman API is Postman Flows, a visual tool for creating API workflows. With Postman Flows, developers can chain requests, handle data, and create real-world workflows. This feature makes it simple to automate repetitive tasks and streamline the API development process.

Postman API also offers various integrations with tools such as GitHub, JIRA, and Slack, making it easy for developers to collaborate and share information about the API.

In addition to testing capabilities, Postman API also provides documentation tools that help developers create API documentation that is easy to read and understand. Developers can add descriptions, examples, and other helpful information to their documentation to ensure that it is clear and easy to follow.

In conclusion, Postman API is a powerful tool that provides a range of features to help developers streamline their workflow and create high-quality APIs. With its user-friendly interface, testing capabilities, and documentation tools, it is a popular choice among developers. If you're looking to enhance your API development process, Postman API is definitely worth considering.
Node.js 18, Axios and unsafe legacy renegotiation disabled
Tags: tls, node
Published: 2023-03-09 19:06:47

---
title: Node.js 18, Axios and unsafe legacy renegotiation disabled
published: true
tags: TLS,Nodejs
canonical_url: https://johnnyreilly.com/node-18-axios-and-unsafe-legacy-renegotiation-disabled
---
Node.js 18 doesn't allow legacy TLS renegotion by default. But some APIs still need it. This post shows how to support them with Axios.

![title image reading "Node.js 18, Axios and unsafe legacy renegotiation disabled"](https://raw.githubusercontent.com/johnnyreilly/blog.johnnyreilly.com/main/blog-website/blog/2023-03-09-node-18-axios-and-unsafe-legacy-renegotiation-disabled/title-image.png)

<!--truncate-->

## The error

If you have code that uses Node.js and Axios, you may have encountered this error when you upgraded to Node.js 18:

```bash
EPROTO B8150000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled
```

The source of this error is Node.js 18 disabling unsafe legacy TLS renegotiation. The motivation for this is noble; it's to mitigate [CVE-2009-3555](https://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2009-3555) by all accounts. Alas, there are APIs that still use legacy TLS negotiation. It appears that one such API is the [Teams webhook API](https://johnnyreilly.com/2019/12/18/teams-notification-webhooks).

## The fix

[I found the answer on Stack Overflow](https://stackoverflow.com/questions/74324019/allow-legacy-renegotiation-for-nodejs/74600467#74600467); but not immediately. So I'm going to record it here since I'm bound to need this again.

To cope with older APIs, making an Axios request ends up looking like this:

```ts
import crypto from 'crypto';
import https from 'https';

/**
 * Handle this problem with Node 18
 * write EPROTO B8150000:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled
 * see https://stackoverflow.com/questions/74324019/allow-legacy-renegotiation-for-nodejs/74600467#74600467
 **/
const allowLegacyRenegotiationforNodeJsOptions = {
  httpsAgent: new https.Agent({
    // for self signed you could also add
    // rejectUnauthorized: false,
    // allow legacy server
    secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT,
  }),
};

function makeRequest(url: string, data: object) {
  return axios({
    ...allowLegacyRenegotiationforNodeJsOptions,
    url,
    headers: {
      Accept: 'application/json',
      'Content-Type': 'application/json',
    },
    method: 'POST',
    data: { some: 'data' },
  });
}
```

I'd imagine that you could use this pattern for the fetch API too, but I haven't tried it.
What a Power Platform Solution Architect role looks like?
Tags: powerfuldevs, microsoft365, powerplatform, mvp
Published: 2023-03-09 18:21:38

The other day, I started to wonder: what are the key responsibilities and skills required for a Power Platform solution architect role? I've been studying and focusing on becoming a solution architect and recently passed the PL-600 certification, so the MS Learning Path box is already checked.
What is an interface in TypeScript
Tags: typescript, javascript, react
Published: 2023-03-09 18:19:49

Hey this is an awesome post about interfaces 🙂

## What is an interface ?

TypeScript interfaces define the structure of the code using properties, methods, events and TypeScript types (string, boolean, number... etc)

For example the `Size` interface below has 2 properties `width`, `height` and 2 methods `getWidth()`, `getHeight()`. All need to be of type `string` because thats what we defined in the interface.


## This is an interface:

```ts
interface Size {
  width: string
  height: string
  getWidth(): string
  getWidth(): string
}

// Usage of the interface above
class Shapes implements Size {
  width: string
  height: string
  constructor(width: string, height: string) {
    this.width = width
    this.height = height
  }
  getWidth() {
    return this.width
  }
}
```

## With optional parameters:

```ts
interface Post {
  title: string
  content: string
  // Optional parameters have a "?" at the end. EX: "tags?"
  tags?: string[] // returns an array of strings
}
```

## With read-only properties

```ts
interface User {
  name: string;
  email: string;
  // By adding "readonly" before a property, that makes it "read-only"
  readonly dateCreated: Date.Now();
}
```

## With Functions

```ts
interface SumFunc {
  (a: number, b: number): number
}

// Usage
const add: SumFunc = (a, b) => {
  return a + b
}
```

## Extending an interface

```ts
// PetInterface
interface PetInterface {
  name: string
}

// DogInterface extends PetInterface
interface DogInterface extends PetInterface {
  breed: string
}

// Example usage
class Dog implements DogInterface {
  name: string = 'Air Bud'
  breed: string = 'German Shepard'
}

// CatInterface also extends PetInterface
interface CatInterface extends PetInterface {
  breed: string
}

// Example usage
class Cat implements CatInterface {
  name: string = 'Garfeild'
  breed: string = 'Tuxedo Cat'
}
```

## Generic interfaces

```ts
// Generics allow you to reuse functions
// "T" is a generic variable that we can assign later
interface PaginatedResponse<T> {
  data: T[] // returns an array of "T"
  nextPageUrl?: string
  previousPageUrl?: string
}

interface Post {
  title: string
  content: string
  tags?: string[]
}

// Usage
function loadDataFromApi() {
  fetch('/some/api/endpoint')
    .then((response) => response.json())
    // Usage: assigning "Post" to the "T" variable
    .then((data: PaginatedResponse<Post>) => console.log(data))
}
```

---

### **Subscribe to my newsletter where you will get tips, tricks and challenges to keep your skills sharp. [Subscribe to newsletter](https://prodigious-innovator-1238.ck.page/25e4b3fdce)**

---
Criando instâncias EC2 da Amazon com discos EBS Multi-Attach usando Terraform
Tags: aws, terraform, cloud, devops
Published: 2023-03-09 18:13:19

Neste artigo, mostraremos como usar o Terraform para criar duas instâncias EC2 da Amazon com um discos compartilhado.

Neste artigo, mostraremos como usar o Terraform para criar duas instâncias EC2 da Amazon com um disco compartilhado.

Por padrão, o / terá apenas 8GB. Depois, será criado outro disco com 30GB para compartilhamento.

Algumas observações ao utilizar o EBS Multi-Attach:

- Atualmente, a opção Multi-Attach está disponível apenas para volumes do tipo **io1** e **io2**.

- Outro ponto a ser testado é a diminuição do número de IOPS para que não haja um custo elevado na sua conta. No Terraform, defini o valor de 100.

- Inicialmente, tentei criar as instâncias com a família **t2.micro**, mas não é possível trabalhar com o EBS Multi-Attach nessa configuração. Acabei alterando para a família **t3.micro**.

Depois que as instâncias subirem, os discos estarão disponíveis, mas não acessíveis. Para torná-los acessíveis, execute os comandos abaixo:

```
$ sudo mkfs -t ext4 /dev/nvme1n1
$ sudo mkdir /area51
$ sudo mount /dev/nvme1n1 /area51
```
E caso queira deixar em definitivo o disco montado basta executar o comando:

```
$ sudo echo "/dev/nvme1n1       /area51   ext4    defaults,nofail        0       0" >> /etc/fstab
```
Para que possa testar, de forma rápida e fácil segue o [link](https://gitlab.com/pcmalves/tf-ebs-multi-attach) do Terraform

E ai vamos nos conectar? Entre em contato comigo:
https://www.linkedin.com/in/pcmalves/
Never too old to keep learning
Tags: beginners, career, community, motivation
Published: 2023-03-09 18:09:57

"Well well well..... How the turn tables....."

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tgfnpr2yta6f1bprmhq.jpg)

I've been working in EdTech for 6 years now and counting. I had been in and out of technology over the years through "Customer Support" and hardware roles. My Mom always told me that technology was meant to be a space for me, but of course as some do we take the long way around. 

Finally after some time I took the plunge into an EdTech company becoming Tier 1 basic customer support, and with that came so many other doors that were opened. Here I am 6 years in starting my coding journey in bootcamp with sufficient software Quality Assurance experience. 

I've learned that change in technology never really stops, there is ever changing processes, algorithms, code bases, new tricks and tips on how to do something better or simpler. Learning doesn't stop because you've gotten older, better, or whatever some believe. Learning stops when you deem yourself to be complacent and happy with the knowledge that you have in any sense.

Complacency can be in any facet, not just education academically. We all continue learning in various places in our lives, and the beauty of continuing all of that is that we will always grow the capacity that we have for something we enjoy. We begin to love and learn more about things that interest us and appease that center of our brain that gets happiness from those interests.

So here is to always learning, here is to always wanting to know more, to always wanting to be less complacent in the places that challenge us to be better than ourselves the previous day. I know it won't be easy but let's give it all we've got to come out the other side a better and ever expanding me. CHEERS!

(This was my first assignment so I apologize to those that this may come across your feed, lol.)
Optimizing Your GitHub Profile: Tips and Strategies for Showcasing Your Work and Building Your Reputation as a Developer
Tags: github, productivity, discuss
Published: 2023-03-09 18:03:36

If you're a developer looking to showcase your work and build your reputation in the developer community, having an optimized GitHub profile is essential. GitHub is the world's largest code hosting platform, and having a strong presence on the platform can help you get noticed by potential employers, collaborators, and users.

Here are some tips on how to optimize your GitHub profile:

1. Customize your profile picture and header image: Your profile picture is the first thing people see when they visit your profile, so choose a professional-looking image that represents you. You can also add a header image to your profile that showcases your work or interests.

2. Write a clear and concise bio: Your bio should summarize who you are and what you do. It should be short and sweet, but also informative. You can also include links to your personal website, LinkedIn profile, or other social media profiles.

3. Highlight your best work: Pinned repositories are a great way to showcase your best work. Choose the repositories that best represent your skills and experience, and make sure they're well-maintained and up-to-date.

4. Use descriptive repository names: Your repository names should accurately describe what they do, and should be easy to find when searching on GitHub. Use keywords that are relevant to your project, and avoid generic or ambiguous names.

5. Provide detailed documentation: Make sure your repositories have good documentation that helps others understand how to use them. This will make your projects more accessible and easier to use for other developers.
 
6. Use labels and milestones: Labels and milestones are a great way to organize your issues and pull requests. Use labels to categorize your issues, and use milestones to track progress and deadlines.
 
7. Participate in the community: Engage with other developers on GitHub by commenting on their projects, submitting issues, and contributing to open source projects. This will help you build a network of contacts and increase your visibility.
 
8. Contribute to open source projects: Contributing to open source projects is a great way to showcase your skills and build your reputation in the developer community. Look for projects that align with your interests and skills, and make meaningful contributions.

9. Use GitHub Pages: GitHub Pages lets you host your website on GitHub for free. This is a great way to showcase your projects and build your online presence.

10. Keep your profile up-to-date: Make sure your profile is up-to-date with your latest work, skills, and interests. This will help others get a better sense of who you are and what you can do.

By following these tips, you can optimize your GitHub profile and showcase your work in the best possible light. Remember to keep your profile up-to-date and engage with the community to build your reputation as a developer.
Im waking up or just angry?
Tags: beginners, programming, productivity
Published: 2023-03-09 17:52:50

do you remember not long time ago when everybody was studying trading and learning how to read freaking Bollinger bands and stuff?
do you remember when our kids was studying breeding pattern and advanced techniques to apply in nft games? then all that is f@#ck up...
now everybody is studying "prompt engineering" to play with new toys this time.

Where do we go now? 
Is this really disruptive in the sense of everybody can make profit from it and stop selling drugs to eat? or have clean water to drink? and educate and live like human beings?
will our shepherds open the door of the farmyard? i dont think so.

Every tool the people builds from its intellect in order to reach some equilibrium in the power is being used to put more control upon us, crypto will be used now to protect the wealth of a bunch of billionaires and put more money on stupid wars and dark business while we play with new toys.
CHar da qiymat olish
Published: 2023-03-09 17:27:09

Biz sizlar bilan qiymat olishni organamiz batafsil pastda katta harf bersak kichkinasi chiqib keladi.

```cpp
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;


int main() {
char belgi;
cin>>belgi;
cout<<char(belgi+32);
return 0;
  }

```
Finding projects on GitHub: Topics, Languages, and Collections
Tags: opensource, github, osdc, beginners
Published: 2023-03-09 17:16:31

---
title: Finding projects on GitHub: Topics, Languages, and Collections
published: true
description: GitHub provides several ways to search for projects based on manually added topic, curated collections of guessed programming languages.
tags: opensource, github, osdc, beginners
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-09 16:36 +0000
---

If you don't know what Open Source project to contribute to you can try to use the [Explore](https://github.com/explore) button on [GitHub](https://github.com/).
It leads you to a page where you can filter the projects by [topics](https://github.com/topics), programming languages, or you can look at various [curated collections](https://github.com/collections).

## Topics

For each GitHub repository the owner can add any number of "topics". As the user edits the list of topics GitHub offers some words based on what the user started to type, but at the end any owner can add any topic. So for example there are projects tagged as [websites](https://github.com/topics/websites) others tagged as [website](https://github.com/topics/website) or [web](https://github.com/topics/web).

There are also projects tagged with [esperanto](https://github.com/topics/esperanto) and [ladino](https://github.com/topics/ladino) (these are mine).

There are tags such as [travel](https://github.com/topics/travel), [newsletter](https://github.com/topics/newsletter), or [icecream](https://github.com/topics/icecream).

## Languages

Once you selected a topic you can further filter the projects `by language`. This means programming language as recognized by the [linguist](https://github.com/github/linguist) tool of GitHub. See what they say [about repository languages](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-repository-languages)

## Topics + Languages

If you are into Perl development you could select the [Perl](https://github.com/topics/perl) topic that lists 4,199 public repositories then you could further filter to [Perl language in the Perl topic](https://github.com/topics/perl?l=perl) that has 3,063 repositories. Then you could sort the project by popularity or last update time.

## Collections

[Collections](https://github.com/collections) are community curated lists of projects. For example [government apps](https://github.com/collections/government) or [Made in Africa](https://github.com/collections/made-in-africa) or [open journalism](https://github.com/collections/open-journalism).

## How do you pick projects to contribute to?

I would love to hear what is your method of picking a project to contribute to. Any of the above? Something else?