teleren/devto huggingface dataset:
Add TLS/SSL to Your VPS With Let's Encrypt or Caddy Server (Portainer Edition)
Tags: rawkode, portainer, tls, ssl
Published: 2023-02-19 11:00:57


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

[youtube for this post](https://www.youtube.com/watch?v=6IwhFQ-ir6E)

This is supplemental material for Rawkode's Portainer series, which shows the steps for initializing your environment with the VPS and DNS.

[rawkode playlist](https://www.youtube.com/watch?v=VrtBN5pQMo4&list=PLz0t90fOInA7aRYTguuowv6qrNsMB-zxM)
[github](https://github.com/bronifty/portainer-in-production.git)

### TLS
1) launch ubuntu vm with access to ports 22 80 443 (aws & gcp)
2) map ip address to domain in cloudflare
3) install deps (snap certbot docker)
##### Certbot Method
1) install certbot, symbollically link it to path and run the standalone server
2) run portainer with the volumes mapped to the cert and key
##### Caddy Method
1) update Caddyfile email and hostname
2) remove existing portainer docker container
3) run portainer without the mapping on 8000 and 9443
4) run caddy to reverse proxy from 80 and 443 to portainer on 9443

### Install Portainer on a VPS
#### AWS EC2 
- Free tier eligible - t2.micro 
	- defaults

#### GCP
- Free tier: -     
    1 non-preemptible `e2-micro` VM instance per month in one of the following US regions:
    -   Oregon: `us-west1`
    -   Iowa: `us-central1`
    -   South Carolina: `us-east1`
-   30 GB-months standard persistent disk
Understanding the Role of Flutter in the Digital Age
Tags: flutter, flutterforward, beginners
Published: 2023-02-19 10:47:27

As technology advances, so does the way we create and interact with digital products. Flutter is a revolutionary technology that is making waves in the digital world. By 2023, it is anticipated that Flutter will have a major impact on digital development. 


Flutter is an open-source framework developed by Google. It is used to create modern, native-looking mobile applications across a variety of platforms. It is a popular choice for businesses and developers because of its highly customizable, intuitive, and user-friendly interface. Additionally, it is relatively easy to learn and requires minimal code. 


Using Flutter, developers can create beautiful and engaging mobile applications with minimal effort. The framework utilizes a widget-based approach to app development, which allows for customization of the user experience. This helps developers create unique and effective applications quickly. Furthermore, Flutter allows for the development of efficient, responsive, and interactive user interfaces. 


One of the most useful aspects of Flutter is its cross-platform capabilities. This means that developers can develop applications for multiple platforms, such as Android and iOS, from the same codebase. This saves developers time and minimizes the need for additional resources. Additionally, the ability to use a single codebase across multiple platforms decreases development costs and helps businesses reach a larger audience. 


In the coming years, Flutter is expected to become even more powerful, with the introduction of new features and advancements. By 2023, it is expected that Flutter will become an integral part of digital development and mobile app development. Its ability to create responsive and interactive user interfaces, as well as its cross-platform capabilities, will make it a popular choice for businesses and developers alike. 


Therefore, it is important for new developers to understand the role of Flutter in digital development and mobile app development. Knowing the basics of Flutter and its features will give new developers a head start in the industry and help them create amazing applications.
How to Start a React Native Application Using Expo
Tags: webdev, javascript, programming, beginners
Published: 2023-02-19 10:41:26

To start a React Native application using Expo, you can follow these steps:

- 
Install Node.js and NPM: React Native requires Node.js and NPM to be installed on your computer. You can download and install them from the official Node.js website.

- 
Install Expo CLI: Expo CLI is a command-line interface that you can use to create and manage Expo projects. You can install it using the following command:

<pre>
npm install -g expo-cli
</pre>

- 
Create a new React Native project with Expo: You can create a new React Native project using the expo init command. For example, to create a new project called "MyApp", you can use the following command:

<pre>
expo init MyApp
</pre>

- 
Choose a template: Expo will ask you to choose a template for your project. You can select any template that suits your needs.

- 
Start the development server: Once your project is created, you can start the development server using the following command:

<pre>
cd MyApp
npx expo start
</pre>

- 
Run the app: You can run your app on a device or emulator using the Expo app on your phone or by opening the app in a web browser. To run the app in a web browser, click on the "Run in web browser" option in the Expo development server that you started in the previous step.

- 
Start coding: Your React Native app is now ready to be developed! You can start writing code in the App.js file and create components and screens as needed. You can use a text editor or integrated development environment (IDE) of your choice to write your code.


That's it! You've now started a React Native application using Expo and are ready to start building your app. Expo provides additional features and tools that can help you build and test your app more efficiently.
How does Machine Learning actually work?
Published: 2023-06-12 17:15:07

