teleren/devto huggingface dataset:
Starting from nowhere
Tags: cybersecurity, beginners, hackthebox, uva
Published: 2023-04-20 16:22:14

Starting a blog... I haven't done anything like this since I was a kid, but I do want to track my progress. 

So lets start with an introduction, shall we?

My name is Chiwoo Chang, and I am a CS student at the University of Virginia. I am majoring in Computer Science, and minoring in Data Science, and am planning on obtaining the Cybersecurity Certificate at the end of the year.

I feel like one of the biggest factors that lead people to stop doing anything is the fear of the unknown. Beginning from nowhere. Well, I guess I'm doing exactly that. I do have some brief/basic knowledge of Cybersecurity concepts, but basically 0 technical skills. Shoutout to my friend @SShad0w for putting me on, but lets start by practicing the basics. 

I also will upload progress videos on my youtube, so check that out. All my links are on it as well.

YT - https://www.youtube.com/channel/UCCS-q7NCUlINQlXdAntUI1Q
Maximize your Angular code reusability using <NgTemplateOutlet>
Tags: angular, component, ngtemplateoutlet, reusability
Published: 2023-04-20 16:18:47

# Introduction 📕:
As our application grows and we  need complex and rich UI nowadays, as our code lines increase and we found out ourselves in a situation of code duplication, we need to implement reusable components that can be easily shared across the application.

So in this blog, we will explore how we implement reusable and customizable components with `NgTemplateOutletdirective`.



