teleren/devto huggingface dataset:
Node.js logger for Discord
Tags: node, javascript, showdev
Published: 2020-06-09 18:07:32

I wrote a small library to send Node.js application logs to Discord in a structured format.

Github Project - https://github.com/sidhantpanda/node-discord-logger

### Features:
* 6 levels of logging
* Send complete error stack to Discord
* Send JSON objects which will be pretty-printed in Discord
* Configure meta data such as machine hostname, process id to be sent with every request


### Some example messages.

* Error Message
![error message example](https://raw.githubusercontent.com/sidhantpanda/public/master/img/projects/node-discord-logger/error-message.png)

* Warning Message
![warning message example](https://raw.githubusercontent.com/sidhantpanda/public/master/img/projects/node-discord-logger/warning-message.png)

* Debug Message
![debug message example](https://raw.githubusercontent.com/sidhantpanda/public/master/img/projects/node-discord-logger/debug-message.png)

* <a name="usage_example_info_message"></a>Info Message
![info message example](https://raw.githubusercontent.com/sidhantpanda/public/master/img/projects/node-discord-logger/info-message.png)

* Verbose Message
![verbose message example](https://raw.githubusercontent.com/sidhantpanda/public/master/img/projects/node-discord-logger/verbose-message.png)

* Silly Message
![silly message example](https://raw.githubusercontent.com/sidhantpanda/public/master/img/projects/node-discord-logger/silly-message.png)
The SQL databases vs NoSQL databases [Difference]
Tags: nosql, sql, mongodb, database
Published: 2020-06-09 17:51:01

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0ywzfd6lieud01adcx9n.JPG)

SQL databases: SQL databases use structured query language (SQL) for defining and manipulating data. On one hand, this is extremely powerful: SQL is one of the most versatile and widely-used options available, making it a safe choice and especially great for complex queries.

 

NoSQL databases: NoSQL databases have dynamic schemas for unstructured data, and data is stored in many ways: They can be column-oriented, document-oriented, graph-based or organized as a KeyValue store. This flexibility means that,

1.     You can create documents without having to first define their structure
2.     Each document can have its own unique structure
3.     The syntax can vary from database to database, and
4.     You can add fields as you go.
Twitch Show: @Azure, Social Issues and Observability - Guest @austinlparker - AzureFunBytes Reminder!
Tags: nextjs, tutorial, beginners, azure
Published: 2020-06-09 17:50:51

Remember to check out [AzureFunBytes](https://twitter.com/azurefunbytes), a weekly Twitter 2:30 minute video on [Twitter](https://twitter.com/azurefunbytes) and [Twitch](https://www.twitch.tv/azurefunbytes) show on Azure Fundamentals every Thursday at 2pm EDT.  [You can see last week's episode on Azure Storage, here!](https://dev.to/azure/azurefunbytes-episode-1-jay-covers-azure-storage-and-solves-three-problems-using-it-539g) 

Today on my stream, I am joined for a conversation about social issues and observability with [Austin Parker](https://twitter.com/austinlparker).  I also spend time discussing [Azure Resource Group Management](https://docs.microsoft.com/azure/azure-resource-manager/management/overview?WT.mc_id=twitter-ca-social-jagord) and build an [Azure Static Web App](https://azure.microsoft.com/services/app-service/static/?WT.mc_id=twitter-ca-social-jagord).  

A video and blog post dedicated to Static Web Apps can be found [here along with links!](https://dev.to/azure/deploy-next-js-with-azure-static-web-app-service-and-github-actions-32j0)

{% youtube 5yrOQZ1UiXY %}

## Links and More!

- Microsoft Learn: [Azure Fundamentals](https://docs.microsoft.com/learn/paths/azure-fundamentals/?WT.mc_id=blog-devto-jagord)
- Microsoft Learn: [Deploy Static Web App](https://docs.microsoft.com/en-us/learn/modules/publish-app-service-static-web-app-api/?WT.mc_id=devto-blog-jagord)
- Microsoft Docs: [App Service Documentation](https://docs.microsoft.com/azure/app-service/?WT.mc_id=blog-devto-jagord)
- [GitHub Actions Documentation](https://help.github.com/en/actions)
- [Get 12 Months of free service and $200 for Microsoft Azure](https://azure.microsoft.com/free/?WT.mc_id=blog-devto-jagord)
- [AzureFunBytes](https://twitter.com/azurefunbytes) on Twitter
- [AzureFunBytes](https://www.twitch.tv/azurefunbytes) on Twitch
- [Jay Gordon](https://www.twitch.tv/jaydestro) on Twitch
- [Jay Gordon](https://www.youtube.com/channel/UCJb-wY2KO2soCZichdCNR1A?view_as=subscriber) on YouTube
Oportunidade de mentoria em Desenvolvimento de Software
Published: 2020-06-09 17:49:19

Olá!

Eu me estou disponibilizando gratuitamente para ser mentora para pessoas desenvolvedoras de software, ou pessoas que tem interesse em começar na área.

A ideia é termos 30 min ou 1h por semana para tirar dúvidas, conversar sobre carreiras, treinar inglês ou até parear na resolução de algum problema de código. É importante notar que a minha intenção não é dar aulas, mas apenas apoiar na jornada da pessoa mentorada.

Pessoas interessadas devem entrar em contato comigo pelo email sarah.lima@thoughtworks.com com o assunto "Mentoria", com uma pequena introdução sobre você e quais são seus objetivos de carreira e aprendizado (não precisa ser nada elaborado, relaxa!). Provavelmente não poderei atender todas as pessoas, e por isso, darei prioridade a pessoas pertencentes a minorias em tecnologia. 

Ps.: Estou começando esse projeto em fase experimental, e não posso me comprometer a continuar a oferecer essa mentoria a longo prazo. 

Conheça sobre mim [aqui](https://dev.to/sarahraqueld/meus-primeiros-5-anos-como-desenvolvedora-1ll0).
How to serve a JavaScript build with Apache
Tags: devops, javascript, apache, linux
Published: 2020-07-16 12:01:49

---
title: How to serve a JavaScript build with Apache
published: true
date: 2020-06-09 17:44:58 UTC
tags: devops,javascript, apache, linux
canonical_url: https://boobo94.github.io/devops/serve-a-javascript-build-with-apache/
---

To serve a JavaScript build with Apache is a very simple task and today I want to present you a very simple way of achieving that.

```
<VirtualHost *:80>
        ServerName subdomain1.example.com
        ServerAlias subdomain2.example.com

        RewriteEngine on
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName subdomain1.example.com
        ServerAlias subdomain2.example.com

        DocumentRoot /var/vhosts/www/client
        <Directory />
                DirectoryIndex index.html
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>
```

If you consider this helpful please give it a share. For any question or discussion please consider the comments section.

The post [How to serve a JavaScript build with Apache](https://boobo94.xyz/devops/serve-a-javascript-build-with-apache/) appeared first on [boobo94](https://boobo94.xyz).
Using Python for Competitive Coding
Tags: python, competitiveprogramming, tricks, productivity
Published: 2020-06-09 17:41:01

I recently started using Python for *competitive coding*.These are some of *minor tips and tricks* that I have learnt to improve speed in Python and also different ways to could you run the test cases.
This would help with those TLE(Time Limit Exceeded).

Consider the following trivial problem:
> Given a list of numbers, find the absolute minimum difference.

The first line contains the number of test cases. For each test case the first line is a single integer indicating number of numbers in list, and the second and final line contains list of numbers separated with space.


*testcase*
```console
2
5
1 2 5 6 8
7
2 3 5 6 8 99 26
```

*sol.py*
```python
t = int(input())

for _ in range(t):
    n = int(input())
    arr = list(map(int, input().split()))
    arr.sort()
    mini = float('inf')
    for p, n in zip(arr, arr[1:]):
        mini = min(mini, abs(n-p))
    print(mini)
```

This is one method to run the code with the given inputs from a *file*.
```console
$ python sol.py < testcase
```

To improve the *read* and *write* calls add the following code:
```python
import sys

sys.stdin = open('testcase', 'r')

input = lambda : sys.stdin.readline().strip()
print = lambda s, end='\n' : sys.stdout.write(str(s) + end)
```
This won't disrupt your current code and will improve the reading and writing speed(Test locally before submitting).
The line with `sys.stdin = open('testcase', 'r')` would enable to read directly from file instead of terminal.

If you are using vim editor, you can put the following line in your .vimrc configuration file and could run the file using *t* in command mode. And you would never have to leave the editor.
```console
autocmd Filetype python nmap t <Esc>:w<CR>:!clear;python3.6 %<CR>
```
(Change the python as per as your environment, e.g, python3 or python; Modify as per requirement)

If not using IDE or other editors, you could directly run on terminal as:
```console
$ python sol.py
```

While submitting the code, just comment the line with
`sys.stdin = open('testcase', 'r')` and you are good to go.

Use similar techniques as suitable to your environment for improving *productivity* while using Python for competitive coding.

If you work even *faster* and not waste time in commenting, use this

```python
import sys

try:
    sys.stdin = open('testcase', 'r')
except:
    pass
```

If the *file* exits it would take input from the file, else keep it unchanged.

I have battle tested the code on *codechef*, so the above tricks won't be a problem on similar platforms. If facing any problem comment below with the same.

P.S : There are some limitations to use the _print_ function, such as using _sep_ argument, passing comma separated values to print, but they are hardly required in competitive coding. Some easiness to lose to gain some speed. You could tweak it as per your needs.
MySQL with Docker Compose
Tags: docker, mysql
Published: 2020-06-09 17:32:32

Hey Folks!

I want to share a very simple way to create a MySQL instance using Docker Compose.

Create a file named `docker-compose.yml` with the code bellow. You should replace the *\<secret_pass\>* to a safe password for MySQL *root* username. 

```yml
version: '3.1'
services:

  mysql_db:
    image: mysql
    restart: always
    container_name: mysql_container
    environment:
      MYSQL_ROOT_PASSWORD: <secret_pass>
    ports:
      - "3306:3306"
    volumes:
      - mysql_db_data:/var/lib/mysql

volumes:
  mysql_db_data:
```

Type in your terminal `docker-compose up` to start and `docker-compose down` to stop the container.
Use `docker rm mysql_container -f` if you want to remove the container.

You can use [MySQL Workbench](https://dev.mysql.com/downloads/workbench) to access the database using the username as `root` and password as `<secret_pass>`.

But if you want to simplify the data visualization is possible to use an **Adminer** container, see:

```yml
version: '3.1'
services:

  mysql_db:
    image: mysql
    restart: always
    container_name: mysql_container
    environment:
      MYSQL_ROOT_PASSWORD: <secret_pass>
    ports:
      - "3306:3306"
    volumes:
      - mysql_db_data:/var/lib/mysql
    networks:
      - mysql_network

  adminer:
    image: adminer
    ports:
      - 8006:8080
    networks:
      - mysql_network

volumes:
  mysql_db_data:

networks:
  mysql_network:
    driver: bridge
```

Access through [http://localhost:8006](http://localhost:8006) and use the credentials defined before.

Have fun!
is everything well for ssh security?
Tags: ssh, linux, security, computerscience
Published: 2020-06-09 17:15:11

I have a question about the situation on an ssh connection. First, I install openssh-server on a Debian (buster) machine, let called as ServerMach, then I connected to the ServerMach by another Debian client. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p97fq9901eiuhfw5vjj8.png)

After successful connection established between client and server(time 18:40:56), I just stop  ssh.services on the ServerMach (when 18:41:00) and I expect for the connection loss.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/k4cth2n1lu7v35m6qo2h.jpg)

Then, I sent some further command from client machine to the ServerMach and the commands executed well. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5ep1p2s4cxr2vuo2yvo7.jpg)

When I looking the service status, the ssh service is down on the ServerMach while the connection seems Up in processes. In addition reverse connection, which is from server to client is also active as seen below. ( "wall demo" command is executed on the server and the strings printed out to the client terminal, seen in the image above)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ro5xi6p1izdev03a4b61.png)

Then I just kill the ssh process on the client side terminal and connection now broken.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zi68t3xwhcqdk8cgmgu1.jpg)

So, the question is that: There is something wrong with ssh or sshd configurations or that is an expected case for ssh connections?

----
Further, if an attacker open an ssh connection on target machine and they just set different port and process name for the blind ssh connection. Then, if he/she run the new blind ssh connection with changed/hidden process name and port. Let the defensive side (the protector) catch the attacker's initial ssh connection but without the blind connection information. How the defender side block or shutdown the remote connection (attacker's blind ssh connection)?

I think when the ssh.services stopped on a server all the connections should be terminated, otherwise there will be a vulnerability.
Replica Sets explained in plain English - with Phippy and friends
Tags: kubernetes, beginners, tutorial, devops
Published: 2020-06-09 17:14:45

---
title: Replica Sets explained in plain English - with Phippy and friends
published: true
description: Replica Sets explained in plain English - Kubernetes explained in plain English series
cover_image: https://www.azuremonk.com/assets/blogposts/video/rs.png
tags: #kubernetes, #beginners ,#tutorial, #devops
---

{% youtube UIVtDHaCSZ8 %}


This is the Kubernetes explained in plain English series. This is the second video in the series "Replica Set explained in plain English" with the help of Phippy and Friends. Credits to CNCF foundation  - http://phippy.io/ for the characters from the "Illustrated children's guide to Kubernetes"

The link to the step by step practice lab - You do not need a pre-existing Kubernetes environment to get started you can perform all of the tasks right from the browser - https://www.katacoda.com/ranand12/scenarios/podsinplainenglish

If you are preparing for the Certified Kubernetes Administrator (CKA) or Certified Kubernetes Developer (CKAD) - this video series will be in alignment with your exam preparation

For more simplified videos check out -- https://www.azuremonk.com/videos 

For the Kubernetes in plain English series - check this video playlist out https://www.youtube.com/playlist?list=PLp_fsLj4v7gTA8n2UngXfOc_5puPPmFdK
 
K8s in plain english 

#kubernetes #k8s #replicasets #replicaset #explained #cka #ckad #azuremonk #kubernetesinplainenglish #podsinplainenglish #podsexplained #kipe
Publish Cypress test results into ReportPortal.io with Docker - Part 1
Tags: testing, cypress, reportportal, docker
Published: 2020-06-09 17:12:22

##Background

Welcome to my first blog post on Dev.to, forgive me if this is a little clunky initially! I'm new to this. Firstly, if you find yourself reading this then thank you so much for taking the time out, and if it doesn't give you the specific answers you need drop me a line and I can sure do my best to help :) 

Without boring you with a load of background on my life, i'm a Senior QA Automation Engineer working in the media industry. 
I recently attended the SeleniumConf in London where I came across - [ReportPortal.io](https://reportportal.io/)

ReportPortal.io is an AI powered test automation dashboard developed by [EPAM](https://www.epam.com/)

Initially while sat listening to the talk by EPAM's Delivery Manager [Dzmitry Humianiuk](https://github.com/DzmitryHumianiuk) I thought this potentially would be something really difficult to setup and get integrated with some of the test frameworks we'd been writing at PA Media - how wrong was i!  

##Cypress.io
I'm not going to spend loads of time and detail going into the ins and out of [Cypress.io](https://www.cypress.io/).

The documentation and getting started guides will get you up to speed if you need to. Also here is a link to a GitHub Typescript template I have created that gives you a project setup out of the box. 

[Cypress TypeScript Template](https://github.com/mvoase/cypress-typescript-template)

This template gives you a TypeScript Cypress project out of the box and targets a demo website with a few example tests. 

To use this project simply select the "Use Template" button on the GitHub repository page and create your own repository. 

Once you're new repository is created and cloned locally don't forget to you know make it work ;) 

```npm install``` is your friend here!

Once you've created the repository and installed the dependencies then go ahead and run the tests.....

```npm cypress:run``` 

Will run the example tests in headless mode..
Of course some of you might be here to get your existing test framework hooked into ReportPortal, but be patient we will get there. 

Come back for Part 2 to get ReportPortal stood up in Docker.
Kubernetes Pods explained in plain English - with Phippy and friends
Tags: kubernetes, beginners, tutorial, devops
Published: 2020-06-09 17:12:18

---
title: Kubernetes Pods explained in plain English - with Phippy and friends
published: true
description: Kubernetes Pods explained in plain English - Kubernetes explained in plain English series
cover_image: https://www.azuremonk.com/assets/blogposts/video/pods.png
tags: #kubernetes, #beginners ,#tutorial , #devops
---

{% youtube lBepFNjBW_U %}


This is the Kubernetes explained in plain English series. This is the first video in the series "Pods explained in plain English" with the help of Phippy and Friends. Credits to CNCF foundation  - http://phippy.io/ for the characters from the "Illustrated children's guide to Kubernetes"

The link to the step by step practice lab - You do not need a pre-existing Kubernetes environment to get started you can perform all of the tasks right from the browser - https://www.katacoda.com/ranand12/scenarios/podsinplainenglish

If you are preparing for the Certified Kubernetes Administrator (CKA) or Certified Kubernetes Developer (CKAD) - this video series will be in alignment with your exam preparation

For more simplified videos check out -- https://www.azuremonk.com/videos 

For the Kubernetes in plain English series - check this video playlist out https://www.youtube.com/playlist?list=PLp_fsLj4v7gTA8n2UngXfOc_5puPPmFdK
 
#kubernetes #pods #explained #cka #ckad #azuremonk #kubernetesinplainenglish #podsinplainenglish #podsexplained
Automatically keep tracks of outdated gems in a Github Issue
Tags: ruby, github
Published: 2020-06-09 17:03:53

Long story short, in my organization, I'm responsible for upgrading our Rails application. First thing I checked was every gems that could be updated right away.

I quickly found the `outdated` command from [`bundler`](https://bundler.io/man/bundle-outdated.1.html).

I ran it with the options `--only-explicit --strict` to check what is explicitly specified in my Gemfile and for what I can simply do `bundle update <<gem>` without changing the requested version in my Gemfile.

Without much of a surprise, we had more than 70 gems that could be updated right away.

To prevent being in a similar situation in a few months or years, I had the idea to run the 'bundle outdated' command automatically, so I can keep track of new gem release. My solution was to create a script that can run in a Github Action to keep a Github Issue updated with the list of all outdated gems and their newer versions. So now I can easily see many dependencies that can be updated.

## How it works

You need to create a Github Action, it can be done by creating a `.yml` file under `.github/workflows` in your project. You will also need a Github _private access token_ with the scope `repo` to be able to update the relative Github Issue. You can use the example in the [README](https://github.com/Bhacaz/bundler-outdated-action) of the project.

In the example, the action runs on every push on master, which is convenient in a very active project and to have a live update of the issue if you merged an update. You can also choose to use a [cron rule](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onschedule), which can be useful with a less active project.

When the action runs it will,

* Setup a Ruby environment with the version you specified in the `.yml` file
* Pull the script
* Download the Gemfile and Gemfile.lock files from your project
* Run the command `bundle outdated --only-explicit --strict`
* Create or update the description of the associated issue

{% github Bhacaz/bundler-outdated-action %}

Happy updating
Developers Survey 2020, Participate to win
Tags: python, react, javascript, machinelearning
Published: 2020-06-09 16:57:20

# What is This Survey: 
This survey about the Developer Tools analysis. here we collect the information from Developers such as which tools we using to code. so that this DeveloperEconomics Company uses this data for data analytics.

### Survey Link is Here: [Link](https://bit.ly/developereconomics)

## Reasons for suggesting this:
1. This survey completely belongs to what tools, what algorithms you're using in Machine Learning & Artificial Intelligence or some other Technology.
2. This survey conducted by one US company Which is DeveloperEconomics and completely genuine.

## What to do Now:
1. Completing the Survey from following Link ClickHere
2. You need to answer the survey all the questions if not aware of that answer you can choose None Of the Above Option.
3. The survey is somewhat large, it’s completely based on how many options you selecting. [if you select fewer options survey will end soon 😐]

![](https://thepracticaldev.s3.amazonaws.com/i/12jf4dd3y2qq23o7em25.PNG)
## What Prizes You will Win for this:

Here is the list of prizes you will in once the survey is completed they will announce the winners by using Random Selection Program.

- Microsoft Surface Pro 6
- Samsung HMD Odyssey
- Samsung Chromebook
- AWS Deep Racer
- Oculus Rift S
- Microsoft Surface Pro 6
- OnePlus 6T
![](https://thepracticaldev.s3.amazonaws.com/i/ibhvtfkthao9p1zmxypd.png)

### Survey Link is Here: [Link](https://bit.ly/developereconomics)