teleren/devto huggingface dataset:
use gitlab ci/cd to push a file to Amazon S3
Tags: gitlab, s3, aws
Published: 2023-04-01 22:20:36

The best way to use gitlab CI is to use AWS CLI docker image

You can use GitLab CI pipeline that can upload a file to AWS S3.


AWS CLI would allow you to push to S3. 

Instead of build your own Docker image and publishing it somewhere, you could use official AWS provider docker image:

`https://hub.docker.com/r/amazon/aws-cli`


Use AWS credentials

Get an AWS IAM user with programmatic access to the S3 bucket.

Add the following variables in your GitLab CI:

- `S3_BUCKET` (the name of the S3 bucket)
- `AWS_ACCESS_KEY_ID` (provided by AWS)
- `AWS_SECRET_ACCESS_KEY` (provided by AWS)

```
COPY TO S3:
  image:
    name: amazon/aws-cli
    entrypoint: [""]
  script:
    - aws configure set region us-east-1
    - touch your-file.txt
    - aws s3 cp your-file.txt s3://$S3_BUCKET/your-file.txt

```
Migrating Node.js app from Heroku to Fly.io
Tags: node, heroku, flyio
Published: 2023-04-01 21:45:00

---
title: Migrating Node.js app from Heroku to Fly.io
published: true
tags: ['node', 'heroku', 'flyio']
canonical_url: https://sevic.dev/notes/migration-checklist-heroku-flyio/
---

I recently migrated the Node.js app from Heroku to Fly.io, mainly due to reduced costs.

This blog post will cover the necessary steps in the migration process.

### Prerequisites

- Heroku app running

- Use the exact versions for dependencies and dev dependencies in package.json so installation and build steps can pass successfully

- Use the same Node.js version in Dockerfile, package.json, and GitHub Actions workflow

- Use API gateway or custom domain for the service so web apps and mobile apps don't get affected by changing the URL of the service

### Migration steps

- Migrate environment variables and secrets

- Migrate the Postgres database with the following commands (the `ssl` field in database configuration options is not needed)

```bash
fly secrets set HEROKU_DATABASE_URL=$(heroku config:get DATABASE_URL)

fly ssh console
apt update && apt install postgresql-client
pg_dump -Fc --no-acl --no-owner -d $HEROKU_DATABASE_URL | pg_restore --verbose --clean --no-acl --no-owner -d $DATABASE_URL
exit

fly secrets unset HEROKU_DATABASE_URL
```

- Migrate the Redis database if it's used

- Include the deployment step in the GitHub Actions workflow

### References

