teleren/devto huggingface dataset:
My First Terminal-Based Program
Published: 2023-12-19 00:36:12

Hello! This is my first blog post to the Dev community and thought it would be fun to share my terminal-based Blackjack program. The program is based off of the standard Blackjack rules and is implemented in Python. It simulates the classic casino game and allows the player to play against an automated dealer. 

## Features
- Terminal-based user interface
- Basic Blackjack game actions: hit / stand
- Tracks player balance
- Automated dealer following standard Blackjack rules

I know it is a fairly simple program but would appreciate any comments/feedback.

Here is my [project link on github.](https://github.com/Sam-Lap/terminal-blackjack.git)
How I use ChatGPT For Productivity in Digital Marketing
Published: 2023-12-19 00:20:57

> 1) Never let those precious prompts go away

The first and foremost rule for me is, to document all of your long prompts somewhere. For me, I use Google Spreadsheet. (I'm thinking of sharing my prompt collection sometime.)

Just make a 2 column spreadsheet, the first column is a brief description, and the second column is the prompt itself. I remove the things that I can change and put something like [idea], [item], [keyword], etc, so I can replace them easily. In the future, I'm also thinking to make the prompt dynamically by using other columns.


![Prompt Spreadsheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yeu7noju7i44anp98tc1.PNG)


> 2) Always edit the content given by "smart" ChatGPT

You will always see a pattern when asking ChatGPT to make an article, content, script, or any content, especially if you don't specify writing style. Always modify it to become your style.

> 3) Ask ChatGPT to fix the grammar of your writing without modifying the content.

You can also use Grammarly, Quillbot, or any writing AI service, but sometimes I just ask ChatGPT to do it for me.

> 4) Sometimes ChatGPT 3.5 is better for some of my use case.

I tried to use ChatGPT-4, but sometimes, the version 3.5 has better response for my use case. So, if the response given by the version 4 doesn't suit you, try to use its sibling.

> 5) Use the paid version, it is worth it.

You will have access to DALL-E, Data Analysis, and many plugins. You will love it and never think to go back.

---

That's it, my first post. I hope it will help any software engineer who wants to become a digital marketer. Make sure to check my profile. I put my repo that discusses affiliate marketing.
Triop system maneuver
Tags: systems, desktop, productivity
Published: 2023-12-19 00:00:14

Over the last couple days I have been trying to highlight my GitHub profile by adding some of the projects that I was working on, in the process of that I found myself in a dilemma… how do I get the stuff off my Linux machine onto my Mac machine and the stuff from my windows machine onto my Linux machine?
Quite a dilemma that I seemed to have fallen in, which I don’t know how popular of a choice it really is, but I’m in it.

In the past I have just been on the Mac/Windows front, and use a Remote Desktop app to Jump from one to the other. Then I introduced my Microsoft Surface Pro 5 running Ubuntu 22.04 into the mix, the Remote Desktop apps on Linux in the past, I have not found to play very well with each other…
So I am experienced enough in the terminal that I could follow instructions how to set up ssh. Ultimately I am only looking to access my terminal on these machines, it would be nice if I could use my Ubuntu tablet that I can bring anywhere, but then be able to use the terminal to run apps on the heavier machines… I don’t know if ssh is the answer or if rdp is the better option…

I guess the only problem that I am coming up with is do I need visual or can I stay in the terminal, which is where I would like to be. 
The way I see it working would be opening my Linux terminal, to ssh into my windows pc, do some kind of file transfer over to the Linux machine via the terminal, then in another tmux session ssh into the Mac that I can compile and test some ARM assembly, as well as some Xcode terminal stuff for objective-c and swift. 
So it would be cool to know if this is possible to do in terminal or if I should be looking in another direction???
Holiday Break: Code Retreats? or Code Reprieves? ⛷️🤖
Tags: discuss, codenewbie, beginner
Published: 2023-12-19 00:00:00

