teleren/devto huggingface dataset:
Lesson 7: Contribute to open source projects on GitHub
Tags: osdc
Published: 2023-02-26 14:59:56

---
title: Lesson 7: Contribute to open source projects on GitHub
published: true
description: 
tags: #osdc
series: OSDC
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-12 15:18 +0000
---

## Contribute to projects on GitHub
### Contribute to dev.to

[dev.to](https://dev.to/) Is an open source project

We found an issue with auto save - so that when I write text, the system will automatically save it, or save changes but keep editing.

Built on [Forem](https://www.forem.com/)

Click the [github link](https://github.com/forem/forem)

Go to `Issues`

Before we open a new issue it is recommended to check if the issues was already addressed:

Use the `Filters` to search for the issue. Search for 'autosave'.

Can also search `Pull requests` or `Discussions`

### Contribute to zarr-python
(https://github.com/zarr-developers/zarr-python)

#### Advance pull-request locally

E.g. I find that somebody sent a pull request with a solution to my problem, but it's not advancing.

I can advance that pull request on my end:

```
git clone <the project's github url>
```

Fetch the pull request by its number
```
git fetch origin pull/1357/head
```
```
git checkout -b b1357 FETCH-HEAD
```
Now I'm in a branch that contains the pull request code change.

**FETCH_HEAD** is a special file inside the '.git' folder, that was created when I run `git fetch` and it contains the SHA of the pull request.

```
cat .git/FETCH_HEAD
```

Just like **HEAD** is a file which points to where I am currently located locally (which SHA).

```
cat .git/HEAD
```

Now I will merge the pull request with the main branch into a new branch
```
git checkout main
git checkout -b szabgab
git merge b1357
```
**HEAD** is a pointer to where I am currently in the git commits tree.

# Git Conflicts 
```
git merge <some branch>
```
Might cause conflicts. To resolve the conflicts, first locate the conflicting files:
```
git status
```
Edit the conflicting file:
```
vim <file with conflict>
```
Search for '>>>' or '<<<' and edit the file to resolve the conflict.


To cancel the merge that caused conflicts
```
git merge --abort
```

# Docker for running the project 

An example for a docker image created by @szabgab :

https://github.com/szabgab/mydocker

```
docker build -t mydocker .
```

An alias to run the docker 
```
alias dr='docker run -it --rm --workdir /opt -v$(pwd):/opt mydocker bash'
dr
```
# Tests
It is recommended to find out how to run tests locally. It is normally somewhere in the docs.

# Tests coverage report
**Codecov Report**

During the tests run on GitHub or GitLab, the source code is being analyzed for which lines of code run as a result of the tests run, meaning those lines of code are being tested. A report is generated with the percentage of lines that are being tested (lines of code that run during the tests).

It is recommended that the code coverage be closest to 100%.

Some code may be deprecated, hence its not tested, so the code should be removed.

Or, perhaps a new function was added without a test.
PowerFX - Pelo ChatGPT
Tags: powerfuldevs, fx, api
Published: 2023-02-26 14:50:17

Este artigo foi criado utilizando uma chamada via python usando Anaconda + JupyterNoteboook, a fins de educação e testes de comunicação com a API, (ressalto que este conteúdo não foi de autoria própria e sim de uma chamada via python utilizando chatgpt)

```
import openai
import os

openai.api_key = os.environ["sua chave de API aqui"]

def generate_response(prompt):
    completions = openai.Completion.create(
        engine="davinci",
        prompt=prompt, < sua pergunta aqui
        max_tokens=2048,
        n=1,
        stop=None,
        temperature=0.7,
    )
    message = completions.choices[0].text
    return message.strip()

```
Acima a chamada utilizada


A linguagem PowerFX é uma linguagem de programação de baixo código criada pela Microsoft. Ela foi projetada para permitir que usuários e desenvolvedores criem aplicativos e fluxos de trabalho de forma rápida e fácil, sem a necessidade de habilidades avançadas de codificação.

PowerFX é baseado na linguagem de programação Excel, utilizando fórmulas e funções para criar expressões que definem o comportamento dos aplicativos. Isso torna a linguagem fácil de entender para usuários familiarizados com planilhas do Excel.

Uma das principais vantagens da PowerFX é sua facilidade de uso. Ela permite que usuários e desenvolvedores criem aplicativos simplesmente arrastando e soltando componentes e conectando-os com expressões. Além disso, ela é altamente integrada com o Microsoft Power Platform, permitindo que os aplicativos criados na PowerFX sejam facilmente implantados em uma variedade de serviços e plataformas, incluindo o Microsoft Teams e o Dynamics 365.

A PowerFX também é altamente escalável e extensível. Ela pode ser usada para criar aplicativos simples de uma única página ou aplicativos complexos de várias páginas com recursos avançados, como banco de dados e integração com outras ferramentas e serviços.

Uma das principais limitações da PowerFX é que ela é uma linguagem relativamente nova e, portanto, não possui a mesma quantidade de recursos e documentação disponíveis como outras linguagens de programação mais estabelecidas. No entanto, a Microsoft está investindo em recursos para aumentar a adoção da linguagem, incluindo tutoriais, documentação e uma comunidade ativa de usuários e desenvolvedores.

Em resumo, a PowerFX é uma linguagem de programação de baixo código que oferece uma maneira fácil e rápida de criar aplicativos e fluxos de trabalho para usuários e desenvolvedores sem habilidades avançadas de codificação. É altamente integrada com o Microsoft Power Platform e pode ser usada para criar aplicativos simples e complexos com recursos avançados. Embora seja relativamente nova, a Microsoft está investindo em recursos para aumentar sua adoção e expandir sua funcionalidade.
Amazon ECS Service Connect Enabling Between Microservices
Tags: aws, cloud, kubernetes, devops
Published: 2023-02-26 14:34:50

Amazon Elastic Container Services (Amazon ECS) customers have several solutions for service-to-service, but each one comes with some challenges and complications:
 1) Elastic Load Balancing (ELB) needs to carefully plan for configuring infrastructure for high availability and incur additional infrastructure cost.
2) Using Amazon ECS Service Discovery often requires developers to write custom application code for collecting traffic metrics and for making network calls resilient. 
3) Service mesh solutions such as AWS App Mesh run outside of Amazon ECS despite having advanced traffic monitoring and routing features between services.

**Getting Started with Amazon ECS Service Connect**
To get started with the ECS Service Connect, you can specify a namespace as part of creating an ECS cluster or create one in the Cloud Map. A namespace represents a way to structure your services and can span across multiple ECS clusters residing in different VPCs. All ECS services that belong to a specific namespace can communicate with existing services in the namespaces, provided existing network-level connectivity.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52ikqxh3bir5cj0z8hbf.png)

