teleren/devto huggingface dataset:
How to secure an existing SSH key with a passphrase
Tags: security, howto, tutorial, ssh
Published: 2024-04-06 21:55:57

I mentioned in a previous article why it's important to secure your  ssh key with a passphrase

{% embed https://dev.to/ccoveille/why-using-a-passphrase-to-secure-your-ssh-key--5fal %}

## Securing a private SSH with a passphrase.

To add a passphrase to an existing SSH key, you can use the ssh-keygen command with the -p option. 

```shell
ssh-keygen -p -f ~/.ssh/id_ed25519
```

Replace "~/.ssh/id_ed25519" with the path to your SSH **private** key if it's different.

You'll be asked to enter a new passphrase. Type your desired passphrase and press Enter.

You'll need to confirm the new passphrase by entering it again when prompted.

Here is what it looks like

```console
$ ssh-keygen -p -f ~/.ssh/id_ed25519
Enter new passphrase (empty for no passphrase): ******** + Enter
Enter same passphrase again:                    ******** + 
```

This process updates the passphrase for your private SSH key without needing to generate a new key pair.

## Consequences on your public key

**None. Your public key won't change.**

There is no need to update your ssh key on ssh servers, git config (if you are signing your commits), or on GitHub/GitLab account settings.

You only secured the way your private key is secured.

## Consequences if you forget the passphrase

There is nothing you can do. It's similar to having a comprised or deleted key. 

You will have to generate a new SSH key, the private and public key will be different.

## How to change the passphrase of an SSH key

If you want to change the passphrase of an ssh key that has already one, simply launch the same command again.

So you will be prompted to enter the old passphrase if one exists, then you can choose a new one.

```console
$ ssh-keygen -p -f ~/.ssh/id_ed25519
Enter old passphrase: ***** + Enter
Enter new passphrase (empty for no passphrase): ******** + Enter
Enter same passphrase again:                    ******** + Enter
```

## How to remove a passphrase from a SSH key

To remove the passphrase from an existing ssh key, you only have to use an empty passphrase for the new key.

```console
$ ssh-keygen -p -f ~/.ssh/id_ed25519
Enter old passphrase: ***** + Enter
Enter new passphrase (empty for no passphrase): Enter
Enter same passphrase again:                    Enter
```
Why using a passphrase to secure your SSH key ?
Tags: security, tutorial, ssh
Published: 2024-04-06 21:48:19

## Why?

Adding a passphrase to an SSH key enhances security by protecting your private key from unauthorized use. 

Here are the key reasons why adding a passphrase is beneficial:

### Protection against unauthorized use

A passphrase adds an extra layer of security to your SSH key. Without a passphrase, anyone who gains access to your computer could potentially copy your private key and use it to access servers or services that trust the corresponding public key. This could include family members, coworkers, system administrators, or even hostile actors.

### Security in case of compromise or stolen laptop.

If your computer is compromised, a secure passphrase helps keep your private key from being copied and used by unauthorized individuals. This is crucial because once a private key is compromised, it can be used to access any system or service that trusts the corresponding public key.

## Temporary Passphrase Caching

While the downside of using a passphrase is that you need to enter it every time you create a connection using SSH, you can mitigate this inconvenience by using `ssh-agent` to temporarily cache your passphrase. This way, you don't have to enter it every time you connect, making the process more convenient while still maintaining a high level of security.

## Debates about the need to use a Passphrase

Some argue that there's no loss in security by not having a passphrase on your key, as the security of the key itself becomes paramount. However, this viewpoint assumes that the key is stored securely and that the environment in which it's stored is secure. If the key is compromised, a passphrase would not prevent its use. Therefore, the decision to use a passphrase should be based on the security of the key's storage and the sensitivity of the data or services it protects.

**TL;DR;** adding a passphrase to an SSH key is a security best practice that helps protect your private key from unauthorized use, especially in scenarios where your computer might be compromised. While it introduces a minor inconvenience by requiring you to enter the passphrase for each SSH connection, using `ssh-agent` can alleviate this issue.
How to generate a secure and robust SSH key in 2024
Tags: security, tutorial, howto, ssh
Published: 2024-04-06 21:46:23

To generate a robust SSH key, you have two main options: ED25519 and RSA. Both have their advantages, but ED25519 is generally recommended for its security and performance benefits. 

Here's how to generate each type of key:

## Generating an ED25519 Key

ED25519 keys are considered more secure and performant than RSA keys. They are compact, fast to generate, and offer better security with faster performance compared to DSA or ECDSA. To generate an ED25519 key, use the following command:

```
ssh-keygen -t ed25519 -C "<comment>"
```

Replace <comment> with a meaningful comment, such as your email address. This comment won't be exposed outside your machine. Consider it as a label to identify your ssh key.

This command generates an ED25519 key pair and saves it in the default .ssh directory within your home directory. 

You'll be prompted to enter a passphrase for the key, which adds an extra layer of security.

{% embed https://dev.to/ccoveille/why-using-a-passphrase-to-secure-your-ssh-key--5fal %}

## Generating an RSA Key

If you prefer to use RSA, it's recommended to use a key size of at least 2048 bits for security. However, a 4096-bit key is even more secure and is recommended if you're concerned about the future of cryptographic security. To generate an RSA key with a 4096-bit size, use the following command:

```
ssh-keygen -t rsa -b 4096 -C "<comment>"
```

## Additional Considerations

- Security: ED25519 keys are more secure against PRNG (Pseudo-Random Number Generator) failures, making them a robust choice for SSH keys.
- Performance: ED25519 keys are faster and more efficient than RSA keys, which can be a significant advantage in environments with high security requirements 2.

- Compatibility: Ensure your system supports the key type you choose. ED25519 is supported in OpenSSH version 6.5 and later, while RSA keys are widely supported across all versions 2.

To check your ssh version, you can run the following command

```console
$ ssh -V
OpenSSH_8.9 ...
```

Please note the ssh servers you log are the ones that need to support ED25519 keys, so please make sure to check on them before trying anything. 

**TL;DR;** For generating a robust SSH key, ED25519 is generally the preferred choice due to its security and performance benefits. However, RSA keys with a 4096-bit size are also a secure option if you have specific compatibility requirements or preferences.
Asynchronous Planning Poker
Tags: webdev, scrum, agile, react
Published: 2024-04-06 20:51:56

Kollabe has an asynchronous mode for your Planning Poker sessions, allowing Agile teams to estimate tasks even when their schedules or timezones don't align. This flexibility is a game-changer for a lot of teams, enabling distributed teams to unlock the benefits of Planning Poker without the need for more meetings.

## How Async Planning Poker Works in Kollabe

With Kollabe's asynchronous planning poker, the meeting creator can input or import all the tickets beforehand, and then share a unique link with their team. There are several ways to import tickets like:

1. Our Jira Integration
2. CSV Upload
3. Manually entering them in

The team can then go through the tickets at their own pace, casting their votes and leaving comments as needed.

The Scrum master can monitor the progress of the session, see the team's votes, and respond to any questions or comments left in the chat. This asynchronous approach ensures that everyone has the opportunity to contribute their insights, even if they can't all be present at the same time.

For a more mature team, it can be as simple as that. Reveal the votes and record the story point value. If there is a huge difference in votes, just start a discussion in your favorite communication channel. No need for another meeting.

[Learn more about asynchronous planning poker on Kollabe](https://kollabe.com/posts/asynchronous-planning-poker)
How to host a Website on AWS Amplify
Published: 2024-04-06 20:38:23



AWS Amplify helps developers build and deploy applications in minutes.
It is fast, simple and easy to use.

**Let's get started**
We are going to host a static website built with HTML & CSS on Amplify

**Step 1** 
- Login into the console and search "**Amplify**"

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

**Step 2** 
- Under the hosting section Click **get started**
- Select **deploy without git** to upload the website source code from your local machine.


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



**Step 3** 
- Enter the **App name **
- Provide an **Environment name** e.g Test, Dev 
- Select the **drag & drop** as preferred method of uploading files.


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



**Step 4** 
- Drag your website folder 📁 to the console and wait for it to be uploaded


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

Our website folder has been uploaded successfully 
- Click **save & deploy** and wait for some minutes for our website to be fully deployed.

**Step 5** 
- Deployed! Our website has been deployed successfully!


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

- Click on the domain link or copy the URL to your browser
The website is up and running.

Below is a screenshot of the test website

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


Please delete the deployed project after use to avoid being charged.
Building a REST API with FastAPI, Async SQLModel, and PostgreSQL
Tags: python, api, fastapi, sql
Published: 2024-04-06 20:13:15

In this video, we Build a REST API with FastAPI, SQLModel, and PostgreSQL. SQLModel is an ORM built to combine the powerful SQLAlchemy ORM with the useful Pydantic data validation library, enabling us to create database models that can be used for data validation.
{%youtube I8WiIXMDydw%}
Cloudflare AI
Tags: cloudflarechallenge, devchallenge, ai, javascript
Published: 2024-04-06 19:42:47

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  // Your logic to handle the request and use the AI model goes here
  // For example, using an image classification model:
  const imageUrl = new URL(request.url).searchParams.get('image_url');
  const result = await classifyImage(imageUrl);
  return new Response(JSON.stringify(result), { status: 200 });
}

async function classifyImage(imageUrl) {
  // Logic to call the AI model and return the classification result
  // This is a placeholder function, you'll need to replace it with actual API calls
  return { classification: 'example' };
}
10 Must-Have Tools for Every Developer's Toolkit
Published: 2024-04-06 19:16:27

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

**Integrated Development Environment (IDE)**: A powerful IDE such as Visual Studio Code, JetBrains IntelliJ IDEA, or Eclipse provides essential features like code editing, debugging, and version control integration, streamlining the development process.

**Version Control System (VCS)**: Git is indispensable for tracking changes to code, collaborating with team members, and managing project versions. Platforms like GitHub, GitLab, or Bitbucket offer hosting and collaboration features for Git repositories.

**Package Managers**: Package managers like npm (for JavaScript), pip (for Python), or Maven (for Java) simplify dependency management by automatically installing, updating, and resolving dependencies for projects.

**Command-Line Interface (CLI) Tools**: Tools like Git, Node.js, and Docker often come with powerful command-line interfaces that allow developers to perform tasks efficiently and automate workflows.

**Code Linters and Formatters**: Tools like ESLint (for JavaScript), Pylint (for Python), and RuboCop (for Ruby) help maintain code quality and consistency by identifying syntax errors, style violations, and formatting issues.

**Continuous Integration/Continuous Deployment (CI/CD) Tools**: CI/CD platforms like Jenkins, Travis CI, or CircleCI automate the build, test, and deployment process, ensuring that code changes are thoroughly tested and deployed consistently.

**Containerization Tools**: Docker enables developers to package applications and their dependencies into lightweight containers, making it easy to deploy and run applications consistently across different environments.

**API Development Tools**: Tools like Postman or Insomnia simplify API development by providing features for testing, debugging, and documenting APIs, making it easier to build robust and scalable web services.

**Text Editors**: While IDEs offer comprehensive features, lightweight text editors like Sublime Text, Atom, or Vim are handy for quick edits, viewing files, or working on remote servers.

**Collaboration and Communication Tools**: Platforms like Slack, Microsoft Teams, or Discord facilitate communication and collaboration among team members, allowing developers to share ideas, discuss issues, and coordinate project tasks effectively.

_By incorporating these essential tools into their toolkit, developers can streamline their workflows, improve productivity, and build high-quality software more efficiently._
How to write a factorial program in C++ using for loop
Tags: programming, tutorial, learning, github
Published: 2024-04-06 19:12:46

Certainly! Here's a simple C++ program that calculates the factorial of a number using a `for` loop:

```cpp
#include <iostream>

int main() {
    int n;
    unsigned long long factorial = 1;

    std::cout << "Enter a positive integer: ";
    std::cin >> n;

    if (n < 0) {
        std::cout << "Factorial of a negative number doesn't exist.";
    } else {
        for(int i = 1; i <= n; ++i) {
            factorial *= i;
        }
        std::cout << "Factorial of " << n << " = " << factorial;    
    }

    return 0;
}
```

This program first prompts the user to enter a positive integer. Then, it uses a `for` loop to multiply the numbers from 1 up to the entered number to calculate the factorial. If the user enters a negative number, it outputs an appropriate message. Remember, the factorial of 0 is 1.
A Saturday Night Crossroads: Reflections and Choices in the World of IT
Tags: beginners, productivity, career, learning
Published: 2024-04-06 19:08:54

On any given Saturday night, as the city surrenders to its rituals of rest and leisure, I find myself in front of my computer, reflective and surrounded by an almost tangible stillness. With 25 years of experience in the field of Information Technology, I've navigated through all its nuances - from support to management, through networks, infrastructure, development (back and front-end), operations, and databases. Today, however, the stillness invites me to share a deep reflection with you, newcomers on this endless journey that is IT.

## Why Study on a Saturday Night?

The answer seems to lie in the very essence of what drives us. IT, with its incessant rhythm of innovations, challenges us to always be on the move, always learning. Choosing to dedicate a Saturday night to study is not an escape from leisure but a deep dive into what we are passionate about. It is the acknowledgment that our professional and personal development is an open work, a book we write line by line with our choices and dedication.

## The Crossroads of Paths in IT

Before me unfolds the spectrum of possibilities in IT. Each segment, a distinct story; each specialization, a universe of its own. And here I am, with decades of experience, still wondering: "Which path to follow now?" This is the beauty and the curse of our field - we are at once architects and inhabitants of a world in constant construction.

To the newcomers, I want to say: doubt is part of the journey. If today I find myself at a crossroads, pondering which IT segment to embrace, it's because I've understood that our growth is never linear, nor limited. Technology is a vast and dynamic field, and true wisdom lies in knowing that there will always be more to learn, more to discover.

## Choices That Shape the Future

The decision about which path to take in IT should be guided not only by market trends or job demands but by a deep introspection about our passions, skills, and the kind of impact we want to have on the world. Whether in cybersecurity, artificial intelligence, software development, or any other field, what truly matters is finding that spark that motivates us to keep learning and contributing.

## A Message to the Novices

For you, who are beginning this journey, my advice is: explore without fear. Enjoy the freedom of not being tied to a single path. IT is a rich and diversified ecosystem, where each experience, each project, each line of code tells a story. If on this Saturday night I chose to study, it was to remind myself and you that we are eternal students of this vast digital universe.

And so, as the city around me rests, I find peace in my reflections, aware that today's doubts are the steps that pave the way for tomorrow. And, at the heart of IT, there will always be another line of code to write, another problem to solve, another innovation to dream of.
10 Common Mistakes Every Beginner Programmer Makes
Published: 2024-04-06 19:06:21


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

1. **Overcomplicating Solutions**: Beginners often fall into the trap of trying to solve problems with overly complex solutions. Encourage simplicity and elegance in code.

2. **Skipping Fundamentals**: Many beginners rush into coding without fully understanding the fundamentals of programming concepts like data types, loops, and conditionals. Stress the importance of mastering the basics before moving on to more advanced topics.

3. **Ignoring Documentation**: Beginners may neglect to read documentation thoroughly, missing out on valuable insights into how to use libraries, frameworks, and programming languages effectively.

4. **Lack of Version Control**: Not using version control systems like Git from the outset can lead to messy codebases and lost work. Emphasize the importance of version control for collaboration and code management.

5. **Not Testing Code**: Beginners sometimes write code without testing it thoroughly, leading to bugs and errors that could have been caught early with proper testing practices.

6. **Copying and Pasting Code**: While it's tempting to copy and paste code from online sources, beginners may not fully understand how it works, leading to problems down the line. Encourage understanding and modification of code snippets to fit specific needs.

7. **Fear of Asking for Help**: Beginners may hesitate to ask for help when they encounter difficulties, leading to frustration and wasted time. Encourage a supportive learning environment where asking questions is encouraged.

8. **Overlooking Code Readability**: Writing code that is difficult to read and understand makes it harder to maintain and debug. Stress the importance of writing clean, readable code that others (and your future self) can easily comprehend.

9. **Not Taking Breaks**: Spending long hours coding without breaks can lead to burnout and reduced productivity. Encourage beginners to take regular breaks to rest and recharge.

10. **Impatience**: Learning to code takes time and patience, and beginners may become discouraged if they don't see immediate results. Emphasize the importance of perseverance and incremental progress in mastering programming skills.


By addressing these common mistakes, beginner programmers can develop better habits and become more effective and confident developers in the long run.
Java at 25: Features that Made an Impact and a Look to the Future
Tags: java
Published: 2024-04-06 18:50:14

As we celebrate Java’s silver jubilee, it’s worth reflecting on the journey of this versatile programming language. From its inception in 1995 to its current status as a workhorse in the software industry, Java has left an indelible mark. I had the privilege of speaking with Georges Saab, Vice President of Software Development at Oracle’s Java Platform Group, about the pivotal features that shaped Java’s trajectory and the exciting prospects that lie ahead.

#1. The Library Renaissance

The early releases of Java witnessed a library renaissance. Between versions 1.0 and 1.3, Java’s standard libraries evolved significantly. Key additions included:

**Swing Window Toolkit:**
A graphical user interface (GUI) library that transformed Java applications into visually appealing desktop software.
**Collections Framework:**
A powerful set of data structures and algorithms that made Java a serious contender for enterprise development.
**JDBC (Java Database Connectivity):**
Enabling seamless interaction with databases, JDBC became the backbone of countless applications.

These libraries elevated Java from a promising language to a robust platform for building real-world solutions.

#2. The Generics Revolution
In 2004, Java introduced generics. This seemingly innocuous feature had a profound impact. Generics allowed developers to write type-safe code while maintaining flexibility. It was a game-changer for collections, APIs, and frameworks. Although met with skepticism initially, generics became an essential tool for expressing type constraints without sacrificing safety.


#3. The Java Virtual Machine (JVM)
The JVM, Java’s silent conductor, deserves applause. It bridges the gap between platform independence and execution efficiency. By interpreting bytecode, the JVM ensures that Java code runs consistently across diverse environments. It’s the reason we can confidently say, “Write once, run anywhere.”

#4. The Road Ahead
What lies ahead for Java? Georges Saab highlights a few features that will shape its future:
**Project Loom:** Addressing the complexities of concurrency, Loom aims to make multithreading more accessible. It introduces lightweight threads (fibers) that simplify asynchronous programming.
**Project Panama:** Bridging the gap between Java and native code, Panama enhances interoperability. It allows seamless integration with libraries written in other languages.
**Records:** A concise way to define classes for data storage, records reduce boilerplate code. They enhance readability and maintainability.

#5. Conclusion
Java’s journey from the classroom to enterprise systems has been remarkable. As we celebrate its 25th anniversary, let’s appreciate the collective effort of developers, contributors, and the vibrant Java community. Whether you’re building microservices, Android apps, or cloud-native solutions, Java remains a steadfast companion—a language that adapts, endures, and continues to shape the digital landscape.