---
published_at : 2023-12-19 00:00 +0000
---
Ever taken a coding retreat or a coding pause during the holiday break? Share your experience.
<br>
Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!
*{% embed* https://dev.to/codenewbieteam *%}*
Open Source Impact: Reflecting on 2023 Contributions
Tags: discuss
Published: 2023-12-19 00:00:00

---
published_at : 2023-12-19 00:00 +0000
---
Reflect on your open-source contributions in 2023 and tell us about your experiences. Why do you contribute?
<br>
Follow the DEVteam for more discussions and online camaraderie!
{% embed https://dev.to/devteam %}
Setup EC2 Instance
Tags: webdev, javascript, aws, devops
Published: 2023-12-19 00:00:00

For this step, we will create an EC2 instance to deploy our server app. Here are several steps to do it:


- **Sign in to the AWS Management Console:**
    - Go to the [AWS Console](https://aws.amazon.com/).
    - Click on "Sign in to the Console" and enter your credentials.
- **Navigate to the EC2 Dashboard:**
    - Open the EC2 Dashboard.
    - Click on **`Launch Instance`** to create a new instance.
    
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb57du5j2h2hjzgmpll1.png)

- **Enter Name and Tags:**
Enter the name of the instance.

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

- **Choose an Amazon Machine Image (AMI):**
AMIs are pre-configured templates for your instances. For this project, we will select Ubuntu.
    
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tsu7k37wtfdu8n525cz.png)
    
- **Choose an Instance Type:**
Instances come in different sizes, catering to various performance and cost needs. For this project, we will select the free tier.

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

- **Create a Key Pair:**
Key pairs are used for secure access to your instances.
    

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

Create and download the private key file and keep it secure. We will need this file to access the instance from our computer.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f8l8fizhrdbalt4d2pm5.png)
  
- **Configure Network Settings:**
This security group acts as a virtual firewall for your instance, controlling inbound and outbound traffic. For now, add the group name and the source IP type; we will configure the rest later.

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

- **Launch the Instance:**
Finally, click the **`Launch Instances`** button. AWS will take several minutes to set up the instance. The instance will be available when its state is **`Running`**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0ea0385bljieegwkn8z.png)
Generating Text with Gemini Pro in Apps Script
Tags: geminipro, appsscript, llm, ai
Published: 2023-12-27 21:54:22

---
title: Generating Text with Gemini Pro in Apps Script
published: true
date: 2023-12-19 00:00:00 UTC
tags: geminipro, appsscript, llm, ai
canonical_url: https://justin.poehnelt.com/posts/apps-script-gemini-pro-text/
---