You can also see a list of Cloud Map namespaces in Namespaces in the left navigation pane of the Amazon ECS console. When you select a namespace, it shows a list of services with the same namespace from two different ECS clusters with database services (db-mysql, db-redis) and backend services (webui, appserver).


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9ghxc9eo1576jsnoa57.png)

When you create an ECS cluster, you can select one of the namespaces in the Default namespaces of the Networking setting. ECS Service Connect is enabled for all new ECS services running in both AWS Fargate and Amazon EC2 instances. To enable all existing services, you would need to redeploy with either a new version of ECS-optimized Amazon Machine Image (AMI), or with a new Fargate Agent that supports ECS Service Connect.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpbb4uh1tratdpwawq2h.png)

More details- [ECS service connect](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html)

---
O que é o protocolo GraphQL?
Tags: api, javascript, graphql
Published: 2023-02-26 14:30:47

O protocolo GraphQL é uma linguagem de consulta de API e ambiente de tempo de execução, criado pela equipe do Facebook em 2012. Ele foi projetado para ser uma alternativa mais eficiente e flexível aos protocolos tradicionais de API, como o REST. Desde então, o GraphQL foi adotado por muitas empresas, incluindo grandes empresas de tecnologia, como GitHub, Shopify e Twitter.

O GraphQL permite que os clientes solicitem apenas os dados necessários em uma única solicitação, em vez de várias solicitações para diferentes endpoints como no REST. Com o GraphQL, os clientes podem especificar as informações de que precisam e a estrutura dos dados retornados, em vez de receber todas as informações disponíveis em uma API.

