teleren/devto huggingface dataset:
Build Your Own GPT-3 Prompt Generator Using Python and the OpenAI API
Tags: gpt3, python, naturallanguageprocessing, machinelearning
Published: 2023-02-17 21:01:02


Are you interested in working with GPT-3, one of the most advanced natural language processing tools available? If so, you might want to check out my GPT-3 prompt generator tool, which lets you generate prompts and receive responses from the language model using Python and the OpenAI API.

In this post, I'll walk you through the process of building your own GPT-3 prompt generator, and show you how to use the tool to generate responses in a wide variety of styles and tones.

## Prerequisites:

Before we begin, you'll need the following:

* A Python 3.7 or later installation
* An OpenAI API key (you can sign up for one at https://beta.openai.com)
* The openai Python package (you can install it using pip).

## Building the GPT-3 prompt generator:

1. Clone or download the repository from GitHub to your local machine

2. Open the terminal and navigate to the repository.

3. Install the required dependencies by running the following command: 

`pip install openai`

4. Replace API-key in the code with your OpenAI API key

5. Run the script by executing the following command: 

`python gpt3_prompt_generator.py`

Now just follow the prompts in the terminal to generate a response from GPT-3

## Using the GPT-3 prompt generator:

Once you've generated a prompt and received a response from GPT-3, you can use the tool in a wide variety of applications. Here are just a few examples:

1. Creative writing: Use the tool to generate writing prompts or generate responses to existing prompts to jumpstart your creativity.

2. Chatbots and customer service: Use the tool to generate responses to user inquiries or create more engaging and natural language interactions with your customers.

## Research and analysis: 

Use the tool to generate responses to research questions or explore new topics and ideas using the power of GPT-3.

## Limitations:

It's important to note that the GPT-3 API is not perfect, and the prompts generated by this program may not always be accurate or appropriate. Use your own discretion when using the the prompts generated by this program, and always double-check the information provided.

## Conclusion:

Building your own GPT-3 prompt generator tool is a great way to explore the power of natural language processing and machine learning. With the tool, you can generate prompts and responses in a wide variety of styles and tones, and use them in many different applications.

I hope this post has been helpful in showing you how to build your own GPT-3 prompt generator tool. If you're interested in trying out the tool for yourself, you can find the code on my GitHub repository at https://github.com/felipeOliveira-1/gpt3_prompt_generator.
Some new features to look forward to on DEV
Tags: meta, forem
Published: 2023-02-17 21:00:45

Hey folks, just wanted to speak to some upcoming features going live on DEV soon via [Forem](https://github.com/forem/forem).

This is just a quick overview of some notable work that will be shipping soon.  We’ll share more details as individual features go live throughout the next few months.

## Multiple reactions: 🦄 The unicorn is back, and they brought friends!

A little while back, [we removed the unicorn reaction in order to simplify the UI](https://dev.to/devteam/our-dear-unicorn-friend-is-going-on-vacation-idm). However, we intended to re-introduce this reaction in the form of a “reaction drawer” which will allow for more reactions. Soon you will be able to select from five reactions, and we hope to continue evolving this over time.

We hope this update helps keep activity in the community light-hearted, fun and expressive. We will roll these out next week. 🔥

## Billboards as a multi-purpose UI element

If you scroll to the bottom of this post, you’ll see a “billboard”, which is a box on the site that allows for flexible content. We will be rolling these out across the site in different places allowing our team to curate more interesting flows through the site.

These are just “boxes”, but they offer a lot of flexibility as to where they are located and what they can display. In these billboards, you’ll find everything from content suggestions, to promotions for upcoming events and hackathons, to guidance on how to take advantage of features of the platform you may have missed.

As we continue investing into Billboards, we will also be removing some separate functionality. One such removal is _Listings_ which has been an area we have not been able to invest in. We want to do fewer things well, and we’ve committed to investing into billboards as our chosen utility for serving a lot of “peripheral” functionality across the site.

We’ll also be allowing platform sponsors to begin using Billboards to promote their message across the platform.  Understandably, some folks might prefer to turn off billboards related to sponsorships, and you’re welcome to do so directly in your [settings](/settings/customization). We think that most people will enjoy seeing the latest of what we’re doing on the site, because we’ll be doing interesting things with sponsors, but it just seems right to offer this setting to both readers of content and writers of articles.

## Pro Organization Tooling

Finally, we will be rolling out a dedicated tooling suite to help professionals on our site better understand their followers and create better content. Think “Hootsuite for DEV” with some dedicated functionality to help organizations connect with the community. We suspect this will be very useful for developer relations organizations, open source projects, and lots of use cases in-between.

If you're interested in learning more, please [get in touch](https://docs.google.com/forms/d/e/1FAIpQLScqSb6cKWa64GxVWAKTvEYi1t_j5wE_EvTzBJrTMKfxW5Ca5w/viewform?usp=sharing).

***

There will be more details to come on all of these things as we roll them out!

Happy coding ❤️
Godot 4: "Pointing" an Area2D to the correct direction using look_at!.
Tags: godot, gamedev, beginners, opensource
Published: 2023-02-17 20:38:49

Hello all! I just want to do a quick post regarding Godot 4, something I've been working with for awhile and absolutely **LOVE.** 

If you don't know what Godot (pronounced _guh-doh_)is, it's an open source game engine that's almost ready for its 4.0 release.

Anyway, let's move on. One issue I had in my upcoming video game, Retro Hockey, is that I wanted a player to pass the puck to another player. I wanted them to have a "line of sight" (see below) for their passing in the shape of a big inverted triangle.

![A Player with a giant triangle coming out of them, that is an Area2D](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ev289n3ninqjsjnx2r8z.png)

Then, if there's another player on the same team inside this triangle, and they are closer than another player, it would pass to the closer player.

Anyway, the problem I was having was I needed to figure out some way to rotate the triangle to the direction (`Vector2`) the player was moving to.

The solution? the `look_at` function! 

In Godot 4, the `look_at` function does this ([official docs](https://docs.godotengine.org/en/latest/classes/class_node2d.html#class-node2d-method-look-at)): 

> `void look_at ( Vector2 point )`
> Rotates the node so it points towards the point, which is expected to use global coordinates.

Great! So now, let's just take the existing `linear_velocity` of my character/player. Based on how your character moves, it may be different (something to keep in mind is [how Godot and game programming uses the Cartesian plane]()), but here's the example I have:

```gdscript
# based on my char's movements, we reverse the x and y coords
var newVec = Vector2(linear_velocity.y, linear_velocity.x)

# set the look_at point to the initial global position of our triangle origin + the new vector. We also have to account for the y coord being negative since Godot/game programming uses the plane a bit differently...
passing_triangle.look_at(passing_triangle.global_position + (Vector2(newVec.x, -newVec.y)))
```

So then, with the `View Collision Shapes` option on, we can see how this works! FYI, if you're not sure how to do this, here's a handy image for you: 

![Godot Menu > Debug > Debug Collision Paths image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/owg4dscx1p8umi7qbjxb.png)


And here's the final product! A giant triangle that rotates to where the player is going:


<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYmNlZWJjZDcxZWQyZDI3YTJmNjM1NzM0MzdlNzI5MTBhYWE2ZmFmZSZjdD1n/Ejmzjas5RMNauBiXhs/giphy.gif">

This post was heavily inspired by this [old Reddit thread on Godot](https://www.reddit.com/r/godot/comments/j28xuj/how_to_make_an_area2d_rotate_based_on_the/)! Thank you for the help, stranger!
Mais 5 atalhos do VS Code que você precisa conhecer
Published: 2023-02-17 20:23:14

No [último post](https://dev.to/marcelluscaio/3-atalhos-do-vs-code-que-voce-precisa-conhecer-1-bonus-3g5n) eu falei sobre alguns atalhos do VS Code que eu uso sempre. Como toda boa lista, ela teve ausências notáveis, ausências que vocês me ajudaram a compilar e a trazer nesse segundo post. Vamos lá!

## Duplicando código

Essa daqui foi uma que aprendi com vocês e não consigo parar de usar! Digamos que você vai fazer um card, e dentro dele tem 8 filhos. Uma forma de otimizar esse trabalho seria fazendo o primeiro e copiando ele 7 vezes. Todos os cards iguais, com a mesma estrutura, sem margem para erros. 

Dar Ctrl + C, Ctrl + V é a primeira solução que a gente pensa, mas e se eu te disser que tem uma forma ainda mais fácil de resolver isso? 

```
Alt + Shift + ↑
Alt + Shift + ↓
```
Usando esse comando você copia uma bloco de código para cima ou para baixo, a depender da seta que apertou. Então para fazer o card, você só precisaria segurar o Alt + Shift e apertar a seta para baixo 7 vezes.


## Corrigindo e refatorando código

Eis que você está revisando seu código e viu que precisava mudar o nome de uma classe. O que era “cartaozinho” vai virar “client-card”. Só que no seu HTML tem 10 elementos com essa classe. E o pior, como você é adepto da convenção BEM, dentro  desses elementos tem diversas classes “cartaozinho__titulo”, “cartaozinho__numero”. E ainda têm todos os seletores no CSS... Desesperador, né?

Não! Afinal você já leu este artigo, e você sabe como resolver sem ter que passar um pente fino à olho no código todo!

```
Ctrl + F
``` 

Apertando esse comando você abre uma aba de pesquisa como essa:

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

Agora é só você colocar que vai substituir cartaozinho por client-card, e o VS Code substitui um a um, ou todas as ocorrências. 

Para substituir caso a caso, aperte Enter. Se você tem confiança que não vai quebrar nada no código (ou se você é vidaloka #YOLO) você pode mudar todos de uma vez apertando Ctrl + Alt + Enter.

## Salvando

Essa daqui é bem simples, mas vai que alguém não conhece, né? Para salvar o seu código sem ter que clicar em File > Save, você pode apertar Ctrl + S. Eu confesso que faço isso de forma quase obsessiva a cada alteração no código rs.

## Indentando código

Indentar bem o código é fundamental para um código legível, e um código legível é o que diferencia um bom programador de um ótimo programador que está preparado para trabalhar em equipe.

Para adicionar indentação ao código, selecione a seção e aperte Tab. Exagerou? Aperte Shift + Tab.

Simples, mas essencial.

## Abrindo o terminal

Não adianta fugir, você vai usar o terminal. Seja para instalar frameworks, bibliotecas ou para subir seu código para o GitHub. O VS Code ajuda bastante nessas tarefas com seu terminal integrado.
Uma maneira de abrir ele é clicar em Terminal > New. Mas você pode fazer isso com uma só mão apertando Ctrl + J.


Me conta, o que mais ficou faltando?

Bons códigos!
Rails Migration custom Direction Action
Tags: rails, migration
Published: 2023-02-17 20:04:17

---
title: Rails Migration custom Direction Action
published: true
description: Specify an operation that is only run when migrating up or down
tags: rails, migration
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-17 19:48 +0000
---

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

There are several options to specify direction dependent actions in Rails applications

## Example 1 - reversible

```ruby
class AddSlugToUserss < ActiveRecord::Migration
  def change
    add_column :users, :slug, :string, limit: 64
    add_index :users, :slug, unique: true

    reversible do |dir|
      dir.up do
        User.find_each(&:save)
      end
    end
  end
end
```

Reference: https://apidock.com/rails/ActiveRecord/Migration/reversible

## Example 2 - up_only

```ruby
class AddSlugToUserss < ActiveRecord::Migration
  def change
    add_column :users, :slug, :string, limit: 64
    add_index :users, :slug, unique: true

    up_only do |dir|
      User.find_each(&:save)
    end
  end
end
```

Reference: https://apidock.com/rails/ActiveRecord/Migration/up_only
[System.Serializable] in Unity
Tags: unity3d, unity2d, gamedev
Published: 2023-02-17 19:59:23

`[System.Serializable]` is a C# attribute that can be applied to a class, struct, or field to indicate that it can be serialized by Unity's serialization system. By doing which will allow developer to save data locally (or remotely via API) , and reload later. Here's a simple example of how to use the `[System.Serializable]` attribute:

```csharp
[System.Serializable]
public class PlayerData
{
    public string name;
    public int score;
    public float health;
}
```

The reason of using the `[System.Serializable]` is it can make a custom class Serializable, meaning store and reload from local device in text format, such as Json or xml.

## What kind of data can be serialized

This includes:

* Basic data types such as int, float, and string
* Arrays of basic data types or other serializable objects
* Classes that implement the `ISerializable` interface
* Lists, dictionaries, and other collection types that contain serializable objects

However, some other types such as `Transform` can't be serialized, or custom data type that user define themselves. So how to serialize those kinds of data types?


## Serialize advanced data types

To serialize advanced data types such as `Transform`, we can create a wrapper class to hold the values of a transform that we want to serialize. Here is an example:

```csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TransformSerialize : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("transform: " + gameObject.transform);
        SerializableTransform st = new SerializableTransform(gameObject.transform);
        string json = JsonUtility.ToJson(st);
        Debug.Log("transform json: " + json);
        Transform tf = JsonUtility.FromJson<SerializableTransform>(json).DeserializableTransform()
        Debug.Log("transform json to object: " + tf);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}


[System.Serializable]
public class SerializableTransform
{
    public Vector3 position;
    public Quaternion rotation;
    public Vector3 scale;

    public SerializableTransform(Transform transform)
    {
        position = transform.position;
        rotation = transform.rotation;
        scale = transform.localScale;
    }

    public Transform DeserializableTransform()
    {
        GameObject tempGamObject = new GameObject();
        Transform newTransform = tempGamObject.transform; 
        newTransform.position = position;
        newTransform.rotation = rotation;
        newTransform.localScale = scale;
        return newTransform;
    }
}
```

In above script, we have a SerializableTransform which can convert a Transform data Serializable. Also we can have a method which can revert it back DeserializableTransform.

*👉 If you want received more stories like this, please subscribe my channel to get the latest update in time.*

**Ref: **https://hackingwithunity.com/system-serializable-in-unity/
Amazon Polly
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-02-17 19:55:51

[48/100] #100DaysOfCloud Today, I checked out and experimented with Amazon Polly and learned more about its use cases.

Amazon Polly uses deep learning technologies to synthesize natural-sounding human speech, so you can convert articles to speech. With dozens of lifelike voices across a broad set of languages, use Amazon Polly to build speech-activated applications.
 - Customize and control speech output that supports lexicons and Speech Synthesis Markup Language (SSML) tags.
 - Store and redistribute speech in standard formats like MP3 and OGG.
 - Quickly deliver lifelike voices and conversational user experiences in consistently fast response times.

<u>Use cases:</u>
- Generate speech in dozens of languages
 - Add speech to applications with a global audience, such as RSS feeds, websites, or videos.

- Engage customers with a natural-sounding voice
 - Store and replay Amazon Polly speech output to prompt callers through interactive or automated voice response systems.

- Adjust speaking style, speech rate, pitch, and loudness
 - Use SSML, a W3C standard XML-based markup language for speech synthesis applications, to support common SSML tags for phrasing, emphasis, and intonation.

You can try do it by yourself by following the steps from the link below: [GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/048/Readme.md)
Schneider y la economía local
Published: 2023-02-17 19:54:27

En este sentido, las tres entidades están buscando sinergias que les permitan luchar contra el cambio climático al trabajar en ecosistema, aprovechando las actividades y propósitos de cada una de ellas y promoviendo un modelo energético renovable, local y de participación ciudadana. 

La fábrica de Schneider Electric en Puente la Reina es una de las más punteras de España en términos de transición energética. Cuenta con 817 kWp en paneles solares instalados en toda la cubierta de la fábrica que cargan 135 kWh en baterías que alimentan la planta, e integra la primera microgrid instalada en una fábrica española, un sistema que aúna la generación renovable y el almacenamiento con un sistema de inteligencia artificial y machine learning, para gestionar la energía de forma eficiente. ​​  

Rafael Ruiz Ojeda, Sustanibility & Real Estate Manager, de Schneider Electric, ha asegurado: "como empresa socialmente responsable, estamos totalmente comprometidos en potenciar las comunidades en las que trabajamos, promoviendo iniciativas locales y ayudando a empoderar todo el ecosistema para avanzar en la sostenibilidad. La colaboración que acabamos de firmar con el Ayuntamiento de Puente La Reina y GaresEnergía está totalmente alineada con estos objetivos y sin duda contribuirá a crear un entorno local más sostenible para todos". 
https://www.belohorizonteuniversal.com/                  
https://www.correiorecife.com/                           
https://www.visaodosul.com/                              
https://www.brasiliadeultimahora.com/                      
https://www.somosnoticias.mx/
https://www.noticiasnacional.mx/
https://www.diariomeridiano.mx/
https://www.informativosaopaulo.com/                           
https://www.desapertofinanceiro.com/                        
https://www.motivoempreendedor.com/
The Story behind my Newsletter
Tags: career, beginners, community, todayilearned
Published: 2023-02-17 15:00:00

My career had a rough start, but I learned something that changed my trajectory forever, which helped me grow from a new grad (IC3) to a staff engineer (IC6) in 3 years.

At my first job, I was responsible for maintaining a database script that my manager had written by himself without using source control. The script contained over 10,000 lines of complex queries that were interconnected. Since we didn't use code review, the script had a lot of typos and bugs that could have been avoided. We made edits to the script directly in production, which caused frequent breakages. These breakages took a long time to recover from because we couldn't revert without source control. I felt like I wasn't growing as an engineer and had no idea how to grow since I was a new grad with no mentorship.

After eight months, I decided to accept an offer to work at Facebook. I ended up on a team where I was lucky enough to have incredible mentors who taught me industry best practices. Thanks to their guidance, I became a staff engineer faster than expected.

{% twitter 1496948697795465218 %} 

Mentorship made a huge difference in my career trajectory. I'm grateful and want to help close the gaps for engineers that don't have dedicated mentorship at work. I'll share what helped me grow as fast as I did through my newsletter so you can benefit.

Every post from my newsletter will have no fluff and will be readable in less than five minutes. I'll publish it on Friday mornings since there are often less meetings that day. It's also completely free so you can just focus on learning.

[You can subscribe to my newsletter on Substack here](https://www.developing.dev/). My top priority is to make the content as good as it can be. If you have any suggestions on how to improve it for the community, please [reach out to me on Twitter](https://twitter.com/ryanlpeterman) or reply to the newsletter emails. I will read every response.
Thanks,
– Ryan Peterman