Continue reading on [medium](https://medium.com/gitconnected/maximize-your-angular-code-reusability-using-ngtemplateoutlet-536fcf3ac789)  »
Pandas vs SQL
Tags: python, programming, datascience
Published: 2023-04-20 15:42:35

## Overview
   Both Pandas and SQL are two of the most import tools used in data science and machine learning. However, the only thing these two have in common that they both work on data that is represented in the form of tables. 

## What is Pandas?
   Pandas is an open source Python Package that is used mostly for data analytics and machine learning. This library provides a huge set of inbuilt functions that allow easy to perform complex operations. Typically, it will be used to read .csv data files. Pandas features include data cleansing, merges and joins, data inspection and statistical analysis. The only downside of pandas is that collecting large amount of data can be tricky.

## What is SQL?
   Unlike Pandas, SQL is a programming language that is used for database creation and manipulation. Typically SQL will read data that is stored in RDBMS files. While Pandas support row and column metadata, SQL only support column metadata. This language is utilize for fast query data processing. Basically, it allows you to collect a lump sum of data without too much issues. Performing complex operations however isn't as easy to do compared to Pandas. 

## Example (Select)
   With Pandas, selecting columns can be done simply by passing a list of the column names into your DataFrame. For this example we are going to take a DataFrame called teams and select the wins and loses columns for each row.

```
import pandas as pd

teams[["wins","loses"]]
```
  Compare this to SQL, selecting columns would be done by using a list separated by commas.

```
SELECT wins, loses 
FROM teams;
```

---
```
Output:
     wins    loses
0     23      10
1     19      14
2     20      13

[3 rows x 2 columns]
```
## Conclusion
   While there are some key differences between both Pandas and SQL, both are extremely vital in the world of data science and machine learning. If you are interested in working with Pandas and SQL, I will provide a links at the bottom where you can learn more about them. 


- https://pandas.pydata.org/docs/getting_started/install.html

- https://www.jetbrains.com/datagrip/features/mysql.html
Vale a pena testar o estilo no Front-end?
Tags: testing, style, tdd, frontend
Published: 2023-04-20 15:40:25

Não é novidade para ninguém que quanto mais testes automatizados sua aplicação possui, melhor é a confiança e segurança ao realizar alterações e refatorações no código.

Porém, não basta só escrever testes automatizados, mas sim, escrever de forma correta. Para isso, é muito importante entender os conceitos de testes automatizados. Por sorte, temos uma ilustração que mostra isso perfeitamente.

<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb9s3e3isvfzz787gob2.png">

Onde eu quero chegar com isso? A grande parte dos testes automatizados devem ser compostos de testes unitários devido ao seu feedback rápido (conforme podemos visualizar na pirâmide de testes). Mas não somente testes unitários, podemos também mencionar os testes de UI e testes de estilização!

###A grande questão é, o quanto devo validar a minha estilização? Devo cobrir 100% da estilização?


**Como sempre, a resposta é...depende!**

Conheço alguns dev's que costumam testar a aplicação de ponta a ponta, desde a estilização até os testes e2e (end-to-end). Já eu, não costumo testar a estilização das minhas aplicações, há não ser que faça parte de um comportamento funcional.

Como exemplo irei falar sobre um cenário que passei recentemente:

Nós que desenvolvemos aplicações de multiplataformas, devemos sempre nos preocupar se o design está conforme esperado. Principalmente quando falamos de Android e iOS.

Querendo ou não, sempre existe uma diferença de espaçamento ou design etc., entre as plataformas. E é aí que podemos utilizar os testes automatizados para validar esse comportamento de acordo com a plataforma especificada, que foi o meu caso.

Então, em vez de eu ficar validando visualmente conforme a plataforma especificada... Como um adotante do TDD (Test-Drive Development), comecei a escrever os testes de UI para estes comportamentos que variam conforme plataforma.

Assim, me assegurei que o que estava funcionando na plataforma Y, continuaria funcionando. E ao implementar para a plataforma X, não impactaria o que foi feito para a plataforma Y.

Portanto, entendo que os testes automatizados e em específico: testes unitários, testes de UI etc., devem validar o comportamento da funcionalidade. Se o estilo da aplicação muda conforme algum comportamento ou regra de negócio, seria interessante ter um teste automatizado para validar o mesmo.

Até a próxima.
Send Email using Django & Mailgun - Easy and Free
Tags: django, mailgun, anymail, sendmail
Published: 2023-04-20 15:32:09

In this short posts i would be showing how to quickly send email to email addresses using django, malgun and anymail packages.

[Anymail](https://github.com/anymail/django-anymail) lets you send and receive email in Django using your choice of transactional email service providers (ESPs). It extends the standard django.core.mail with many common ESP-added features, providing a consistent API that avoids locking your code to one specific ESP (and making it easier to change ESPs later if needed).

Anymail currently supports these ESPs:

Amazon SES
MailerSend
Mailgun
Mailjet
Mandrill (MailChimp transactional)
Postal (self-hosted ESP)
Postmark
SendGrid
SendinBlue
SparkPost

[Mailgun ](https://www.mailgun.com/)is an email automation service built for developers. It offers a complete cloud-based email service for sending, receiving and tracking emails sent through your websites and applications. Mailgun's intelligent inbound routing and storage enables you to know exactly where your emails are ending up.

And finally [Django](https://www.djangoproject.com/start/) is a free and open-source, Python-based web framework that follows the model–template–views architectural pattern and trust me it is really awesome i'd say.

Let's quit talking and get to work

1. Firsly, you need to install the anymail package 
```
pip install "django-anymail[mailgun]"
```

2. Add anymail to django installed app 
```
INSTALLED_APPS = [
    # ...
    "anymail",
    # ...
]
```

3. In your **settings.py** add your `Mailgun` api keys and sanbox domains for testing purposes
```
ANYMAIL = {
    "MAILGUN_API_KEY": "api_key_305834958304534",
    "MAILGUN_SENDER_DOMAIN": 'sandbox467c****.mailgun.org',  
}
EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend" 
DEFAULT_FROM_EMAIL = "your-sender-email@example.com" 
SERVER_EMAIL = "your-sender-email@example.com"  
```

NOTE: you would need to create an account with mailgun, after successful account creation, follow these steps
i. Login to dashbaord 
ii. Sendig 
iii. Domain (suboption)
iv. CLick on the sandbox domain url
v. CLick on the api keys
vi. Copy your secret api key and paste above.

For testing purposes, you need to add the recipient email address in the box at the right side of the dashboard
Here is an image

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

If you have a paid account, you do not need to do this.

After all these are done, create a simple function based view to send the email in views.py
```
from django.core.mail import EmailMultiAlternatives, send_mail
def send_mail_func(request):
    ...
    send_mail("New Order!", "Hey buddy, you have a new order",
          "sender-email@gmail.com", ["reciever-email@gmail.com"])
    return HttpResponse("Email Sent")
```

COnfigure the url, and visit this page on your browser.
It should be working now, it did for me.

Here is the [anymail ](https://anymail.dev/en/stable/)api [doc](https://anymail.dev/en/stable/)
Understanding the Importance of the Docker .env File in Your Application
Tags: docker
Published: 2023-04-20 15:28:56

The word Docker is synonymous with containerized applications and image files, so it's easy to forget that the company that developed the technology, [Docker](https://thenewstack.io/what-is-the-docker-env-file-and-how-do-you-use-it/), has built a complete container application environment and set of development tools.

Containerized applications are typically composites of components; each requires a software image and configuration file that sets storage, networking, service dependencies, and resource requirements.

## Compile environment variables

Environment variables are used in every programming language as an abstraction layer to allow IT administrators to change parameters in software or configuration without changing the underlying code.

In Docker, IT administrators can use environment variables to generalize configurations for different situations, deployment environments, and security contexts without manually editing the main project files.

Variables can be passed either as command-line arguments -- suitable for just a few parameters -- or via a .env file, preferred for more complicated configurations.

## Advantages of using environment variables in Dockerfile

The most significant advantage of using environment variables is flexibility. We can create only one Dockerfile configured differently depending on the environment used to build the container.

With environment variables, we only need to make one Dockerfile that will pass an environment variable holding the debug flag to the container and the application inside.

As an illustration, let's imagine an application with debug options enabled in the development environment and correct possibilities disabled in the production environment.
"Focus on the project more than the type of company" — Agree or disagree?
Tags: discuss, healthydebate, career
Published: 2023-04-20 15:09:28

Hey folks, I wanted to ask what people think of this overall assertion from a recent thread about [startup vs corporate](https://dev.to/codenewbieteam/would-you-rather-work-in-a-small-startup-or-a-large-corporation-kcn) jobs.

{% embed https://dev.to/alvaromontoro/comment/25p4m %}

What do you think?
Leetcode - Contain With Most Water
Tags: algorithms
Published: 2023-04-20 14:42:28


Here is the link to the description: https://leetcode.com/problems/container-with-most-water/description/

```c++
class Solution {
public:
    int maxArea(vector<int>& height) {
        int i = 0, j = height.size() - 1;
        int maximum_area = 0;
        while (i < j){
            int current_area = (j - i) * min(height[i], height[j]);
            maximum_area = max(maximum_area, current_area);
            if (height[i] <= height[j]){
                i += 1;
            }
            else if (height[i] > height[j]){
                j -= 1;
            }
        }
        return maximum_area;
    }
};
```

## Explanation
By brute-forcing, we could select all the possible combinations of the two lines. However, this is not the best idea based on the contstraints that `2 <= n <= 10^5`. The time complexity of the brute-force approach is `O(n^2)`.
Greedy approach reduces the time complexity to `O(n^2)`. First, let's say we have the pair `(left_line, right_line)`. left_line points to the first line(0) and right_line points to the last line(n-1). Then we find the smaller ones between the two lines. If `left_line < right_line`, we move `left_line` to the right by one since it's meaningless to move right_line to the left because the height of the container would stay the same and the width would decrease.

## Proof by loop invariant. 
If the following condition holds true at the beggning and the end of each itertion, we can prove that the algorithm finds the answer.

**`maximum_area` has the maximum amount of water or the lines that can have the maximum amount of water is within the range (i,j)**

- Base case: for the first iteration the condition holds true.
- Induction case: Suppose our condition is true for kth iteration. Let's assume maximum amount of water is not in `maximum_area` otherwise the proof would be trivial.
for (k+1)th iteration, it would be still true since if height[i] <= height[j], decreasing j leads give less amount of water and if height[i] >= height[j], increasing i give less amount of water as well. So the best area is still between [left_area, right_area] after the iteration.
System Design for chat system
Tags: designsystem, webdev
Published: 2023-04-20 14:26:16

The system design process has the following pattern:

Gather Requirement

Capacity measurement

Propose High-level design

High-level Design

a.Technology selection

b.Service selection

c.Think of scalability

d.Storage selection

API Design

Data Modal

Requirements:

1) Kind of chat -> 1-1 chat and group chat

2)Should support 70 million daily active users

3)Group of max 200 peoples

4)System should allow only text messages

5)Maximum 5000 chars

6)History should available forever.

Propose a very high-level design and buy-in

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

For a chat system, client needs to connect chat service using one or more network protocols and choice of network is important.

HTTP Protocol communication is very common. Client can initiate HTTP connection by providing a keep-alive header to keep the connection persistent. Initially, Many company started http protocol but it is not reliable.

Since the Http connection is initiated by the client end so from receiver side it is very difficult and it is not trivial to send message from the server. Server-initiated connection are used to persistent connection and easy to send and receive message.

There are few technique- Polling, long polling , and Websocket.

Websocket is the most common solution for sending asynchronous updates from server.

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

Next will post on Service and Storage selection.......
Teamhood - Unique approach to Kanban project management
Tags: tooling
Published: 2023-04-20 14:05:44

Visualize your process and track progress. Teamhood is free to use for unlimited users.
[Try now](https://teamhood.com/use-cases/kanban-system/)

Here is a short video highlighting how Teamhood can be used to set up simple and advanced Kanban boards for your needs. 

{% embed https://youtu.be/wctNYEWthjs?si=v2c3qxOfasdxwI8P&utm_source=devto&utm_medium=video&utm_campaign=distribution %}
What is wildfire vpn?
Published: 2023-04-20 13:44:19

# [What is Wildfire VPN?](https://jessicaforum.com/what-is-wildfire-vpn/)

Wildfire VPN is a virtual private network (VPN) service that provides a high level of online privacy and security to its users. It does this by encrypting internet traffic and routing it through a remote server located in a different country, thereby masking the user's IP address and location.

The primary objective of Wildfire VPN is to protect the user's online privacy and security, particularly when using public Wi-Fi networks or accessing sensitive information. Public Wi-Fi networks are notorious for being unsecured, which puts users' data at risk of being intercepted by hackers and other third parties. By using Wildfire VPN, users can create a secure connection between their device and the internet, which prevents unauthorized access to their data.

In addition to protecting users' privacy and security, Wildfire VPN also allows them to access geo-restricted content by providing them with a foreign IP address. Geo-restrictions are used by content providers to limit access to their content based on the user's location. With Wildfire VPN, users can bypass these restrictions and access online content that may not be available in their country, such as streaming services or websites.

Moreover, Wildfire VPN offers several features that enhance the user's online experience. For example, it has an ad-blocking feature that blocks advertisements from appearing on the user's device, which can improve browsing speeds and reduce data usage. The VPN service also comes with malware protection, which detects and removes malicious software that could compromise the user's device or data. Additionally, Wildfire VPN includes a kill switch feature that automatically disconnects the user's device from the internet if the VPN connection is lost. This prevents the user's data from being exposed in case of a connection failure.

Overall, Wildfire VPN is an excellent tool for anyone who values their online privacy and security. It provides a fast and reliable VPN service with numerous features that enhance the user's online experience. With Wildfire VPN, users can surf the web with peace of mind, knowing that their data is secure and their privacy is protected.
Running many WebSocket servers
Tags: websocket, koa, backend
Published: 2023-04-20 13:37:01

At Woovi, we have 7 frontends, and each frontend has their own server.
To provide a better DX, we run all the servers inside only one server in development.
Our solution to handle many WebSocket servers in the same server is to have 1 WebSocket server per endpoint.

## WebSocket Server per endpoint

```jsx
import http from 'http';

import WebSocket, { WebSocketServer as WSWebSocketServer } from 'ws';

// work with commonjs and esm
const WebSocketServer = WebSocket.Server || WSWebSocketServer;

export const createWebsocketMiddleware = (
  propertyName = 'ws',
  options = {},
) => {
  if (options instanceof http.Server) options = { server: options };

  const wsServers = {};

  const getOrCreateWebsocketServer = (url: string) => {
    const server = wsServers[url];

    if (server) {
      return server;
    }

    const newServer = new WebSocketServer({
      ...(options.wsOptions || {}),
      noServer: true,
    });

    wsServers[url] = newServer;

    return newServer;
  };

  const websocketMiddleware = async (ctx, next) => {
    const upgradeHeader = (ctx.request.headers.upgrade || '')
      .split(',')
      .map((s) => s.trim());

    if (~upgradeHeader.indexOf('websocket')) {
      const wss = getOrCreateWebsocketServer(ctx.url);

      ctx[propertyName] = () =>
        new Promise((resolve) => {
          wss.handleUpgrade(
            ctx.req,
            ctx.request.socket,
            Buffer.alloc(0),
            (ws) => {
              wss.emit('connection', ws, ctx.req);
              resolve(ws);
            },
          );
          ctx.respond = false;
        });
      ctx.wss = wss;
    }

    await next();
  };

  return websocketMiddleware;
};
```

Usage

```jsx
const app = new Koa();

app.use(createWebsocketMiddleware());

const routes = new Router();

routes.all('/ws', async (ctx) => {
   if (ctx.wss) { // check if this is a websocket connection
      // connect to websocket - upgrade
      const client = await ctx.ws(); 
   }
});
```

Let's deep dive:

`getOrCreateWebsocketServer` get an existing WebSocket Server or create a new one based on URL
`upgradeHeader` checks if the request wants to use WebSocket
`wss.handleUpgrade` upgrades the requests to use WebSocket


## To sum up
This is a generic approach, that let you have many WebSocket Server in a single server per endpoint.
It can be used in localhost to improve DX or even in production if you don't have much traffic.

---
Woovi
[Woovi](https://www.woovi.com) is a Startup that enables shoppers to pay as they like. To make this possible, Woovi provides instant payment solutions for merchants to accept orders.

If you want to work with us, we are [hiring](https://woovi.com/jobs/)!

---
Photo by <a href="https://unsplash.com/@photo_tanbir?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Tanbir Mahmud</a> on <a href="https://unsplash.com/photos/fnUT40XljnI?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Easily connect to RDS using ECS on Fargate
Published: 2023-04-20 13:22:50

Fargate's SSM Agent version has been updated to version 3.1.1732.0 or later, enabling port forwarding to remote hosts.
https://aws.amazon.com/jp/about-aws/whats-new/2022/05/aws-systems-manager-support-port-forwarding-remote-hosts-using-session-manager/

However, it is quite cumbersome to set up the necessary ECS components to connect to RDS using Fargate. You need to create an ECS cluster, service, task definition, the required roles, and enable ECS Exec, among other things.

To simplify this process, I've created a CLI tool that automatically sets up a Fargate bastion host when specifying the RDS endpoint.

https://github.com/wim-web/xpx

You can set up the environment for forwarding to the specified host by simply running the following command:

```
xpx tunnel --host hoge.ap-northeast-1.rds.amazonaws.com
```

![](https://github.com/wim-web/xpx/raw/main/img/demo_.gif)

When you terminate the process, the CLI will also clean up the resources created. It's very convenient.

If you already have a bastion Fargate instance running and are executing `aws ssm start-session --target ${target} --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters ${parameters} --region ${REGION}`, you can use this CLI:

https://github.com/wim-web/tonneeeeel

It allows you to interactively select ECS clusters, containers, and more, enabling forwarding and ECS Exec.

There is a similar CLI called "ecsta," but I created "tonneeeeel" because I wanted to filter interactively like a fuzzy finder. However, with "ecsta," you can achieve the same functionality by specifying options like "filter_command" for tools like peco.

https://github.com/fujiwara/ecsta
Suggestions??
Tags: discuss
Published: 2023-04-20 13:08:54

I am having very basic skills of web developement as an frontend developer and i want to learn and earn but i dont know how should i proceed i an very confused 
its very hard for me to learn and i still dont get how can i practise i started practice for DSA but im not good at solving problems either so i am frusrtrated or demotivated how should i proceed further 
??