Short and sweet snippet for generating text in Apps Script with the [Gemini Pro Rest API](https://ai.google.dev/tutorials/rest_quickstart).

```js
function generateContent(text, API_KEY) {
  const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=${API_KEY}`;
  return JSON.parse(UrlFetchApp.fetch(url, {
    method: "POST",
    headers: {
      "content-type": "application/json"
    },
    payload: JSON.stringify({
      contents: [{
        parts: [
          {text}
        ]
      }]
    }),
  }).getContentText())
}
```

And parsing the response:

```js
const response = generateContent("Hello world!", API_KEY);
const text = response.candidates[0].content?.parts[0].text;
```
HOW TO CONSULT THE BEST BITCOIN RECOVERY EXPERT - MUYERN TRUST HACKER
Tags: bitcoin, database, cryptocurrency
Published: 2023-12-18 23:21:36

Regrettably, hackers are now focusing their efforts on Bitcoin, the virtual money that has completely revolutionized the financial industry. Because of its rising market value and popularity, Bitcoin theft is becoming a major problem for both individuals and companies. This is where MUYERN TRUST HACKER experience is useful. Getting back stolen Bitcoin is a difficult endeavor. Transactions with cryptocurrencies are by their nature complicated, requiring numerous addresses, decentralized networks, and sophisticated encryption techniques. These elements make it very difficult to track down and recover funds that have been stolen. But MUYERN TRUST HACKER is a master at negotiating these obstacles and uses creative tactics to track down the robbers. Cryptocurrency theft investigation calls for a certain set of abilities and knowledge. It entails looking for unusual patterns in blockchain transactions, evaluating them, and tracking the stolen money to different addresses. The staff at MUYERN TRUST HACKER use new technologies and methods to locate and retrieve Bitcoin that has been stolen. They have a thorough understanding of the inner workings of blockchain technology. The foundation of cryptocurrencies like Bitcoin, blockchain technology, is essential to recovery efforts. Investigators can track the flow of stolen money because of the blockchain's thorough audit record of transactions, which is made possible by its transparency and immutability. By using advanced technologies to track and analyze the movements of Bitcoin that have been stolen, MUYERN TRUST HACKER takes advantage of this technological advancement. One of the top companies for recovering Bitcoin that has been stolen is MUYERN TRUST HACKER. To help victims recover their priceless digital possessions, their team of experts combines their expertise in cybercrime and cryptocurrencies. MUYERN TRUST HACKER has established a brilliant reputation in the field thanks to its extraordinary skill and professionalism.  With a staff of very talented individuals, MUYERN TRUST HACKER is well-versed in forensics, cybersecurity, and cryptocurrencies. They make sure their clients receive the best service possible by being committed to keeping up with the newest industry trends and approaches. If you need any help reach them on their website:  ( https://muyerntrusthack.solutions/ ) Email: muyerntrusted(at)mail-me(.)com and also on Telegram: @ muyerntrusthacker Thank you.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8gmc91rczho9arzs115.jpg)
Hooked Book #3 - Action
Tags: design, ethic, books, resume
Published: 2023-12-18 23:19:04

_If the user does not take action, the trigger is useless._

Action it's the second step in the Hooked model and it's the simplest behavior in anticipation reward. So, doing must be easier than thinking.

As described by Dr. B. J. Fogg's behavior model:

{% katex %}
 B = MAT
{% endkatex %}

A given **B**ehavior will occur when **M**otivation, **A**bility and a **T**rigger are present at the same time.

Where **motivation** is the level of desire to take that action or the energy for that action and **ability** is the capacity to do a particular behavior and is influenced by six factors: time, money, physical effort, brain cycles, social deviance and non-routineness.

Every behavior is driven by one of three Core Motivators: seeking pleasure and avoiding pain, seeking hope and avoiding fear, and seeking social acceptance while avoiding social rejection.

Product designers can utilize many of the hundreds of heuristics to increase the likehood of their desired action like: the scarcity effect, the framing effect, the anchoring effect, the endowed progress effect and many others.
Print a single element from a webpage using JavaScript
Tags: javascript, webdev
Published: 2023-12-18 22:18:26

I use this code snippet in the dev tools to print a small portion of a webpage. It copies every CSS stylesheet in the head of the page which helps render the printed content as close as possible to how it appears in the browser. 

```javascript
function printElement(element) {
    const newWin = window.open('', 'Print-Window');
    
    // Copy all stylesheets
    let stylesheets = '';
    for (var i = 0; i < document.styleSheets.length; i++) {
        if (document.styleSheets[i].href) {
            stylesheets += '<link rel="stylesheet" href="' + document.styleSheets[i].href + '" type="text/css">';
        }
    }

    newWin.document.open();
    newWin.document.write('<html><head>' + stylesheets + '</head><body>' + element.innerHTML + '</body></html>');
    newWin.document.close();
    setTimeout(function () {
        newWin.print();
        // newWin.close(); // close tab after printing
    }, 250); // Delay to ensure styles are applied
}