---
title: How does Machine Learning actually work?
published: true
date: 2023-02-19 10:36:39 UTC
tags: 
canonical_url: 
---

Greetings, fellow humans! Today, we'll delve into the fascinating world of Machine Learning and learn how it works. But don't worry, we won't make it as dry as a calculus lecture. So, let's get started!

### **What is Machine Learning?**

Machine Learning is a type of Artificial Intelligence that allows machines to learn from data without being explicitly programmed. In essence, we're trying to teach machines to learn from experience, similar to how we humans do it.

There are three primary types of Machine Learning: **Supervised Learning** , **Unsupervised Learning** , and **Reinforcement Learning**.

1. 
### Supervised Learning

Supervised Learning is the type of Machine Learning where we train machines on labeled data. The machine learns to map input data to output data by identifying patterns in the data. A classic example of supervised learning is image classification, where the machine is trained to recognize images and label them correctly.

Here's an example of how you can train a machine to classify images of cats and dogs using the popular TensorFlow library:

```
import tensorflow as tf

# Load dataset
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.cifar10.load_data()

# Define model architecture
model = tf.keras.models.Sequential([
  tf.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(32, 32, 3)),
  tf.keras.layers.MaxPooling2D((2,2)),
  tf.keras.layers.Flatten(),
  tf.keras.layers.Dense(64, activation='relu'),
  tf.keras.layers.Dense(10, activation='softmax')
])

# Compile model
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])

# Train model
model.fit(train_images, train_labels, epochs=10)

# Evaluate model
test_loss, test_acc = model.evaluate(test_images, test_labels)
print("Test accuracy: ", test_acc)

```

1. 
### Unsupervised Learning

Unsupervised Learning is where machines learn from unlabeled data. The machine tries to find patterns and structure in the data without any predefined labels. A common application of unsupervised learning is clustering, where the machine groups similar data points together.

### **Reinforcement Learning**

Reinforcement Learning is a type of Machine Learning where machines learn through trial and error. The machine interacts with an environment and receives rewards or punishments based on its actions. The goal is for the machine to learn the optimal set of actions to take to maximize the reward.

An example of Reinforcement Learning is training a machine to play a game, like tic-tac-toe.

![](https://kroki.io/mermaid/svg/eNpLL0osyFDwCeJyjHZJTcvMS1VITE_NK1FIzEtRSE_MTVVIzSvLLMrPywUKxiro6topOGmEFCVm5kHUaXI5gQWdNUJSi0tgetOB8kBeRmluYp5CQU5iZWqRJhcAZp8jRg)

Thanks for reading!
How To Start a React Native Application
Tags: webdev, javascript, beginners, programming
Published: 2023-02-19 10:36:01

To start a React Native application, you can follow these steps:

Install Node.js and NPM: React Native requires Node.js and NPM to be installed on your computer. You can download and install them from the official Node.js website.

Install React Native CLI: React Native CLI is a command-line interface that you can use to create and manage React Native projects. You can install it using the following command:

<pre>npm install -g react-native-cli</pre>
Create a new React Native project: You can create a new React Native project using the react-native init command. For example, to create a new project called "MyApp", you can use the following command:

<pre>react-native init MyApp</pre>
Start the development server: Once your project is created, you can start the development server using the following command:
<pre>
cd MyApp
react-native start
</pre>
Run the app: You can run your app on a device or emulator using the following command:
<pre>
react-native run-android
</pre>

<pre>
react-native run-ios
</pre>
depending on the platform you want to run on.

Start coding: Your React Native app is now ready to be developed! You can start writing code in the App.js file and create components and screens as needed. You can use a text editor or integrated development environment (IDE) of your choice to write your code.

That's it! You've now started a React Native application and are ready to start building your app.
help me code: 'MODULE_NOT_FOUND'
Published: 2023-02-19 10:30:11

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'D:\blueproject\NFT\hashlips_art_engine-1.1.2_patch_v6/node_modules/sha1'
Require stack:
- D:\blueproject\NFT\hashlips_art_engine-1.1.2_patch_v6\src\main.js
- D:\blueproject\NFT\hashlips_art_engine-1.1.2_patch_v6\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\blueproject\NFT\hashlips_art_engine-1.1.2_patch_v6\src\main.js:4:14)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\blueproject\\NFT\\hashlips_art_engine-1.1.2_patch_v6\\src\\main.js',
    'D:\\blueproject\\NFT\\hashlips_art_engine-1.1.2_patch_v6\\index.js'
  ]
}
please ~~
AWS: Create VPC using Terraform CLI
Tags: aws, webdev, tutorial, devops
Published: 2023-02-19 10:25:44

## Amazon Virtual Private Cloud (VPC)
Amazon Web Services (AWS) provides Virtual Private Cloud (VPC) as a service to create a private, isolated network within the AWS Cloud. Using a VPC, you can launch resources such as EC2 instances, RDS databases, and S3 buckets within a virtual network that you control. In this blog, we will walk you through creating an AWS VPC using Terraform on VSCode.