- [Deploying Node.js apps to Heroku](https://sevic.dev/nodejs-deployment-heroku/)

- [Deploying Node.js apps to Fly.io](https://sevic.dev/nodejs-deployment-flyio/)
Launch a NGINX server on EC2 using Terraform
Tags: aws, cloud, awscommunity, 100daysofcloud
Published: 2023-04-01 21:27:51

[91/100] #100DaysOfCloud Today, I created a terraform template to deploy security group, use default VPC and an EC2 instance running NGINX.

Infrastructure as code (IaC) tools allow you to manage infrastructure with configuration files rather than through a graphical user interface. IaC allows you to build, change, and manage your infrastructure in a safe, consistent, and repeatable way by defining resource configurations that you can version, reuse, and share.

Terraform is HashiCorp's infrastructure as code tool. It lets you define resources and infrastructure in human-readable, declarative configuration files, and manages your infrastructure's lifecycle. Using Terraform has several advantages over manually managing your infrastructure:

Terraform can manage infrastructure on multiple cloud platforms.
The human-readable configuration language helps you write infrastructure code quickly.
Terraform's state allows you to track resource changes throughout your deployments.
You can commit your configurations to version control to safely collaborate on infrastructure.

You can try do it by yourself by following the steps from the link below: [GitHub](https://github.com/aaditunni/100DaysOfCloud/blob/main/Journey/091/Readme.md)
How to install docker using Linux terminal?
Tags: docker, documentation, webdev
Published: 2023-04-01 21:01:27

1. In the ssh terminal, enter the following command to install the yum-utils package:

```cmd
sudo yum install -y yum-utils
```
The yum-utils package includes a handy utility for adding package repositories that you will use next.

2. Enter the following to add the Docker CE package repositories to your system:
```cmd
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
```
3. Enter the subsequent command to update the yum cache with the Docker repositories:
```cmd
sudo yum makecache
```
4. Enter the following to install Docker CE:
```cmd
sudo yum -y install docker-ce libseccomp
```
5. Enter the command below to start Docker as a service:
```cmd
sudo systemctl start docker
```
6. Verify Docker is running by entering:
```cmd
sudo docker info
```
This will output system-wide information about Docker. The information will resemble the following:
```cmd
alt
```
You can see some useful information, such as the number of containers, and the version of the Docker server. Docker adopts a client-server architecture, so the server doesn't have to be running on the same host as the client. In your case, you are using the Docker command line interface (CLI) client to connect to the server, called the Docker daemon.
apt-key'in deprecate olması
Tags: apt, key, deprecate
Published: 2023-04-01 20:54:20

Muhtemelen Ubuntu ve Debian tabanlı sistemlerinizde, farklı kaynaklardaki depoları eklerken karşınıza aşağıdaki gibi bir hata çıkmaktadır ve her apt update komutunda çıkarak canınızı sıkmaktadır.

> W: http://.../deb/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

Normalde tamamen dikkat (warning) içeren bir hata kaydı olsa da yani sisteminizi etkilemse de bir şekilde can sıkıcı olmaktadır.

Öncelikle bu sorunun kaynağı apt-key ile eklenen anahtarların **/etc/apt/trusted.gpg** dosyası içerisine eklenmesidir. Eskiden tüm apt depo anahtarları bu dosya içerisinde peş peşe eklenmekte idi. Bu dosya yerine artık anahtarlar, **/etc/apt/trusted.gpg.d/** klasörü altında ayrı ayrı tutulması beklenmektedir.

Dolayısıyla çözümü de aşağıdaki komut kadar basit şekilde geçilebilmektedir:

```bash
mv /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/trusted2.gpg
```

Bu komutla birlikte sisteminizdeki bir anahtar yapısını bozmadan artık "apt update" komutu ile yukarıdaki gibi bir hata mesajı almayacaksınız.
The beginning of Project 2
Published: 2023-03-20 01:36:39


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ao5kve9zomz9qgxubq8f.png)
As I begin to imagine how Project 2 in my IST 256 class will unfold, I dissect the image above to figure out the API.  The API element will consist of card-like instances similar to Project 1.  Each item in the list will be its own element within the full list.  For example, the full list will be 'badge list', while each element within it will be named 'badge'.  The properties that will be necessary for the project are an image, badge title, description, author, step 1, and step 2.  The specifics of all these properties will be necessary from the backend in order to make it work.  For reference, it will looks something like the most recent homework assignment I completed, which can be found [here](https://github.com/pjstrauss12/coaster-card-week-7).  Initially, I plan on making a basic badge element, then duplicating it into a list, then finally working with the backend to wire up each item in the list with the correct details.
Complete C Programming Roadmap 2023
Tags: c, cprogramming, croadmap
Published: 2023-04-01 20:07:28

The C programming language is a popular programming language used for a variety of applications, including operating systems, embedded systems, and game development. Here's a roadmap to help you become proficient in C programming:

1. Learn the basics of programming: Before diving into C programming, it's important to learn the fundamentals of programming concepts such as data types, variables, control structures, and functions. This will help you understand C programming better.

2. Learn the syntax and semantics of C: C programming has a specific syntax and semantics that are unique to the language. You'll need to learn these to be able to write C programs.

3. Get familiar with the C standard library: The C standard library provides a set of functions that are part of the C language specification. These functions allow you to perform various operations such as input and output, memory allocation, and string manipulation.
 
4. Practice coding: The best way to learn C programming is by writing code. Practice coding exercises to improve your skills and gain a deeper understanding of C programming.

5. Learn data structures and algorithms: C is often used for developing data structures and algorithms. Therefore, it's important to learn data structures such as arrays, linked lists, trees, and graphs, as well as algorithms such as sorting and searching.

6. Learn system programming: C is widely used for system programming, including developing operating systems, device drivers, and network protocols. Understanding system programming concepts is essential for advanced C programming.
 
7. Practice debugging: Debugging is an important skill for any programmer, and it's especially important when programming in C. Learn how to use debugging tools such as gdb to identify and fix errors in your code.
 
8. Learn about memory management: C allows direct access to memory, which makes it powerful but also potentially dangerous. Learn about memory management techniques such as pointers, memory allocation, and deallocation to avoid common memory-related errors.
 
9. Learn about multithreading: Multithreading allows a program to execute multiple threads simultaneously. Learn how to implement multithreading in C using POSIX threads (pthreads) and synchronization mechanisms such as mutexes and semaphores.

10. Explore C libraries and frameworks: C has a wide range of libraries and frameworks that can simplify programming tasks and speed up development. Examples include OpenGL for graphics programming, SDL for game development, and GTK+ for creating graphical user interfaces.

> By following this roadmap, you can become proficient in C programming and develop complex programs and systems.
Day 1: #100DaysOfCode: The Beginning
Tags: python, 100daysofcode
Published: 2023-04-01 20:04:36

On the first day of my [#100DaysOfCode](https://www.100daysofcode.com/) journey, I dove into [Angela Yu](https://twitter.com/yu_angela)'s exceptional Udemy course, ["100 Days of Code: The Complete Python Pro Bootcamp for 2023."](https://www.udemy.com/course/100-days-of-code/) I tackled the first three sections, which covered topics such as variables, data types, string manipulation, control flow, and logical operators.

As with learning any programming language, Python also involves variables, data types, and the manipulation of values based on the data type held by the variable. To enrich my understanding, I turned to Google for additional details and sample code.

I discovered an interesting Python feature that allows you to indicate a variable's data type during assignment:

`x = 23
x: int = 23
y = 11.5
y: float = 11.5`

These type hints improve code readability however, they're completely optional and don't prevent you from assigning a different value later.

While exploring string formatting, I learned that Python 3.6 introduced f-strings, a more readable and faster formatting method compared to the older .format() and % formatting techniques. Here are a couple of examples demonstrating control over the formatted output:

`stars = 5
msg = "python is awesome."
print(f"{msg.upper()} I give it {stars*2} stars.")

amt = 2_534.123456

print(f'Floating point with 2 decimal: {amt:0.2f}')

I also experimented with common string methods such as count(), removeprefix(), 
index(), split(), replace(), lower(), upper(), startswith(), endswith(), and strip():

txt = " Hello John, welcome to the world Python. "
print(f"txt: {txt}")
print(f'count(): {txt.count("o")}')
print(f'index(): {txt.index("welcome")}')
print(f"split(): {txt.split()}")
print(f'replace(): {txt.replace("John", "Mark")}')
print(f"strip(): No more extra spaces before {txt.strip()} or after")

txt = "Hello John, welcome to the world Python."
print(f"removeprefix(): {txt.removeprefix('Hello')}")`

Lastly, I covered the 'if' statement, which, as expected, controls the flow of an application based on logical conditions. I'm still adapting to Python's indentation requirements for statements and the colons at the end of 'if', 'elif', and 'else'. I also find myself forgetting to omit the semicolon at the end of a line – a habit carried over from the Java and JavaScript world. 
But I'm sure I'll get used to it soon!
Amazon Comprehend
Tags: aws, comprehend, beginners, cloud
Published: 2023-04-01 20:02:14

Sometimes I love to explore interesting AWS services and these days I tried Amazon Comprehend. In the certain situations it can be very useful, maybe for writers of content, authors of books to analyze your small or bigger text to tell us more details. 

Amazon Comprehend is natural language processing (NLP) to extract insights about the content of documents. This mean when you input for example some kind of the sentences, service will analyze all words, find key phrases, entities, language ([supported languages](https://docs.aws.amazon.com/comprehend/latest/dg/supported-languages.html)). 

For example, I put simple sentence for analyzing the text (just in my case my name is identified like organization, but that is because I didn't provide more informations about me).

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

After analyzing my text, results was: 

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

But if I change to another language, portugese, you can see it on image that it recognize the language with 98% of confidence.


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

Insights of language:

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

Using this sentence in portuguese (português), in Insight you will see some interesting things, for example that I didn't write correctly some words and the confident it's little bit less. 

Amazon Comprehend detect dominant things in document. For example dominant language in text is portugese, it will recognize it. 

Amazon Comprehend analyzes the following types of insights:

**Entities** – References to the names of people, places, items, and locations contained in a document.

Key phrases – Phrases that appear in a document. For example, a document about a basketball game might return the names of the teams, the name of the venue, and the final score.

**Personally Identifiable Information (PII)** – Personal data that can identify an individual, such as an address, bank account number, or phone number.

**Language** – The dominant language of a document.

**Sentiment** – The dominant sentiment of a document, which can be positive, neutral, negative, or mixed.

**Targeted sentiment** – The sentiments associated with specific entities in a document. The sentiment for each entity occurrence can be positive, negative, neutral or mixed.

**Syntax** – The parts of speech for each word in the document.

Links to practice Amazon Comprehend: 

[Amazon Comprehend Workshops](https://workshops.aws/categories/Amazon%20Comprehend)

[Amazon Comprehned Immersion Day (workshop)](https://catalog.us-east-1.prod.workshops.aws/workshops/b54ae619-4779-409c-9bde-6e9c00edcf0f/en-US)
From VPC to LAMP: My Journey with AWS Academy Cloud Architecting Capstone Project.
Published: 2023-04-01 19:58:54

AWS Academy Cloud Architecting 2.x - Capstone Project is an excellent way for aspiring cloud architects to gain hands-on experience with AWS cloud services. In this project, I created a MySQL RDS database instance, create a Cloud9 environment, install a LAMP web server on Amazon Linux2, and import, connect the database.

The project consists of four tasks that require different steps to be completed. The first task involves inspecting the pre-existing VPC, subnets, security groups, and AMI. It is essential to collect the Private and Public subnet Info in the open VPC.

![Current Architecture Design](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndy9u86nazlzc4mcmy5p.png)

The second task requires creating a MySql RDS database instance. The first step in this task is to create Subnet Groups, followed by creating the database. To create the Subnet Group, I navigated to the RDS service in AWS and chose the Subnet Groups option. After that, I added the subnet by selecting us-east-1a (private subnet 1) and us-east-1b1b (private subnet 2) with 10.0.2.0/23 and 10.0.4.0/23 Private subnet1 and Private subnet2, respectively. Then, I created a database by choosing the database creation method and other required details such as the Master username, Master password, DB instance class, storage, and connectivity.

![RDS Database Created](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99l79wvam2txga6gioe0.png)

The third task required creating a Cloud9 environment. To do this, I navigated to the Cloud9 service and created an environment by providing a name, configuring the settings, and reviewing the environment. I then selected the Amazon Linux 2 platform and specified the VPC and subnet.

The fourth and final task was to install a LAMP web server on Amazon Linux2 and import the database. In this task, I prepared the LAMP server by updating the packages and installing LAMP. Then, I downloaded the project assets, unzipped the PHP code, and copied the code to /var/www/html/. After that, I imported the database by downloading it and adding an inbound rule to the Example-DB security group. Finally, I connected to the RDS database using the Cloud9 machine and imported the database.


![Cloud9 Syntax](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/etmuwqqnwmaeayulxid4.png)

![Cloud9 Syntax](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2qpplhxtog3b91kbpdkp.png)

In conclusion, the AWS Academy Cloud Architecting 2.x - Capstone Project is a comprehensive project that provides hands-on experience with AWS cloud services. Completing the project requires careful attention to detail, and the steps involved are essential to creating a functional cloud environment. Overall, the project was challenging but rewarding, and I would recommend it to anyone interested in cloud architecture.
Creational Design Patterns.
Published: 2023-04-01 19:51:57

## Introduction

Design patterns are a popular way to solve common software design problems. They provide reusable solutions that can help you write more maintainable and efficient code. Creational design patterns are a subset of design patterns that are used to create objects in a system. In this blog post, we will explore creational design patterns and their applications.

Creational design patterns are used to create objects in a system. They are used to abstract the process of object creation and provide a way to decouple the client code from the object creation process. This allows the client code to remain independent of the specific classes used for object creation, making it easier to maintain and modify the code over time.

There are five main types of creational design patterns:

    1. Singleton Pattern
    2. Factory Pattern
    3. Abstract Factory Pattern
    4. Builder Pattern
    5. Prototype Pattern

Let's take a closer look at each of these patterns and their uses.

### Singleton Pattern

The Singleton pattern ensures that only one instance of a class is created and provides global access to that instance. This pattern is useful when you want to limit the number of instances of a class, such as when you have a resource that should only be accessed by one object.

### Factory Pattern

The Factory pattern is used to create objects without specifying the exact class of object that will be created. The Factory pattern provides a way to encapsulate object creation in a separate class, making it easier to maintain and modify the code over time.

### Abstract Factory Pattern

The Abstract Factory pattern provides an interface for creating related or dependent objects without specifying their concrete classes. The Abstract Factory pattern allows for the creation of families of objects that are designed to work together, such as creating objects that are specific to a particular operating system.

### Builder Pattern

The Builder pattern separates the construction of a complex object from its representation, allowing the same construction process to create different representations. The Builder pattern provides a way to create complex objects step by step, making it easier to modify the construction process without affecting the final object.

### Prototype Pattern
The Prototype pattern allows for the creation of new objects by copying or cloning existing objects. The Prototype pattern is useful when creating new objects is costly or when you want to create variations of an object without modifying the original object.

In conclusion, creational design patterns are a useful tool for creating objects in a system. They provide a way to abstract the process of object creation, making it easier to maintain and modify the code over time. By understanding the different types of creational design patterns, you can choose the appropriate pattern for your specific use case and improve the overall design of your system.
Skills to become Wordpress developer
Tags: wordpress, developer, beginners
Published: 2023-04-01 19:43:14

Hi people I’m not quite sure where this belongs so thought I’d try here, My names Ben.

im wanting to start creating my own wordpress themes and plugin etc and in the future to become a full wordpress developer as a career.

My question is what are the skills/programming languages that I’d need to start making themes?

my current skills:

-HTML , CSS, Basic JavaScript, Bootstrap

Any help and guidance would be greatly appreciated. Thanks people