Isso é possível devido ao sistema de tipos de dados do GraphQL, que permite definir os tipos de objetos e campos em uma API. Cada tipo de objeto pode ter vários campos, que podem ser escalares (como números ou strings) ou referências a outros objetos. Com o GraphQL, os clientes podem especificar quais campos de um objeto eles precisam, e a API retornará apenas esses campos.

Por exemplo, suponha que uma API forneça informações sobre usuários e suas postagens. Usando o GraphQL, um cliente pode solicitar todas as postagens de um usuário específico e apenas os campos que são relevantes, como o título e a data da postagem. A solicitação seria semelhante a esta:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9mf638f5jnyex63mxzqx.png)


A resposta seria um objeto JSON contendo apenas os campos solicitados:



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xmd7xrzq8rlo60hx41yo.png)

O GraphQL também oferece recursos avançados, como fragmentos, que permitem que os clientes reutilizem partes de uma consulta em várias solicitações, e variáveis, que permitem que os clientes enviem valores dinâmicos para uma consulta.

Em resumo, o protocolo GraphQL é uma linguagem de consulta de API que permite que os clientes solicitem apenas os dados necessários em uma única solicitação. Ele oferece recursos avançados, como tipos de dados, fragmentos e variáveis, para tornar as consultas mais eficientes e flexíveis. Com sua adoção crescente, o GraphQL está se tornando uma ferramenta essencial para o desenvolvimento de API moderno.
Finding vulnerabilities on EC2 instance using Amazon Inspector
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-02-26 14:21:41

[57/100] #100DaysOfCloud Today, I ran Amazon Inspector and found vulnerabilities on EC2 instance.

Amazon Inspector Classic is an automated security assessment service that helps improve the security and compliance of applications deployed on AWS. Amazon Inspector Classic automatically assesses applications for exposure, vulnerabilities, and deviations from best practices. After performing an assessment, Amazon Inspector Classic produces a detailed list of security findings prioritized by level of severity. These findings can be reviewed directly or as part of detailed assessment reports, which are available via the Amazon Inspector Classic console or API.

<u>Use cases :</u>
- Quickly discover vulnerabilities in compute workloads
 - Automatically discover and quickly route vulnerability findings in near real time to the appropriate teams so they can take immediate action.
- Prioritize patch remediation
 - Use up-to-date common vulnerabilities and exposures (CVE) information combined with factors such as network accessibility to create context-based risk scores that help you prioritize and address vulnerable resources.
- Meet compliance requirements
 - Support compliance requirements and best practices for NIST CSF, PCI DSS, and other regulations with Amazon Inspector scans.
- Identify zero-day vulnerabilities sooner
 - Accelerate MTTR by using over 50 sources for vulnerability intelligence to help identify zero-day vulnerabilities quickly.

You can try do it by yourself by following the steps from the link below: [GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/057/Readme.md)
How to be a Shopify developer ?
Published: 2023-02-26 14:21:04

A Shopify developer is a web developer who specializes in building and customizing e-commerce websites using the Shopify platform. Shopify is a popular e-commerce platform that allows businesses to set up online stores to sell their products or services.

A Shopify developer works on designing, developing, and maintaining Shopify stores, including creating custom themes, developing custom apps, and integrating third-party tools and services.