1. It is a private Network
2. It can launch resources like EC2 instances in  VPC
3. VPC can isolate and protect resources
4. It spans across availability zones in a region

## Configure Terraform CLI on VScode

Download the Terraform CLI from VScode extension or download it manually through this [HashiCorp Terraform] (vscode:extension/HashiCorp.terraform). After the installation; create a folder 📂 _Terraform_ where all your terraform files will be accessed and saved on. In your folder, create a file named _Providers.tf_ this is where your Aws resources will be accessed by Aws provider.
The region contains the location where your data center will be.
Profile is the name of your AWS account

![Configure AWS ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x0enpt6wnxylx64ywdi2.png)
After creating the file, run _terraform init_ in your terminal to initialize Terraform configuration. 

![Terraform init](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6t2mr8p5vcop1adtplkk.png)

After this process;  create a new file with the .tf extension, e.g., main.tf. In the file, write the Terraform code to create a VPC 
![Terraform code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cbeq65pkdgfpgkiyqg56.png)
In the code above, we defined the provider aws with the region set to   us-east-1, which is the region where we want to create the VPC. We also created a VPC resource with the cidr_block set to 10.0.0.0/16 and the Name tag set to main_vpc.

Save the file.

Open the terminal in VSCode and run the command terraform apply to create the VPC. Terraform will show you a preview of the changes that will be made, and if you're happy with them, type yes to confirm and apply the changes.

![Terraform Apply](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3y2sh31r4c30bu0ku97s.png)
![VPC confirmed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hqxqiu58s6mm6o5btf1k.png)


Once the command finishes executing, you will have a VPC created on your AWS account.

We started by configuring the Terraform CLI and then created a new Terraform project to create a VPC. We hope that you found this blog helpful and that it serves as a starting point for creating more complex infrastructures on AWS using Terraform.
NOSQL: The Future of Data Management
Tags: nosql, computerscience
Published: 2023-02-19 10:00:00

NOSQL (Not Only SQL) databases have been gaining popularity in recent years as an alternative to traditional relational databases. NOSQL databases are designed to handle large amounts of unstructured data, making them well suited for modern big data and real-time applications. In this article, we'll explore the basics of NOSQL databases and why they are becoming increasingly important for data management.

---

## **What is NOSQL?**

NOSQL is a category of databases that do not rely on the traditional table-based relational model used in SQL databases. Instead, NOSQL databases use a variety of data models, such as key-value, document, columnar, and graph. These data models are more flexible and can handle unstructured and semi-structured data.

## **Types of NOSQL databases**

There are several types of NOSQL databases, each with its own strengths and weaknesses. Some of the most popular NOSQL databases include:

- **MongoDB**: A document-oriented database that stores data in JSON-like documents.
- **Couchbase**: A document-oriented database that supports both SQL and NOSQL querying.
- **Cassandra**: A columnar database that is designed for high scalability and availability.
- **Redis**: A key-value database that is often used for caching and real-time data management.

## **NOSQL in the Real World**

NOSQL databases are becoming increasingly important for a variety of use cases, such as:

- **Big Data**: NOSQL databases are well suited for handling large amounts of unstructured data, making them a popular choice for big data applications.
- **Real-time applications**: NOSQL databases are designed for high performance and low latency, making them a good choice for real-time applications such as online gaming or social media.
- **Internet of Things**: NOSQL databases are well suited for handling the large amounts of data generated by IoT devices.

---

NOSQL databases are becoming increasingly important for data management as they are designed to handle large amounts of unstructured data, making them well suited for modern big data and real-time applications. There are several types of NOSQL databases each with its own strengths and weaknesses, such as MongoDB, Couchbase, Cassandra and Redis. In recent years, NOSQL has been gaining popularity as an alternative to traditional relational databases, and its importance will continue to grow in the future. It's a valuable skill to have for anyone working with data and modern applications.
How to easily migrate Homebrew formulas to another MacBook?
Tags: homebrew, bundle, setting, macbook
Published: 2023-02-19 09:42:12

