teleren/devto huggingface dataset:
Exploring Exponential Distribution: Modeling Phone Call Durations (I do anything with Python)
Published: 2023-05-30 02:02:58

Introduction:
In various fields, understanding and modeling random variables is crucial for making accurate predictions and analyzing systems. Today, we'll delve into the exponential distribution and its application to modeling phone call durations. Let's explore the probabilities, moments, and insights that this distribution provides.

What is the Exponential Distribution?
The exponential distribution is often used to model events occurring independently at a constant average rate. In the case of phone call durations, this distribution can shed light on the likelihood of different call lengths.

Probability Calculations:
Consider a phone booth scenario where the parameter λ (or rate parameter) is 1/10. We can calculate the following probabilities:

a. Probability of waiting for less than 5 minutes:
P(X < 5) ≈ 0.3935
This probability helps us understand the chance of finishing a call in under 5 minutes.

b. Probability of waiting for greater than or equal to 10 minutes:
P(X ≥ 10) ≈ 0.3679
This probability provides insights into the possibility of a longer wait time for the phone booth.

c. Probability of waiting between 5 and 10 minutes:
P(5 ≤ X ≤ 10) ≈ 0.2487
This probability allows us to analyze the likelihood of a specific duration range for the phone call.

Mean and Variance:
The mean (E(X)) of an exponential distribution with parameter λ is given by 1/λ. In this case, the mean is 10 minutes. This provides a measure of the expected duration for phone calls.

The variance (Var(X)) of an exponential distribution with parameter λ is given by 1/λ^2. In this scenario, the variance is 100 minutes^2. Understanding the variance helps assess the variability in phone call durations.

Conclusion:
The exponential distribution serves as a valuable tool for modeling phone call durations and analyzing their characteristics. By calculating probabilities, such as the likelihood of calls ending in a certain time frame or the probability of waiting for specific durations, we gain insights into the behavior of phone call durations.

Moreover, the mean and variance provide summary statistics that help us understand the central tendency and spread of call lengths.

By utilizing the exponential distribution, we can enhance our understanding of phone call dynamics, optimize resource allocation, and improve customer satisfaction.

I hope this exploration of the exponential distribution in the context of phone call durations has been insightful! Feel free to share your thoughts and experiences with modeling random variables in the comments below.

Happy coding and modeling!

Python Code:
===> https://raw.githubusercontent.com/PeaceOloruntoba/DPERN-SchoolManagementSystem/main/filename.py <===
Mastering Conventional Commits: A Hands-On Guide
Tags: github, git, team, commit
Published: 2023-05-30 01:55:33

---
title: Mastering Conventional Commits: A Hands-On Guide
published: true
description: Demystifying Conventional Commits and Applying them to Your Projects.
tags: github, git, team, commit
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-30 01:44 +0000
---


When you're working with a team, it's great to use meaningful messages for your commits. 

We have something called Conventional Commits, a guidelines for writing commit messages in software development projects. 

Which includes 11 words and their meanings that you can use. It helps everyone understand your changes better!

Words and definition:

1. feat: Signifies a new feature or enhancement added to the codebase.
2. fix: Indicates a bug fix or resolving an issue in the code.
3. docs: Refers to changes or additions to documentation.
4. style: Denotes changes in code formatting, such as indentation, whitespace, etc., which do not affect the code's functionality.
5. refactor: Represents code changes that neither fix a bug nor add a feature but improve the code's structure or readability.
6. test: Indicates additions, modifications, or improvements to tests or testing-related code.
7. chore: Refers to changes in build scripts, package management, or other project-related tasks.
8. build: Denotes changes related to the build system or external dependencies.
9. ci: Represents changes to the Continuous Integration (CI) configuration or pipeline.
10. perf: Indicates code changes that improve performance.
11. revert: Signifies reverting a previous commit or changeset.


An actual example of using Conventional Commits for a TODO app:


