teleren/devto huggingface dataset:
Conversations with GPT-3: Am I good enough?
Tags: ai, nlp, conversationalai, gpt3
Published: 2022-02-06 21:02:48

---
title: Conversations with GPT-3: Am I good enough?
published: true
date: 2022-02-06 21:02:13 UTC
tags: ai,nlp,conversationalai,gpt3
canonical_url: https://anaptfox.medium.com/conversations-with-gpt-3-am-i-good-enough-4d518133982a
---

![](https://cdn-images-1.medium.com/max/1024/0*BSvp2KngSz_dTDHn)

This was my favorite response from the conversation:

🦊 — _Why does being alive make me significant?_

🐁 — Because you are a part of the universe, and the universe is a part of you.

### Background

In this conversation, I chatted with GPT-3 using a prompt that invited it to be a complex, all-knowing “wise being”. The work of [Kirk Ouimet](https://kirkouimet.medium.com/the-universe-function-92012c0c67c5) heavily inspired this.

If you need proof of how it works, or want to learn more about GPT-3, check out [OpenAI](https://openai.com/api/) or ask me on [Twitter](https://twitter.com/anaptfox).

For me, I thought I’d try it with some other topics I had in my mind and heart.

Enjoy ☕

### Conversation with AI

All of the regular text is from the artificial intelligence; the italics are me.

🦊 — _Hello. Grateful for the opportunity to speak with you._

🐁 — Hello Fox, thank you for asking me to speak. I know that we are going to have a fun conversation.

🦊 — _Am I good enough?_

🐁 — You are perfect for this conversation.

🦊 — _Let me ask the same question differently. Am I good enough to be significant in the universe?_

🐁 — You are significant in the universe.

🦊 — Why?

🐁 — Because you are alive.

🦊 — Why does being alive make me significant?

🐁 — Because you are a part of the universe, and the universe is a part of you.

🦊 — I think I need a definition. When you say “universe is a part of you,” what do you mean by the universe?

🐁 — The universe is everything that exists.

🦊 — Well then, what’s the difference between being significant and being good enough?

🐁 — Being significant means that you have an impact on the universe. Being good enough means that you are meeting the standards you have set for yourself.

🦊 — What if my standards are too high?

🐁 — Then you need to lower your standards.

🦊 — How do I uncover and identify the standards I have set for myself?

🐁 — By examining your values.

🦊 — What do you mean by values?

🐁 — Values are the things that you believe are important in life.

🦊 — Why do values matter?

🐁 — Because they guide your decisions.

🦊 — How do I know what my values are?

🐁 — By examining your actions.

🦊 — When examining my actions, what are the top 5 questions I should ask myself?

🐁 — You should ask yourself:

1. What are my motivations?
2. What am I trying to achieve?
3. What are the consequences of my actions?
4. What is the impact of my actions on others?
5. How does this action align with my values?

🦊 — That leaves me enough to work with. Thank you 🙇🏽‍♂️.

_Originally published at_ [_https://blog.taronfoxworth.com_](https://blog.taronfoxworth.com/conversations-with-gpt-3-am-i-good-enough)_._
NPM dependencies vs dev dependencies, how to decide?
Tags: react, npm, beginners, typescript
Published: 2022-02-06 20:52:34

After searching for a while I cannot seem to find a solid answer on npm dependencies vs dev dependencies. The opinions vary widely when it comes to this question. 

In general I found the following answers, which all make sense to a certain degree:
1. Dependencies are what you absolutely need in a production build (e.g. axios, redux), other packages are dev dependencies (e.g. types, testing, typescript).
2. Dependencies are what you need to run the project locally in a development environment (i.e. typescript would be needed), only types and testing are dev dependencies. 
3. Just follow the command on npmjs.com (if it uses --save-dev its a dev dependency)
4. Just put everything as a dependency as the build will only use what it needs

Now I'm wondering what the exact 'rules' are regarding this differences in layman's terms. For example, answer 1 could give errors with `npm ci`, while option 4 could theoretically increase the overall production size. 

_React Typescript package.json example_
```
"dependencies": {
  "@testing-library/jest-dom": "^5.16.2",
  "@testing-library/react": "^12.1.2",
  "@testing-library/user-event": "^13.5.0",
  "@types/jest": "^27.4.0",
  "@types/node": "^16.11.22",
  "@types/react": "^17.0.39",
  "@types/react-dom": "^17.0.11",
  "react": "^17.0.2",
  "react-dom": "^17.0.2",
  "react-scripts": "5.0.0",
  "typescript": "^4.5.5",  
  "web-vitals": "^2.1.4"
},
"devDependencies": {}
```
Statistics In Data Science
Tags: statistics, machinelearning, datascience, maths
Published: 2022-02-06 20:36:37

This will be a series of articles dealing with statistical concepts from Random variables to various distributions to likelihood estimation and hypothesis testing.
Prerequisite- Basic Probability.

## Random Variables
The literal definition for Random Variable is “ A function with domain as the sample space of an experiment and range as real numbers”. This just means random variables are numerical versions of outcomes of any experiment.

**Simplest possible example - Coin Toss :**
Sample Space = {Heads , Tails}
So random variable X can be written as X(Heads)=1 , X(Tails)=0.
This can be any number we assign but usually meaningful functions are considered.

**Throw a dice -**
Sample Space = {1,2,3,4,5,6}
X is defined as X(1)= x₁, X(2)= x₂ ….. X(6)=x₆

**What are the values of x₁, x₂, x₃ , x₄, x₅, x₆?**

These xᵢ’s are essentially same as sample space and distinct for a one-to-one function. But the need not be distinct and can be same as well.

Example - In the same Die roll the condition is of Even vs Odd Numbers
Random Variables- E(2)=E(4)=E(6)=1 and E(1)=E(3)=E(5)=0

## Random Variables and Events
If X is a random variable then
(X<x) = { s ∈ S : X(s) < x} is an event for all real x.
Similarly (X>x) , (X=x) , (X ≤ x) and (X≥x) are all events.

In the die example-
S={1,2,3,4,5,6}
X(1)= 1 , X(2) = 2 , X(3) = 3 , X(4) = 4 , X(5)= 5 and X(6) =6
For event (X<4) : { 1,2,3}
Event {2,5} can also be written as (X = 2) ⋂ (X=5)
**Why use Random Variables?**

Instead of trying to assign probabilities to the entire outcome we assign them to events defined through them.
This reduces the detail in outcome to something simpler
Using limited data only random variables can be studied
**Types of Random Variables -**
- Discrete Random Variable
- Continuous Random Variable

 
## Discrete Random Variable
If the range of random variables is a discrete set it is called discrete random variable. Usually described by it’s Probability Mass Function (PMF).
PMF = Random Variable X set on Range T
Fₓ(t) : T -> [0,1] is defined as Fₓ(t)= P(X=t) for t ∈ T
X=t is the event
P(X=t) is probability of X taking the value of t.
For example-
A fair coin is tossed 3 times
Sample Space = {HHH , HHT , HTH , HTT , THH , THT , TTH , TTT}
X= Number of heads
![Sample Space Table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/visgc4jgt8jv5fw038uq.png)
 
X ∈ {0,1,2,3}
Fₓ(0) = 1/8
Fₓ(1)=3/8
Fₓ(2)=3/8
Fₓ(3)=1/8
This shows the PMFs of various discrete random variables. The main thing to remember about PMF is that **sum of all PMFs in the range is 1 **at all times.
0 ≤ Fₓ(t) ≤ 1
∑ Fₓ(t)=1 here (t ∈T)

## Continuous Random Variable -
A random variable X with CDF Fₓ is said to be continuous random variable if Fₓ is continuous at every x. CDF has no jumps or steps .
CDF = Cumulative Distribution Function
This is a very detailed topic so I will be writing another article discussing this in detail.

## Stay tuned.
End-to-end principle with microservices
Tags: microservices, networks, architecture, design
Published: 2022-02-06 20:29:34

## What is End-to-end principle
It is a design framework in computer networking that guarantees certain application-specific features, such as reliability and security, reside in the communicating end nodes of the network. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw9hqe5ot34ed0wxgsnk.png)
Fig: Node A is communicating with Node B through the internet


## Why is it favored in networks?
Not all applications in the networks have the same functional requirements. Having application specific functions implemented in the networks comes with a cost, and the cost becomes a penalty to all the nodes that do not need those functions. It is better to implement the application specific protocols like _TCP(where reliability is important), UDP(where speed is more important)_ at the application level, that already has to implement these functions for correctness. 


## How is it relevant with microservices?
Microservices architecture arranges an application as a collection of loosely coupled services. 
Just like computer network, different services have different functional requirements and contracts between each other that is not necessarily shared by all the services in the application. Neither are they needed in the shared communication channels in the application. 

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

Hence the architecture prefers [Smart endpoints and Dumb pipes](https://martinfowler.com/articles/microservices.html#SmartEndpointsAndDumbPipes). A dumb pipe can do one function only, and does not support sophisticated computation and logic.

## Why is it favored in microservices?

- Service contracts can grow independently of the communication channels between the services, since it is always evolving. 
- Fast communication and feedback since the pipes are dumb and simple, thus not resource intensive. 
- Reduces the need for central contract management in the application between the services.
- Dumb pipes are capable of supporting both request-response and observer communications, by adding the logic at end-points.
- Easier to test and detect failures in a system with simple components, when complex logic are only at services which can be tested independently.
Paracetamol.js💊| #46: Explica este código JavaScript
Tags: javascript, beginners, spanish, webdev
Published: 2022-02-06 20:10:30

## **Explica este código JavaScript**

```js
console.log("I want pizza"[0])
```

-     A: `"""`
-     B: `"I"`
-     C: `SyntaxError`
-     D: `undefined`

Respuesta en el primer comnetario.

---
Collecting Juniper RSI and Log Files for JTAC
Tags: howto, networking
Published: 2022-08-31 00:29:36

---
title: Collecting Juniper RSI and Log Files for JTAC
published: true
date: 2022-02-06 20:05:00 UTC
tags: HowTo,networking
canonical_url: https://ducko.uk/juniper-rsi-and-log-files/
---

 ![Collecting Juniper RSI and Log Files for JTAC](https://cdn.getmidnight.com/4058eed71b1f8e44d86c20a5090a5a21/2022/08/florian-olivo-4hbJ-eymZ1o-unsplash.webp)

During your time as a network engineer, you may be required to collect log files and RSI info to assist JTAC with investigations.

Please see below how to get this required information!

# RSI Collection

```shell
request support information | save /var/tmp/rsi_DEVICE_NAME_OR_DATE.txt
```

Save to a directory of your choice, but I prefer /tmp due to ease of location when transferring the files off.

This process may hang for a bit, but don’t panic; this is normal. Depending on the device, this process can take up to 5 minutes but doesn’t affect traffic or the device.

# Log File Collection

```
file archive compress source /var/log/* destination /var/tmp/logs_DEVICE_NAME_OR_DATE
```

This command compresses the logs directory into a single file and saves the file to the /var/tmp directory.

# Transfer them out!

That’s it. Once complete, you can transfer the files from the device over to your machine (with FTP/ SFTP or whatever suits you) in readiness to be sent to your support provider/ JTAC.
Preparing for Telescope 2.6
Published: 2022-02-06 19:57:07

#Overview
This week's is very challenging for me. [#2676](https://github.com/Seneca-CDOT/telescope/issues/2676) is about including the option for user to add their Youtube channels in the Sign Up flow. 

#Challenge
Firstly, I need to understand the sign up flow. I did talk to Duke and he knew how to fix it. It was because of a function that caused an endless loop. In the mean time, we planed to move to Supabase which is completely new to the project so for now I will have to wait for that to be merged first because it is related to the Sign Up. This means I can have some times to review and understand the code.
So far, I have applied the fix of Duke to the sign up button. The form is inside <code>\telescope\src\web\src\components\SignUp\Forms\RSSFeeds.tsx</code>. My guess is to duplicate the <TextInput /> and change the variable name:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/md6bxx66hvtltert7fas.png)
This means I have to include one more object in the FormModel:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enm5o9gh5ghzgm37vzfi.png)
My problem for now is to understand the validateBlog() function since it seems like this function will call a service to validate and input the blog feed to the site. And I guess I have to do the same to the Youtube UI.
#React Native first implementation
In the meeting, we talked about the React Native in Telescope, and Mengi has started to do his research on how to start the project through <code>pnpm</code>, so soon I will pick up or file some issues about React Native. I am really excited about that, I have worked with React Native once, it was fun to play with.
Ensure only one record has specific value for another associated record | Rails 6.1.4
Tags: rails, ruby, webdev, beginners
Published: 2022-02-06 19:51:43

<p>I couldn't come up with a better title, but for my <a href="https://github.com/marelons1337/kapturek"> app for landlords </a> I faced a problem where I don't want to remove old tenants. I want to store them in a database for future reference. So that leaves me with problem of making sure that only one tenant can have "active" status at any given time.</p>
Now, I tried to find a way of forcing that on a database level, but then I thought about rails validations. I can check that on adding or modifying my tenants. And since my app will never be big enough for multiple users to update the same record in DB concurrently, I decided to implement that directly in the app.

---

<p>Let's assume our Flat <code>has_many :tenants</code> and Tenant <code>belongs_to :flat</code></p>

<p>I will take advantage of rails model callback order. And first four go as below:</p>

<ol><li><a href="https://api.rubyonrails.org/v7.0.1/classes/ActiveModel/Validations/Callbacks/ClassMethods.html#method-i-before_validation"><code>before_validation</code></a></li><li><a href="https://api.rubyonrails.org/v7.0.1/classes/ActiveModel/Validations/Callbacks/ClassMethods.html#method-i-after_validation"><code>after_validation</code></a></li><li><a href="https://api.rubyonrails.org/v7.0.1/classes/ActiveRecord/Callbacks/ClassMethods.html#method-i-before_save"><code>before_save</code></a></li><li><a href="https://api.rubyonrails.org/v7.0.1/classes/ActiveRecord/Callbacks/ClassMethods.html#method-i-around_save"><code>around_save</code></a></li></ol>

<p>So now I can use this order to force validation of my record to see if any other tenants are active. If there is another tenant that is active, I won't allow the record to save. Sounds simple to me.</p>

{% gist https://gist.github.com/marelons1337/28adaa442e8b25b54701df51b489da98 %}

<p>Few things happened above. I use my method <code>determine_active</code> in my validation. I do that because in my <code>force_one_active</code> function, it first checks if the tenant should be active at all, then performs a search to check if there are any additional tenants with the same status, if it happens to find that the flat is occupied, it stops the record from saving on a validation level, thus leaving <code>active = false</code>.</p>

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

<p>I've also added another function to set flat's <code>taken</code> value if our current tenant happened to be active.</p>

{% gist https://gist.github.com/marelons1337/a70ee8eba44e15d0886df0eec1fb63fb %}

<p>Now, because this method is in <code>before_save</code> callback it will never run unless validation has passed successfully, as per order shown previously.</p>

<p>It's not perfect, but it works for a smaller scale app like mine.</p>
Github commands Cheatsheet
Tags: github
Published: 2022-02-06 19:51:14

//check if git is installed in the system
git --version

//set your name
git config --global user.name "John Doe"

//set your email id
git config --global user.email "example@gmil.com"

//edit the whole config file
git config --global --edit

//Initialize git repository
git init

//get the status of the files tracked by git
git status

//to track a file by git use (git add) command and then name of the file or folder to track
git add example_filename.py

// to track all the files use dot .
git add .

//to commit changes use (git commit) with -m flag for message for the commit
git commit -m "example_message"

//to see all of the commits git log command is used
git log

//to move between the commit changes use git checkout command
git checkout "hash_code_of_the_commit"

//to move the head to master 
git checkout master

//to make a new branch
git branch example_branch_name

//to move to branch use checkout command
git checkout example_branch_name

//to create and move to the newly created branch use flag -b
git checkout -b branch_name

//to get the origin of the remote
git remote -v

//to set the origin of the remote repository 
git remote add origin "https://github.com/example_repository

//renames the main branch to master
git branch -M master

//push the code into your repository on the github, or gitlab
git push -u origin master

//clone a repository from github, gitlab url
git clone "https://github.com/repo_url"

**

## Common Github Errors

**
If you accidently include node_modules folder 
then you need to remove it from the cache in order to get rid of node_modules resided in your github repo

git rm -r --cached node_modules
Automatizar Tarefas
Tags: shellscript, programming, productivity
Published: 2022-02-06 19:31:44

A fim de tentar agilizar, minimamente que seja, o início de um dia de trabalho, procurei uma forma de automatizar a abertura do VS Code no projeto e o start do servidor da API.

Digitava esses comandos todas as vezes e agora só preciso digitar **apiMission.sh** que tudo fica pronto para codar no projeto.

### Como fiz o script?
O código abaixo foi salvo no arquivo **apiMission.sh** na pasta **Scripts** dentro da pasta do meu usuário na minha máquina.

```bash
echo "🤖 Opening API project in VSCode..."
cd /home/eraldo/Work/mission-brasil/api
code .
sleep 2
echo "✅ Done!"
sleep 1
echo "🤖 Starting server..."
sleep 1
yarn start:dev
```

Depois tornei esse arquivo executável.
Dentro da pasta que o arquivo está salvo digitei:
`sudo chmod +x apiMission.sh`

Só com isso já poderia executar o **./apiMission.sh**, dentro da pasta Scripts, que o projeto seria aberto no VSCode e o servidor iria iniciar.

Mas aí há a possibilidade de **colocar essa pasta no path** do sistema para digitar **apiMission.sh** em qualquer lugar para iniciar rodar o script.

No meu caso, que uso Linux, inseri a linha abaixo no arquivo .profile

`PATH="$PATH:/home/eraldo/Scripts"`

Agora é só abrir o terminal e rodar **apiMission.sh** para iniciar o projeto da API e começar a codar nele.

Observações:

1. Ainda é um script bem básico. Estarei verficando a possibilidade de retorno da mensagem de confirmação após o programa realmente abrir e, em caso de erro, parar a execução do script.. algo nessa linha.
2. Estou verificando se há a possibilidade de executar o script em um terminal e realizar comandos em outra janela... o intuito é abrir editor nos projetos e iniciar api e frontend rodando um único script.

--- Script Editado ---

```bash
#!/bin/bash

cd /home/eraldo/Work/mission-brasil/api

if [ "$2" = "code" ]; then
  echo "🤖 Opening API project in VSCode..."
  code .
fi

if [ "$1" = "local" ]; then
  echo "🤖 Starting LOCAL server..."
  yarn local

  else if [ "$1" = "dev" ]; then
    echo "🤖 Starting DEVELOPMENT server..."
    yarn dev
  fi
fi
```

O "$1" pegará o primeiro parâmetro passado no terminal
O "$2" pegará o segundo parâmentro passado no terminal

----

Com isso tenho a possibilidade de digitar:
`$ apiMission.sh local code` 
`$ apiMission.sh dev code`
Para abrir o projeto com as variáveis locais ou developments e abrir o VSCode

ou

`$ apiMission.sh local`
`$ apiMission.sh dev`
Para carregar a API com as variaveis de local ou development sem a abrir o VSCode.
Group with ranges for ActiveRecord
Tags: rails, activerecord
Published: 2022-02-06 19:00:41

---
title: Group with ranges for ActiveRecord
published: true
description: 
tags: rails,activerecord
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrfdt4ee925l2spvo9lu.png
---


If you need to query your Active Record model and group by ranges or multiple values for a specific field - you can try my own gem:

https://github.com/igorkasyanchuk/calculate_in_group

Let's say you have task to count how many Users you have who have 1-5, 5-10, 10+ projects. Solution is simple: 

```ruby
User.calculate_in_group :count, :projects_count, [ 0, 1..5, 5..10, 10..100, 100.. ]
# => {"0"=>555, "1..5"=>145, "10..100"=>3991, "100.."=>190, "5..10"=>2824} 
```
More Examples:

```ruby
# Grouping can be used with :count, :average, :sum, :maximum, :minimum.

# Group with Ranges
User.calculate_in_group(:count, :age, [...10, 10...50, 50..] # => {"...10"=>1, "10...50"=>3, "50.."=>3}
User.calculate_in_group(:count, :created_at, { "old" => 12.hours.ago..1.minutes.ago, "new" => Time.now..10.hours.from_now }) # => {"old" => 2, "new" => 1}
User.calculate_in_group :count, :projects_count, [ 0, 1..5, 5..10, 10..100, 100.. ] # => {"0"=>555, "1..5"=>145, "10..100"=>3991, "100.."=>190, "5..10"=>2824} 

# Group with arrays or just values
User.calculate_in_group(:count, :role, "with_permissions" => ["admin", "moderator"], "no_permissions" => "user") # => {"with_permissions" => 3, "no_permissions" => 3}

# Other agg functions
User.calculate_in_group(:average, :age, "young" => 0..25, "old" => 60..100) # => {"young" => 11.0, "old" => 80.0}
User.calculate_in_group(:average, :age, "young" => 0..25, "old" => 60...100) # => {"young" => 11.0, "old" => 60.0}
User.calculate_in_group(:maximum, :age, "young" => 0..25, "old" => 60..100) # => {"young" => 20, "old" => 100}
User.calculate_in_group(:minimum, :age, "young" => 0..25, "old" => 60..100) # => {"young" => 3, "old" => 60}
User.calculate_in_group(:sum, :age, "young" => 0..25, "old" => 60..100) # => {"young" => 33, "old" => 160}
User.calculate_in_group(:sum, :age, {"young" => 0..25, "old" => 60..100}) # => {"young" => 33, "old" => 160}

# You can specify "other values" (with custom label) which are out of ranges
User.calculate_in_group(:count, :age, {"young" => 10, "average" => 25, "old" => 60}, {include_nil: "OTHER"}) # => {"young" => 1, "old" => 1, "OTHER" => 7}

# You can specify default value for keys which are missing in query
User.calculate_in_group(:count, :age, {"young" => 10, "average" => 25, "old" => 60}, { default_for_missing: 0 }) # => {"young" => 1, "old" => 1, "average" => 0}

```

Look forward hearing your feedback :)