I mainly use the [Homebrew](https://brew.sh/) to manage almost every app or program, even apps on the App Store using [mas](https://github.com/mas-cli/mas). It becomes a bit of a pain when I set up a new MacBook because it takes time for me to look for the list of the apps and programs on my main MacBook and install one them by one on my new MacBook.

I recently figured out a handy way to set up brew formulas in a new device using [homebrew-bundle](https://github.com/Homebrew/homebrew-bundle) and symbolic link bash command.

This post is written based on an assumption that you already have `brew` installed and actively using it on your Mac.

## Step 1. Save your current settings in `.dotfiles/mac/Brewfile`
I use `.dotfiles` folder to save settings (dotfiles, config files, etc.) and it's saved on my private GitHub repository.

The explanation will be based on my setting.

### 1. Create the source folders and `Brewfile`
```bash
mkdir --parents ~/.dotfiles/mac && touch ~/.dotfile/mac/Brewfile
```
### 2. Create a symlink to the `~/Brewfile`
```bash
# the target file will be generated automatically
ln -s ~/.dotfiles/mac/Brewfile ~/Brewfile
```
**Why'd you be bothered to create extra `./Brewfile`?** Because `brew bundle` command that we're going to use a lot uses `~/Brewfile` by default.

You can specify the path to the `Brewfile` inside the `.dotfiles/mac` folder, or the path of whatever source folder you use for your setting at the end of the command with `--file` flag:
```bash
# in my case
brew bundle install --file=~/.dotfiles/mac/Brewfile
```
However, I just prefer to keep things simple regarding the commands and not touch my source file if I can.

### 3. Whenever you remove/install new formulas on your main Mac, dump your new bundle settings to the `~/Brewfile`; it will update `~/.dotfiles/mac/Brewfile` automatically.
```bash
# need to force because the file already exists
brew bundle dump --force
```
FYI: any changes you make on any of the two linked files will be applied to one another, but deleting the target file(linked file) won't remove the source file.

## Step 2. (on your new MacBook) copy the `.dotfiles` folder and create a symlink to `~/Brewfile`
As I mentioned earlier, you can specify the path to the source `Brewfile` and not create a symlink.

### 1. paste `.dotfiles` folder to a new mac (~/.dotfiles)
### 2. install brew
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
### 3. create a symlink to `~/Brewfile` from the `Brewfile` inside `.dotfiles` folder
```bash
ln -s ~/.dotfiles/mac/Brewfile ~/Brewfile
```
### 4. install bundles from `~/Brewfile`
```bash
brew bundle install
```
All good and ready!

## References
- [Homebrew](https://brew.sh/)
- [mas-cli/mas](https://github.com/mas-cli/mas)
- [homebrew-bundle](https://github.com/Homebrew/homebrew-bundle)
- [ChristopherA/brew-bundle-brewfile-tips.md](https://gist.github.com/ChristopherA/a579274536aab36ea9966f301ff14f3f#best-pracices-using-with-dotfiles)
Node Express User Micro service
Published: 2023-02-19 09:31:46

**Step 1: Prepare the Project Structure**
First, create a new directory for the project and navigate into it:

```
mkdir users-module
cd users-module

```
Inside the users-module directory, create a new file called package.json and add the following content:

```
{
  "name": "users-module",
  "version": "1.0.0",
  "description": "A module for managing users",
  "main": "app.js",
  "dependencies": {
    "express": "^4.17.1"
  }
}

```

This file contains information about the project, its dependencies, and its entry point (app.js). We've included the express dependency, which we'll use to create the API for our users module.

Next, run npm install to install the dependencies:

```
npm install

```

**Step 2: Create the API**

In this step, we'll create the API for our users module using Express. Create a new file called app.js and add the following content:

```
const express = require('express')
const app = express()

app.get('/', (req, res) => {
  res.send('Hello, world!')
})

app.listen(3000, () => {
  console.log('Server listening on port 3000')
})

```

This code creates an Express app and defines a single route that responds with "Hello, world!" when the root URL is requested. We've also included a listener that starts the server and logs a message when it's running.

To test the API, run node app.js and open http://localhost:3000 in your browser. You should see the "Hello, world!" message.

**Step 3: Containerize the App with Docker**
In this step, we'll create a Dockerfile that will define how to build our Docker image. Create a new file called Dockerfile in the project root directory and add the following content:


```
FROM node:16-alpine

WORKDIR /app

COPY package.json .
RUN npm install

COPY . .

EXPOSE 3000

CMD ["node", "app.js"]

```

This Dockerfile starts with the official Node.js 16 Alpine image as its base. It sets the working directory to /app, copies the package.json file and runs npm install to install the dependencies. It then copies the rest of the project files and exposes port 3000. Finally, it sets the command to run the app.js file with Node.

**Step 4: Build and Run the Docker Image**
In this step, we'll use the Dockerfile to build our Docker image and run a container from it.

First, build the image with the following command:

```
docker build -t users-module .

```

This command tells Docker to build an image with the tag users-module using the Dockerfile in the current directory.

Once the build is complete, you can run a container from the image using the following command:

```
docker run -p 3000:3000 users-module

```

This command tells Docker to run a container from the users-module image and map port 3000 in the container to port 3000 on the host.

To test the container, open http://localhost:3000 in your browser. You should see the "Hello, world!" message.

**Conclusion**
In this article, we created a "users" module using Node.js and Express, and containerized it using Docker. This is a