1. feat: Add ability to set due dates for tasks
2. fix: Resolve the issue with task deletion not working properly
3. docs: Update user guide with instructions on organizing tasks into categories
4. style: Adjust font size and color for task titles
5. refactor: Reorganize code structure for improved task filtering
6. test: Add test cases for task prioritization functionality
7. chore: Update dependencies for better performance
8. build: Fix build configuration for smoother deployment
9. ci: Integrate automated testing into the continuous integration pipeline
10. perf: Optimize loading speed for large task lists
11. revert: Revert the previous commit that introduced a bug in task sorting.


Now, you can apply these concepts in your codebase 🚀
A Beginner's Guide to SSH
Tags: devops, ssh, networking, devjournal
Published: 2023-05-30 01:32:00

If you wish to unravel the mystery of SSH and become the master of remote access open this:


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

## 1. Definition: 
SSH is a networking protocol that lets us access a remote computer over the internet. It is an application layer protocol that is in the 7th layer of the OSI model.


## 2. Architecture:
Secure Shell has a client-server architecture. A server administrator installs a server program that accepts/rejects the incoming connections. Besides, a user runs a client program on their system that requests the server. The server listens on HTTP port 22.


## 3. Benefits of SSH:
-Enables communication between local and remote machines
-Enables remote access to server resources via port-forwarding
-Enables executing commands in the remote host machine
-Enables performing numerous system administration tasks


## 4. Commands:

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


## 5. Most Used Examples:

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


SSH is the secret sauce of DevOps engineers. With its ability to securely access and manage remote servers, automate tasks, and encrypt sensitive information, it's the ultimate power tool for any infrastructure master. 


Thanks for reading this.