// Usage
// printElement(document.getElementById('myElementId'));
// printElement(document.querySelector('#myElementId'));
// 
// If you already have an element selected in the dev tools:
// printElement($0);
```

### How to use

1. Open the dev tools
1. Copy & paste the function above into the Console
2. Select the div you want to print
3. Then run `printElement($0)`

![Screenshot showing steps to run this function in the dev tools in Chrome](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0mk57d80dnv9i04tqep.png)

### Examples

As shown in the screenshot above, I use this often with ChatGPT responses when I want to print just one answer that might be too long to fit on a screenshot. This is actually helpful if you are creating GPTs, where you need to upload a PDF from one of the responses from GPT.

For example, this is how it looks originaly:
![Screenshot of one answer of GPT showing a factorial](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3wh7kcqwv32p0p1o1jm.png)

This is how it looks when running `printElement($0);` on that div:
![Screenshot that shows a print dialog on a new tab after running pringElement when the div was selected in the dev tools](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pyh71ww71fds6tg8ja9y.png)

And this is what it looks if you close the print dialog:
![Screenshot that shows the new tab after closing the dialog: it shows that the styles were copied as good as it can be](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tl7bgu1zfenagnvhg1ez.png)

### Conclusion

Although this simple function isn't 100% bullet proof, it helps printing certain parts of a website while attempting to keep the styles as best as it can.
Intro To HTML
Published: 2023-12-18 21:52:05

The anatomy of HTML consists of an opening tag, the content, and a closing tag. 
Opening Tag: <>
Closing tag: </> Always contain a (/)
I also learned that there is a hierarchy within the elements. 

There are six types of headings (h1-h6) Heading 1 (h1), is the biggest heading, the subsequent headings decrease in size.
One of the most popular elements in HTML are divisions known as divs, which help divide the page into sections. Within that there are attributes that are used to expand an element's tag. Which are added to the opening tag of an element, which can be used to provide info or change the styling. An attribute consists of two parts; the value and the name. Some examples of attributes are _id_ which help identify content in our web pages.
When displaying text; paragraph's or span are used. 
<p> Paragraph: Contains a block of plain text
<span> span: Best used when you are trying to separate small pieces of info that are in the same line as the other code

When it comes to styling text some examples are
(opening tag em closing tab)renders _italic_ emphasis
(opening tag strong closing tag) renders **BOLD** emphasis
For line breaks use
(opening tag br closing tag) You _only_ need a starting tag

If you want to create unordered lists use
(opening tag ul closing tag) 
Will create lists using bullet points
If you want to create ordered lists use
(opening tag ol closing tag)
Will create numerical lists
However, in either instance for them to render successfully you must format (opening tag li closing tag) as follows

(opening tag ul or ol closing tag)
(li)Eggs(/li)
(li)Milk(/li)
(li)Bread(/li)
(/ul)

The element (img) will allow you to add an image to a web page
It has self-closing tags,(while using Codeacademy it did not self-close. Need to manually insert closing. (/>)The img is not needed to close.
(img) has a required attribute called _src_ which is basically the URL of the image
To insert an image the line of code would be as follows:
(img src="image-location.jpg"/)
Within an image we can add the attribute _alt_ in order to add a description of the image. This is helpful for visually impaired readers who use text-to-speech tool. Also helpful when image is failing to load. Alt plays an important role in SEO(search engine optimization)since SE's cant "see" _alt_ provides them the capability to render better results. Alt can also improve the ranking of your site since its accessible to a broader audience.
Intro To HTML
Published: 2023-12-18 21:52:04

The anatomy of HTML consists of an opening tag, the content, and a closing tag. 
Opening Tag: <>
Closing tag: </> Always contain a (/)
I also learned that there is a hierarchy within the elements. 

There are six types of headings (h1-h6) Heading 1 (h1), is the biggest heading, the subsequent headings decrease in size.
One of the most popular elements in HTML are divisions known as divs, which help divide the page into sections. Within that there are attributes that are used to expand an element's tag. Which are added to the opening tag of an element, which can be used to provide info or change the styling. An attribute consists of two parts; the value and the name. Some examples of attributes are _id_ which help identify content in our web pages.
When displaying text; paragraph's or span are used. 
<p> Paragraph: Contains a block of plain text
<span> span: Best used when you are trying to separate small pieces of info that are in the same line as the other code

When it comes to styling text some examples are
(opening tag em closing tab)renders _italic_ emphasis
(opening tag strong closing tag) renders **BOLD** emphasis
For line breaks use
(opening tag br closing tag) You _only_ need a starting tag

If you want to create unordered lists use
(opening tag ul closing tag) 
Will create lists using bullet points
If you want to create ordered lists use
(opening tag ol closing tag)
Will create numerical lists
However, in either instance for them to render successfully you must format (opening tag li closing tag) as follows

(opening tag ul or ol closing tag)
(li)Eggs(/li)
(li)Milk(/li)
(li)Bread(/li)
(/ul)

The element (img) will allow you to add an image to a web page
It has self-closing tags,(while using Codeacademy it did not self-close. Need to manually insert closing. (/>)The img is not needed to close.
(img) has a required attribute called _src_ which is basically the URL of the image
To insert an image the line of code would be as follows:
(img src="image-location.jpg"/)
Within an image we can add the attribute _alt_ in order to add a description of the image. This is helpful for visually impaired readers who use text-to-speech tool. Also helpful when image is failing to load. Alt plays an important role in SEO(search engine optimization)since SE's cant "see" _alt_ provides them the capability to render better results. Alt can also improve the ranking of your site since its accessible to a broader audience.
🛠️Overengineering
Tags: softwaredevelopment, softwareengineering, webdev
Published: 2023-12-18 21:00:43


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dorjikoumni65xi10jmd.jpg)In software development, it's important to find a balance between efficiency and overengineering. Although complex designs and a lot of code may seem impressive, they can slow things down and make them more complicated. Overengineering is essentially making solutions more complex than needed, often by using too much abstraction, optimization, and so on.

Overengineering can cause problems like longer development times, harder maintenance, possible performance issues, and less room for innovation. To avoid these issues, it's important to balance robustness and simplicity. This means focusing on current needs, using reliable design methods, and making sure the code is easy to maintain. Regularly evaluating and refining the code is crucial to keep it clean and efficient.

Research from academia supports this notion, showing that overengineering can extend development timelines, lower software quality, and limit project flexibility. By embracing simplicity, maintainability, and adaptability, we can create software that is both effective and efficient.
Adventofcode 🎄: Day 18 - Fun fact about React!
Tags: react
Published: 2023-12-18 20:57:17

React wasn't always the widely embraced library we know today. In fact, React was first introduced to the public, it raised a few eyebrows. The idea of blending HTML with JavaScript, known as JSX, initially faced resistance from developers who were accustomed to keeping their markup and logic separate. However, as people started to see the advantages of this approach, like improved component structure and better performance, opinions shifted. JSX became a key feature of React, and the initial skepticism transformed into widespread adoption, solidifying React's place as a go-to library for building dynamic user interfaces. It's a testament to how innovation sometimes requires breaking a few traditional ways.
Installing Hugging Face on an M2 macOS Machine
Published: 2023-12-18 20:53:14

If you are installing Hugging Face transformers on a M2 macOS machine, you might run into this error

`× Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      Package sentencepiece was not found in the pkg-config search path.
      Perhaps you should add the directory containing 'sentencepiece.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'sentencepiece' found
      Failed to find sentencepiece pkgconfig
      [end of output]`

If you're [installing with pip](https://huggingface.co/docs/transformers/installation#install-with-pip), do the following before starting the install:

`pip install --upgrade pip
pip install 'transformers[tf-cpu]'
brew install sentencepiece
pip install sentencpiece`

This will resolve the error when installing [sentencepiece](https://github.com/google/sentencepiece).