They have a strong understanding of HTML, CSS, JavaScript, Liquid (Shopify's templating language), and other web development technologies. They may work independently or as part of a team to deliver high-quality Shopify solutions to clients or to build and market their own Shopify apps or themes.

A Shopify developer plays a crucial role in ensuring the functionality and user experience of a Shopify store, which directly impacts the success of an e-commerce business.

#### Here are the steps to become a Shopify developer:

1. Learn the basics of web development: As a Shopify developer, you will need to be proficient in HTML, CSS, JavaScript, and other web development technologies. You can learn these skills through online courses, tutorials, or by attending a coding bootcamp.

2. Familiarize yourself with Shopify's platform: You need to learn the ins and outs of the Shopify platform, including its themes, APIs, and app development tools. Shopify provides extensive documentation, resources, and tutorials to help you get started.

3. Join the Shopify Partner Program: Join the Shopify Partner Program, which provides access to resources, support, and opportunities to work with clients as a Shopify developer. You can also gain certification as a Shopify Partner to demonstrate your skills and knowledge.

4. Build your portfolio: Develop projects using Shopify, create custom themes and apps, and showcase your work in your portfolio. This will help you demonstrate your skills and attract potential clients or employers.

5. Network and market yourself: Attend industry events, join relevant communities, and leverage social media to connect with other Shopify developers, potential clients, or employers. You can also create a blog or podcast to share your expertise and build your reputation as a Shopify developer.

By following these steps, you can become a successful Shopify developer and build a rewarding career in e-commerce development.
How a single line code change, improved my performance
Tags: beginners, javascript, programming, webdev
Published: 2023-02-26 14:01:24

I was experimenting with javascript for a project i was working on. I tried to log 0 to 1 Million in console because, why not?

I ran the below code 

```javascript
console.time('time')
for (let i=0;i<=1000000;i++){
console.log(i)
}
console.timeEnd('time')
```

The above code will run from 0 to 1M and print's time taken to complete. You can see the output for the above code

```txt
0
1
2
...
...
...
999998
999999
1000000
time: 22588.629150390625 ms
```

You can see the above code ran for about ~22,588 milliseconds.
I tried running the same code multiple time and got an average of ~22,600 ms.

Instead of logging inside the loop I tried to move the log outside of the loop by concatenating numbers to a string

```javascript
console.time('time')
let output = ''

for (let i=0;i<=1000000;i++){
    output+=`${i}\n`
}

console.log(output)
console.timeEnd('time')
```


```txt
0
1
2
...
...
...
999998
999999
1000000
time: 286.9052734375 ms
```
As you can see above code ran *200%* faster then previous code

The reason, is that the first code logs each number to the console immediately as it is generated by the loop. This means that the console has to keep up with the loop and display each number as it is generated. This can be slow, especially when dealing with a large number of iterations. 

On the other hand, the second code uses a string to store all the numbers and newline characters, and then logs them in a single string. This approach is faster because it avoids the overhead of logging each number to the console separately.


In general, it's a good practice to avoid logging large amounts of output to the console, especially when dealing with large data sets. Instead, you can store the data in a data structure (like an array) and then process it later, or write it to a file for further analysis. This can help improve performance and avoid unnecessary overhead.


----
Thanks for reading, Please leave a like and share your thoughts in the comment section

<center> Happy coding </center>
---
gRPC GUI client
Tags: github, go, grpc
Published: 2023-02-26 12:54:07

I made my own GUI client [Warthog](https://github.com/Forest33/warthog), what can it do:

- Input generation for all types
- Input generation for nested and looped messages
- Automatic parsing of proto definitions to render services and input messages
- Execute unary, server streaming, client streaming and bidirectional requests
- Authentication: Basic, Bearer Token, JWT, GCE
- Kubernetes port forwarding
- Authorization in Google Cloud services

And much more...
Three amazing diagrams types you had no idea GitHub Markdown could create!
Published: 2023-02-26 12:10:34

## Introduction

Even though I use GitHub on a daily basis, I still get surprised sometimes. Today I found out that GitHub Markdown not only can create interactive maps but also 3D models. Grouping these together with plain old boring diagrams feels like a shame!

### Diagrams

Okay, you probably know about this one already, but if you didn't, let me be the first to tell you that GitHub can in fact be used to create flowcharts using Mermaid.js.

![Diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jywl0rgqear8lys43ci6.png)

### Maps

This was really news to me, not sure how often it will be helpful, but still really cool!

![Map](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09wfephrjd0il7yh7hji.png)

### 3D STL Models

As a 3D-printing lover, I just have to say that this is amazing! I've never even thought about version-controlling STL files, but if I do, I'll be sure to use this one!


![3D Model](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7aqgu7vmuuzlrpg6n6y0.png)


### Conclusion

Found this article interesting? Did you learn anything new? If so, please share the post and leave a comment down below with your thoughts!

All credits for the code examples go to the Creative Commons licensed GitHub docs, which you can find here: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting

I also created a GitHub repository containing the code examples used: https://github.com/caendesilva/incredible-github-markdown/blob/master/diagrams.md
Datastructures in Go using Generics
Tags: datastructures, go, generics
Published: 2023-02-26 12:05:33

I started a new series of videos explaining how to create *Datastructures* in *Go* using *Generics*. Go is a simple language that has low level features like pointers and yet simple due to its garbage collection and noise free syntax which is very similar to pseudocode. It makes the algorithms appear clear and concise.

These videos are in-detail live hands on videos where you get to see every line of code done to achieve the results. So these videos are a bit long but helps you to understand the process of coding it very well.

Check it out and share your feedback. If you want me to do any particular data-structure let me know. I'll do it

#Stack
{% embed https://www.youtube.com/watch?v=T_VKilU9KzI %}

#Queue
{% embed https://www.youtube.com/watch?v=FhjrGx9MLEo %}

#Goroutine-Safe Queue
{% embed https://www.youtube.com/watch?v=r03ccQeAOWI %}

#Singly Linked List 
{% embed https://www.youtube.com/watch?v=L973lpYSG9s %}
The difference between Spam and Scam
Tags: security, cybersecurity, digitalawareness
Published: 2023-02-26 12:04:20

## **Let's take a look at the difference between Spam and Scam:**

**Spam** and **Scam** are two commonly used terms in the digital world, but they have distinct meanings. Many people tend to confuse them, but understanding the difference between spam and scam is essential for protecting oneself from online threats.

Spam refers to unwanted, unsolicited, and repetitive emails or messages, or advertisements that are sent to a large number of people. Spam messages are sent for various purposes, including marketing, advertising, and phishing. In most cases, spam messages are sent without the user's consent and contain links to malicious websites, fake products, or services. Spam is annoying, and it clutters the user's inbox, but it is not necessarily harmful.

On the other hand, a scam is a fraudulent activity in which an individual or a group of individuals (cells) attempts to deceive people into giving away their money, sensitive information, or personal details. Scammers use various techniques, such as fake websites, fake emails, or phone calls, to lure people into their traps. They usually act as legitimate businesses, organizations, or government agencies to gain the user's trust. Once the user falls into their trap, scammers can steal their money, identity, or personal information.

The primary difference between spam and a scam is that spam is an annoying but harmless nuisance, while a scam can cause significant financial and emotional damage. Spam is usually sent in bulk to a large number of people, and their messages can be easily filtered and blocked. while scammers target specific individuals or groups, and they are more sophisticated and require more caution to detect.

## **To protect yourself from spam and scams, it is important to take some precautions, such as:**

1. - Never share personal information, passwords, or credit card details with anyone online.
2. - Do not click on links or download attachments from unknown sources, use link checkers for safety like "[https://www.psafe.com/dfndr-lab/](https://www.psafe.com/dfndr-lab/)".
3. - Use anti-spam and anti-virus software to protect your devices from online threats.
4. - Be cautious of unsolicited messages, emails, or phone calls, even if they seem to be from a legitimate source.
5. - Use strong passwords and two-factor authentication or biometric authentication to secure your online accounts.

In conclusion, spam and scams are two different types of online threats that require different levels of caution and protection. While spam is an annoying nuisance, a scam can cause significant financial and emotional damage. By being cautious and following the above precautions, one can protect himself from these threats and enjoy a safe and secure online experience.
Installing docker and postgresql on Parrot OS
Tags: help, postgres, docker
Published: 2023-02-26 11:44:29

Help! I've been trying to install Docker and Postgresql on Parrot OS but have failed the whole day. Anyone have good resources or tips? Found this [gist](https://gist.github.com/nuga99/dd5ac250b4c98154b5065d8affec7b49) but it still won't install. Any help would be appreciated big time!