If you have an idea and want to build your product around it, schedule a call with [me](https://calendly.com/pragyanatvade).

If you want to learn more about DevOps and Backend space, [follow me](https://dev.to/pragyanatvade).

If you want to connect, reach out to me on [Twitter](https://twitter.com/pragyanatvade) and [LinkedIn](https://www.linkedin.com/in/pragyanatvade/).
Rust 有点变态的 "精致细腻"（浮点数为例）
Tags: rust, python
Published: 2023-05-30 01:23:59

- 相对于Python而言，rust在语法上很多地方真是变态的调戏，精细讲究，很多时候感觉没有必要；用惯了Python 再与Rust对比，Python真的是太粗犷的，粗犷到不忍直视，Rust是精细到变态，不忍直视；

- 这里就举个浮点数的例子吧，以人类视角是完全没毛病的代码，Python也是完全没毛病的，rust这里却是个bug；
```
fn main() {
  // 断言0.1 + 0.2与0.3相等
  assert!(0.1 + 0.2 == 0.3);
}
```
  > 这段代码就是有毛病的，会报错: `panicked` ; 问题的点是与人类交互的数字（浮点数）是对计算机底层的具象化近似表达，并不精确；也就是说为了和人类更好的交互，这里只是取了一个近似值；这只是表象，不是本质，表象甚至是错的（严格意义来说）；这种表象只是为了迁就人类更好的理解，不要被表象迷惑了；如果有一天编程不再需要人参与，那一定会诞生一门新语言，这么语言会直达本质，不会为了迁就人类在计算机底层的基础上再包一层，这是很低效的；就是中国人的说话艺术，人情世故，弯弯绕，这是很低效的；

- 书写出来的浮点数会指向一个内存地址，但是该内存地址是以二进制的方式存储的，Rust编译器不会翻译；比如上面的0.1+0.2==0.3；0.1代表的二进制数据并不是0.1,0.2代表的二进制数据精确算出来也不是0.2；那么这两个相加得到的二进制数据和0.3所代表的二进制数据一定不一样；


- 所以Rust很精细，很较真，更偏向于计算机，更偏向于底层，而不是开发人员;这与Python的设计理念真是截然相反
[Tool] Convert JSON to code
Tags: nestjs, typescript, tooling, beginners
Published: 2023-05-30 00:39:55

I have developed a JSON to code converter specifically designed for NestJS, and now I'm excited to share it with the community. To support the continuous improvement and maintenance of this tool, I kindly ask you to consider buying me a coffee, which will contribute to my tuition fees. Thank you in advance for your support!

https://stella-relic.nvoid.dev/

I appreciate your willingness to report bugs. 😃
A good habit of Winget update
Tags: windows, winget, cli
Published: 2023-05-30 00:06:09

#My daily habit of keeping my Windows 11 machine up to date.

##First step:

####Check my setting:

####Move to update, make sure check update one more time after the Windows Security update is installed

##Second step:

####Check Microsoft Store for any update on apps, do it twice to make sure apps from Microsoft Store is covered.

##Third step:

####Open Windows Terminal

####Type the following command:

`winget upgrade`
####Or
`winget update`

####Try the following CLI statement
`winget upgrade --all`


####or update one-by-one with a format

`winget upgrade <ApplicationId>`

####One example can be 

`winget upgrade Microsoft.Azd`

Not sure if there is a way besides making a PowerShell script and running it to upgrade everything at once. 

####Last step

Open my Visual Studio Code - Insiders, and let it update its extensions, if it needs reload, just do it.

##Do it daily and you will keep up with your computer's upgrade needs.

My first post, and hope you like it.
Build an LLM app with Node and React
Tags: node, react, openai
Published: 2023-05-29 23:16:21

Using [a Github template for an LLM application with a Node server and React frontend](https://github.com/golivecosmos/llm-react-node-app-template), quickly start running a basic application with a prompt that sends user inputs to a large language model.

The app is easy to set up and run locally. Use it as a starting off point for your next chat agent project. The app will look like this when you first run it:

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

If you to try it out, follow this [tutorial on building an LLM app with React and Node](https://blog.golivecosmos.com/build-an-llm-app-with-node-react-and-langchain-js/).

For more content like this, follow the [Cosmos Engineering blog](https://blog.golivecosmos.com/).
Source code tour on Apache AGE & Postgres - Lists
Tags: apacheage, postgres
Published: 2023-05-29 23:06:34

## Introduction
In PostgreSQL, the `ListCell` struct is a key component for implementing linked lists, which we will use frequently on our contribution to [Apache AGE](https://github.com/apache/age). You can check its implementation in [PostgreSQL's official GitHub Repository](https://github.com/postgres/postgres/blob/REL_12_STABLE/src/include/nodes/pg_list.h).

This blog post provides a concise overview of the `ListCell` struct, its purpose, and significance, along with an example of iterating over a `List` using `ListCell`.

### The ListCell Struct:
The `ListCell` struct, defined in `pg_list.h`, has two members:
- `next`: a pointer to the next `ListCell` in the linked list, enabling traversal.
- `data`: a `void` pointer to store the actual data in each `ListCell`.

## Iterating over a List using ListCell:
Let's consider an example of iterating over a list using `ListCell`. Assume we have a `List` of integers, and we want to print each element:

```c
List *myList; // Assume we have a List containing integers

ListCell *cell;
foreach(cell, myList)
{
    int *value = (int *) lfirst(cell);
    printf("%d\n", *value);
}
```

In this example, we declare a `ListCell` pointer `cell` and use the `foreach` macro provided by PostgreSQL to iterate over the `myList`. Within the loop, we extract the integer value stored in each `ListCell` using `lfirst`, which returns a `void` pointer. We then cast it to an `int` pointer and dereference it to obtain the actual value, which we print.

___

The `ListCell` struct is a vital component of PostgreSQL's linked list implementation. It facilitates the creation and manipulation of dynamic lists throughout the PostgreSQL source code, showcasing the system's flexibility and versatility. By utilizing `ListCell` and its associated macros, such as `foreach`, iterating over lists becomes straightforward and efficient.

Please note that this condensed blog post provides a high-level overview of the `ListCell` struct and an example of iteration. For more detailed information, refer to the official PostgreSQL documentation and source code.

___

- Apache AGE. https://age.apache.org/.
- GitHub - apache/age - https://github.com/apache/age
📝Los mandamientos de Python
Tags: spanish, python, programming, beginners
Published: 2023-05-29 23:01:57

Cada lenguaje de programación tiene su propia sintaxis y reglas a la hora de escribirla.
Si bien algunas se pueden aplicar globalmente, Python cuenta con una especie de "biblia" donde podrás encontrar los 20 mandamientos para escribir un código pythonico como un pro. 😎
Estos fueron escritos por [Tim Peters](https://es.wikipedia.org/wiki/Tim_Peters)​ en junio de 1999 y se puede encontrar de forma libre y gratuita.


## PEP 20 – The Zen of Python 🐍

_Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!_


![código de python para poder ver las reglas desde la terminal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zml0xn2rs0f4za4risuf.png)
_Incluso puedes visualizarlo cuando quieras desde la terminal de python corriendo `import this`_

## ¿Qué significa cada regla?

Si bien son varias y algunas parecen más obvias que otras, podes encontrar una descripción super completa en la web de "[El Pythonista](https://elpythonista.com/zen-de-python)". 

¿No sería grandioso que un dev de la otra parte del mundo lea tu code y lo entienda sin problemas? ✨

Siguiendo estas reglas vas a comenzar a escribir un código con mejor legibilidad, ordenado e universal para que cualquier dev pueda entenderlo.



## Pon a prueba lo aprendido: 

¿Creés que sabes escribir un código pythonico?
En el siguiente link "[El Zen de Python test](https://zen-python-test.netlify.app/)" podrás encontrar un sencillo test multiple choice sobre estas reglas. Es divertido y así se aprende mejor ✨

---


Para finalizar me despido con una de mis reglas favoritas:

> Ahora es mejor que nunca
Now is better than never

_En el desarrollo de software siempre hay tareas que realizar y si no se priorizan las tareas importantes para hacerlas cuando salen los problemas, estos pueden alargarse en el tiempo hasta no hacerlas nunca._
Laravel - Parte 1
Tags: php, laravel, lumen
Published: 2023-05-29 22:13:40

---
title: Laravel - Parte 1
published: true
description: Começando a construir APIs com o Laravel
tags: PHP, Laravel, Lumen
---

#Ciclo de requisição básico

Partindo do básico é necessário conhecer o básico de dois conceitos: route e controller.

##Route
Route, ou se preferir chamar de rota mesmo é onde se cria as rotas HTTP, definindo sua assinatura, método HTTP e a resposta. Na pasta 'routes' existem quatro arquivos php: 'api.php', 'channels.php', 'console.php', 'web.php'. Numa aplicação poderá ter vários desses para organizar as rotas, mas como por enquanto é somente o básico vamos ficar somente no 'api.php'.

Na versão 10 esse arquivo vem como o seguinte código:
```PHP
<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});
```

Em resumo essa rota possui um middleware do sanctum (package de autenticação) que retorna o usuário autenticado. Por enquanto deixaremos de lado e pra não confundir apagaremos esse trecho.

Para definir rotas simples o Laravel possui a classe 'Route' juntamente com os métodos que definem o método HTTP da rota, seguindo os mesmos nomes 'get', 'post', 'put', 'patch', 'delete'.
Cada um desses métodos recebe como primeiro parâmetro a assinatura da rota e como segundo parâmetro um callback.

Assim podemos criar um endpoint '/hello-world' GET:

```PHP
Route::get('/hello-world', fn () => 'Hello World');
```

Com isso teremos um retorno de um texto 'Hello World' ao chamar a rota.

###Response

Até a parte anterior foi possível retornar algo simples como um texto com status code 200. Já adiantando um próximo assunto vou deixar como retornar qualquer coisa definindo o status code HTTP:

```PHP
Route::get('/error-500', fn () => response('ERRO!!!', 500));
```

O código acima utilizou a função 'response', um helper do Laravel para facilitar o retorno da classe de Response do framework. Com esse helper podemos definir o retorno e em seguida como segundo parâmetro o status code HTTP desse retorno, que no exemplo foi 500 de erro no servidor.

Para finalizar a parte básica de rotas vou deixar um [link da documentação da Mozilla de Status Code HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) que utilizaremos adiante.
awesome-nonprofit-software (Beta): An open-source, community-updated resource for discounted tools for nonprofits!
Tags: webdev, javascript, opensource, react
Published: 2023-05-29 21:02:02

### Overview

Hi everyone! I'm gradually starting to contribute to more open source projects in my free time, and my overall goal is to ultimately make a large positive impact on the world. I've been involved in tech for good programs in the past that help nonprofits with technical solutions, and I wasn't able to find a good external site similar to that external wiki, so I figured I spin this up and make it happen!

It's intended as a big, filterable, curated list of services that have significant (generally 50%+) discounts for nonprofits. The main goal is to help nonprofits find solutions that help them! Please feel free to open pull requests or issues with anything you'd like to see, and let's make this an amazing site for nonprofits!

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

- Repository: https://github.com/andenacitelli/awesome-nonprofit-software
- Website: https://awesome-nonprofit-software.vercel.app/

*I work for [Akkio](https://akkio.com), a predictive AI platform geared towards Data Analysts. If you're looking for predictive AI without needing any data science knowledge, check us out!*
10 Dicas para Melhorar a Performance do seu Site
Published: 2023-05-29 20:59:53

Melhorar a performance do seu site pode ser uma tarefa desafiadora, mas é fundamental para oferecer uma experiência de usuário satisfatória e garantir um bom posicionamento nos resultados de busca do Google. Neste artigo, apresentaremos 10 dicas práticas para melhorar a performance do seu site.

## 1. Otimize suas imagens

Imagens pesadas podem afetar significativamente a performance do seu site. Certifique-se de otimizar suas imagens para a web, escolhendo um formato adequado e comprimindo-as adequadamente.

## 2. Use uma CDN

Uma CDN (Content Delivery Network) pode ajudar a melhorar a velocidade de carregamento do seu site, distribuindo o conteúdo para servidores localizados em diferentes partes do mundo.

## 3. Minimize o uso de plugins e scripts

Plugins e scripts podem adicionar funcionalidades interessantes ao seu site, mas também podem afetar negativamente a performance. Evite usar plugins e scripts desnecessários e mantenha apenas aqueles que são realmente importantes.

## 4. Use um sistema de cache

Usar um sistema de cache pode ajudar a reduzir o tempo de carregamento do seu site, armazenando temporariamente o conteúdo para que ele possa ser rapidamente acessado pelos usuários.

## 5. Priorize o conteúdo acima da aparência

A aparência do seu site é importante, mas é ainda mais importante garantir que o conteúdo seja carregado rapidamente. Priorize o conteúdo acima da aparência e evite adicionar elementos desnecessários que possam afetar a performance.

## 6. Comprima seus arquivos

Comprimir seus arquivos pode ajudar a reduzir o tamanho das páginas e, consequentemente, melhorar a performance do seu site. Use ferramentas como Gzip ou Brotli para comprimir seus arquivos.

## 7. Reduza o número de redirecionamentos

Redirecionamentos desnecessários podem afetar negativamente a performance do seu site. Reduza o número de redirecionamentos sempre que possível e certifique-se de que os redirecionamentos existentes estejam funcionando corretamente.

## 8. Use fontes da web

Usar fontes da web pode ajudar a melhorar a aparência do seu site, mas é importante escolher fontes que sejam otimizadas para a web e que não afetem negativamente a performance.

## 9. Minimize o uso de animações e efeitos

Animações e efeitos podem adicionar interatividade ao seu site, mas também podem afetar a performance. Use animações e efeitos com moderação e certifique-se de que eles sejam otimizados para a web.

## 10. Teste a performance regularmente

Testar a performance do seu site regularmente pode ajudar a identificar problemas e oportunidades de melhoria. Use ferramentas como o Google PageSpeed Insights ou o WebPageTest para testar a performance do seu site e identificar áreas que precisam ser melhoradas.

Espero que essas dicas ajudem a melhorar a performance do seu site!