teleren/devto huggingface dataset:
Bellman ford algorithm
Published: 2023-06-20 09:33:20

Bellman ford algorithm mainly used to find the shortest path in graph but today i will try to implement with real world example some of other algorithm like**Dijkstra Algorithm** which is also use to find the shortest path but some limitation are there in Dijkstra Algorithm like it fails when there is **directed graph** , **edges is negative** to make sure Bellman ford algorithm works completely fine 

Let us take a daily life example suppose you went to hill station and you chose a elevation feature in your map now from going up to down it will show negative value so here dijkstra fails to find the shortest path

Let us take an example for this 

I have taken an directed 6 location A,B,C,D,E,F and there weight(distance) is negative  as well as positive so to find the minimum distance bellman ford algorithm

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

Now from above picture we are clear with the edges and the path of destination and source as well as weight(distance) 

For calculating the  shortest path there is formula for it
but first we have to create a distance vector and mark source A as 0 and other as ∞(infinity) because we don't know the exact distance(weight) 


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

Now after taking distance array we need to write formula for it and iterate upto **N-1** N(represent edges) times that is difference between the bellman ford and dijkstra algorithm formula for both the algorithm  is same but that N-1 iteration makes a difference between both
formula for  Bellman ford algorithm is

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

to use this formula first make a table of source destination and distance between two

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

after forming these two table do the first iteration and change the distance array from  infinity to the value you will see that after first iteration B-5 ,C-3,D-6,E-3,F-2
then after second iteration distance are changed

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

after N-1 iteration the answer for the distance array will be
**A-0,B-5,C-3,D-1,E-3,F-2**
Bulk insert data to ES
Tags: elasticsearch, automation, elasticdump
Published: 2023-06-20 09:21:29

> Elastic Search Version 6.2 is used for this example

### Elasticdump

### take index mappings dump to json
```
/usr/bin/elasticdump \
  --type=mapping \
  --input=http://localhost:9200/index_mame \
  --output "/file/to/write/index_name.mapping.json"
```
### take index data dump to json
```
/usr/bin/elasticdump \
  --type=data \
  --concurrency=100 \
  --intervalCap=500 \
  --input=http://localhost:9200/index_mame \
  --output "/file/to/write/index_name.data.json"
```

#### create index with mappings
```
/usr/bin/elasticdump \
 --type=mapping \
  --input "/path/to/maping-file.mapping.json"  \
  --output=http://localhost:9200/index_name
```
#### restore data from other index

```
/usr/bin/elasticdump \
  --type=data \
  --concurrency=100 \
  --intervalCap=500 \
  --input "/file/to/data-dump.data.json"  \
  --output=http://localhost:9200/index_name
```

### _source only backup

```
/usr/bin/elasticdump \
  --type=data \
  --concurrency=100 \
  --intervalCap=500 \
  --sourceOnly=true \
  --input=http://localhost:9200/index_name \
  --output "/file/to/data-dump.data.json"
```
### _bulk API
```
curl -XPOST localhost:9200/index_name/Document_Type/_bulk -H 'Content-Type: application/json' --data-binary @/path/to/file
```
What's your Lucky CSS Pattern? Check It Now!
Tags: showdev, webdev, css
Published: 2023-06-20 09:17:34

You liked my [CSS Patterns collection](https://dev.to/afif/i-created-100-unique-css-patterns-the-best-collection-31cl) but you are lost and you don't know which one to choose. Don't worry, I have the solution for you! 

One-click and you have the best CSS Pattern that matches your preference.

---

## <center> 👉 [Get Your CSS Pattern](https://random.css-pattern.com/) 👈</center>

---

I have developed an advanced AI (better than ChatGPT) that will read your mind, scan your actual mood, find out the web projects you are working on, ~~check your bank account~~, then it will select **THE CSS Pattern** you want with the perfect colors.

### What are you waiting for? Get [your CSS Pattern](https://random.css-pattern.com/) now! 

----

Yes, you already guess it. I will simply generate a random pattern from [my collection](https://css-pattern.com/) but I need to make the article a bit lengthy and it's trending to talk about AI 🤪

In addition to the pattern, you can easily adjust the colors, the size and get the code with one click.

You can reload the page to generate a new one BUT the first pattern you get is your "Lucky CSS Pattern". Share yours in the comments section 👇. A CSS Pattern can tell a lot about its owner! 


---

{% post https://dev.to/afif/i-created-100-unique-css-patterns-the-best-collection-31cl %}

{% post https://dev.to/afif/i-made-100-css-loaders-for-your-next-project-4eje %}

{% post https://dev.to/afif/100-underline-overlay-animation-the-ultimate-css-collection-4p40 %}
DITO Postpaid Prepaid Which 5G WIFi Plan Is Better
Tags: postpaid, prepaid, 5g, dito
Published: 2023-06-20 09:03:25

Many people nowadays consider High-speed internet a necessisty, and the dilemma for them is whether to choose a postpaid or prepaid plan for their home WiFi connection.

Check out this quick and easy guide from [**DITO Telecommunity**](https://dito.ph/home5gpostpaid) to learn which one is better for you.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/012iev9ymyrzlfirj3qj.jpg)
Understanding the Role of an SEO Consultant: Is Hiring One Right for You?
Tags: seo, hire, devops, role
Published: 2023-06-20 09:03:15


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nicqpii6bsmtvvq4aesk.jpg)
An SEO consultant boosts website rankings, making it easier for clients to find you and enhancing competitiveness in your niche. SEO, short for search engine optimization, involves optimizing websites for better user experience and trust among consumers. By improving navigation and user-friendliness, search engines like Google prioritize these sites in search results. This results in increased visibility, attracting more potential customers and ultimately boosting revenue.

**5 Signs It's Time to Hire an SEO Consultant:**

1. Clear Business Objectives: If you have defined business goals and want to outsource services that align with those objectives, [hiring an SEO consultant](https://selfmademillennials.com/hire-seo-consultant/) can be a smart move.

2. Business Scaling: When your business is experiencing growth, expanding your products/services or targeting new markets, an SEO consultant can help optimize your website for increased traffic and audience reach.

3. Website Revamp: If you're planning a website overhaul, bringing in an SEO consultant can ensure your improvements focus on SEO strategies that drive higher traffic and visibility.

4. New Content Strategy: Implementing a fresh content strategy? An SEO consultant can guide you in creating relevant and authoritative content that satisfies user intent, improving your website's search rankings.

5. Working Knowledge of SEO: If you already possess a basic understanding of SEO, hiring a consultant allows you to leverage their specialized skills and expertise to address your business's specific SEO needs effectively.
CDCians reunion after a decade
Tags: leadership
Published: 2023-06-20 09:02:41

𝐀𝐥𝐥ow 𝐲𝐨𝐮𝐫𝐬𝐞𝐥𝐟 𝐭𝐨 𝐛𝐞 𝐲𝐨𝐮𝐫𝐬𝐞𝐥𝐟 and b𝐞 𝐭𝐡𝐞 𝐩𝐞𝐫𝐬𝐨𝐧 𝐲𝐨𝐮 𝐰𝐚𝐧𝐭 𝐭𝐨 𝐰𝐨𝐫𝐤 𝐰𝐢𝐭𝐡!!
If you have seen this reflecting in me and that's because of the great leaders and colleagues who have been part of my professional journey.

I always say that each one has a story with me and loads of memories to cherish.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8s4cxfhtzye7ez6j5r8d.jpeg)

If you wanted to understand the experience through a writer friend.. [here it is from Anu A](https://medium.com/blueinsight/have-you-ever-danced-in-the-rain-1f792e66674a?sk=7a114e42f7dbf66bf7063f066260e9fa)
Kubernetes components and their usage
Tags: kubernetes, containers, kubectl
Published: 2023-06-19 05:58:54

## **Basic Kubernetes components and their use utility.** 

---

*K8s Components*
---

**k8s-control-plane:** 
* Responsible for managing the cluster.
* Can be on a single machine or can span across multiple servers (Usually across dedicated controller machines).

---
## Kubernetes Node (Control Plane Node)

Control plane node is the backbone of the entire kubernetes cluster.

*Following are the 5 main control plane components:-*


**kube-api-server:**
* Serves the K8s API
* Primary interface to interact with k8s cluster and is a central component.

**etcd:**
* HA backend data store for the k8s cluster.
* data stored is related to the state of the cluster.

**kube-scheduler**
* handles scheduling: selecting the node to run containers.

**kube-controller-manager**
* Single process
* Runs collection of controller utilities.
    * **controllers:** execute various automation related tasks inside the cluster.

**cloud-controller-manager**
* provides interfaces between the cluster and cloud providers.
* useful only when you need to interact with cloud providers from the cluster.


These components can be on same server or can be spread across multiple servers.

In case of HA requirement these components can have more than single instance running simultaneously across multiple servers.

---

## Kubernetes Node (Worker Nodes)

* containers managed by cluster run here.
* can have any no of nodes.
* has node components on the server that communicate with the control plane via *kube-api-server*

### **Node components:-**
* **kubelet**
    * k8s agent
    * ensures that containers are run on its node.
    * communicates with control plane and follows what it commands.
    * communicates with control plane regarding node status and various info of the running containers.

* **container-runtime**
    * container software for actual container process.
    * ex: docker and contianerd

* **kube-proxy**
    * Network proxy
    * runs on each node
    * handles networking between containers and servers in the cluster
Krill Meat In Water
Published: 2023-06-20 08:58:42

**Krill Meat In Water**
_Premium Grade Canned_

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

Krill, the small but mighty crustaceans found in the ocean, are a hidden treasure of the sea. Not only are they a sustainable and nutritious alternative to traditional seafood, but they are also packed with essential nutrients that can benefit your overall health. Our process of canning krill meat is a delicate one, where we boil it fresh on the vessel in water with salt added, ensuring that the krill meat retains its nutritional value and delicious taste. But what truly sets krill meat apart from other seafood options is its high content of omega-3 fatty acids, which are essential for brain, heart, and overall health. Krill meat is low in contaminants and pollutants, making it a healthier option than many other types of seafood.


**Introducing our premium quality Canned Krill Meat, the perfect addition to your diet for optimal health and taste.
Our krill is sourced from the pristine Antarctic waters, ensuring the highest quality and freshness. The krill is caught and processed immediately to retain all its nutritional values, making it a healthy and delicious addition to your diet.**

**https://krillusa.com/products/krill-meat-in-water **
_Krill Meat In Water - $9.95_
OpenStack ve CloudStack’e Genel Bakış ve Diğer Alternatifler
Tags: openstack, cloud, cloudstack, deployment
Published: 2024-04-14 12:04:09

---
title: OpenStack ve CloudStack’e Genel Bakış ve Diğer Alternatifler
published: true
date: 2023-06-20 08:57:26 UTC
tags: openstack,cloud,cloudstack,deployment
canonical_url: https://sevilayerkan.medium.com/openstack-ve-cloudstacke-genel-bak%C4%B1%C5%9F-ve-di%C4%9Fer-alternatifler-5db4381cb749
---

Önceki [yazıda](https://medium.com/@sevilayerkan2/apache-cloudstack-e794010cb28b) bahsettiğim çalışma için kullanabileceğim başka hangi teknolojiler var buna bakıp karşılaştırmaya çalıştım. Diğer alternatiflerden birkaçı şu şekilde:

- vSphere
- Nebula
- Redhat Openshift
- Eucalyptus

### **Openstack vs Cloudstack**

Genel bir karşılaştırma yapacak olursak;

- İkisi de **open source** , iyi **dokümante** edilmiş teknolojiler
- Cloudstack, Openstack’e göre daha kolay **deploy** edilebilir.
- Openstack **modüler** yapısından dolayı daha iyi özelleştirilebilir. Daha esnek bir yapısı var.
- **Otomasyon** açısından Cloudstack daha avantajlı

**Teknik Özelliklerinin Karşılaştırması**

İki teknolojinin de incelediğim teknik özelliklerinin bir tablo üzerinde karşılaştırmasını yapalım:

{% gist https://gist.github.com/sevilayerkan/816b8276ff04674e2124b5ede7d41800 %}

Makalemi okuyup vakip ayırdığınız için çok teşekkür ederim. :)

Eğer bir hatam olduysa, düzeltmemi istediğiniz bir yer olursa veya iletişime geçmek isterseniz [Twitter](https://www.twitter.com/sevilayerkan0) ve [Linkedin](https://www.linkedin.com/in/sevilayerkan/) adreslerinden bana ulaşabilirsiniz. [Twitch’teki](https://www.twitch.com/notdepressedeveloper) yazılımla ilgili yayınlarım için [kanalıma](https://www.twitch.tv/notdepressedeveloper) gelebilirsiniz. İleride yayınlayacağım yazılarda görüşmek üzere… _❤_
How to restrict a user to use single region in AWS
Tags: aws, security
Published: 2023-06-20 08:51:35

IAM policy to restrict user to a single region

```
{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "Statement1",
			"Effect": "Allow",
			"Action": [
				"*"
			],
			"Resource": [
				"*"
			],
			"Condition": {
				"StringEquals": {
					"aws:RequestedRegion": [
						"us-west-1"
					]
				}
			}
		}
	]
}
```
My current prefered way of building web apps
Published: 2023-06-20 08:45:31

---
title: My current prefered way of building web apps 
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-06-20 06:53 +0000
---


My default "factory settings" for creating apps are Python/FastAPI/Jinja2 with a sprinkle of AlpineJS for interactivity (toggles etc). 

If the app is way too interactive I prefer to use Svelte+Typescript on the frontend. As a CSS framework by default I go with BulmaCSS.

I prefer MongoDB as a database because it speaks the language of the web (JSON) and I hate migrations.  
 
If the web app needs to be extremely performant or it needs to be a cross-platform CLI I will switch to GO/Fiber with Sqlite, Postgres, MongoDB depending on the case. 

VSCode, Docker and Docker Compose are indispensabile from my web application development process.

When it comes to deploying the web app I usually start with a simple VPS and use Caddy2 as a load balancer/reverse-proxy (super easy to configure). With this setup if data is important I would make sure backups are in place. I would throw more resources at the VPS if needed even go with a bare metal option.

![1VPS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5zf0th5jir76rs2q963.png)

Here is an estimate on what resources you can get for ~900$ per month for a bare metal server:

![bare-metal-server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s56kdp946mgeivbcfuap.png)

I selected a Compute server with 48 cores that's enormous! There are options with more RAM or GPU depending on the type of requests the web app handles. For example, if you have a video editing app choose a server with a lot of GPU, if you have an app that processes a lot of data take one with more CPU and RAM and so on.

### **This will work for 90% of cases 100% of the time.**

If the app becomes an unicorn and the bare metal is not enough anymore then I will delegate that complexity to as many managed services as possible. There is EC2 with auto-scalling feature you can limit the number of instances it creates so you don't go homeless. You have managed databases like MongoDB Atlas, PlanetScale etc. external storage options like AWS S3, external authentification from AWS Cognito or Firebase Auth, managed kubernetes services and so on.

IMO the app should work the same on a laptop with you as a single user the same as it work online with milions of users. 


Just posting this here to see if my stack/habits/view changes in a few years.
How to enforce MFA in AWS - Part I - Create User, Role & Policy
Tags: aws, security, tutorial, bash
Published: 2023-06-20 08:34:13

In this tutorial I will demonstrate How to enfornce 2FA in both AWS CLI and AWS Console. Later in the tutorial I will share a script to quickly authenticate with MFA and use generated token.

1\. At first we will create a user who has only access to `sts:AssumeRole` with MFA condition. We can create the user manually or with the following terraform script.

```
resource "aws_iam_user" "mfa_user" {
  # path = "/user_path_if_necessary/"
  name = "aws_cli_user"
}

data "aws_iam_policy_document" "sts_assume_role_policy_docuement" {
  statement {
    actions   = ["sts:AssumeRole"]
    resources = ["*"]
    effect    = "Allow"
    condition {
      test     = "Bool"
      values   = ["true"]
      variable = "aws:MultiFactorAuthPresent"
    }
  }
}

resource "aws_iam_policy" "sts_assume_role_policy" {
  name   = "sts_assume_role_policy"
  policy = data.aws_iam_policy_document.sts_assume_role_policy_docuement.json
}

resource "aws_iam_policy_attachment" "sts_assume_role_policy_attachment" {
  name       = "sts_assume_role_policy_attachment"
  policy_arn = aws_iam_policy.sts_assume_role_policy.arn
  users      = [aws_iam_user.mfa_user.name]
}

resource "aws_iam_access_key" "mfa_user_keys" {
  user = aws_iam_user.mfa_user.name
}

resource "aws_iam_user_login_profile" "mfa_user_console_login_profile" {
  user = aws_iam_user.mfa_user.name
}
```

2\. You can get the credentials with the following `output.tf` output file

```
output "mfa_user_access_key" {
  value = aws_iam_access_key.mfa_user_keys.id
}

output "mfa_user_secret_key" {
  value     = aws_iam_access_key.mfa_user_keys.secret
  sensitive = true
}

output "mfa_user_console_password" {
  value = aws_iam_user_login_profile.mfa_user_console_login_profile.password
  sensitive = true
}
```

3\. Now Create a Virtual device for `mfa_user` from AWS Console.


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


4\. We will now create the role that will be assumed by the user. For the purpose of the tutorial I've attached an AWS managed Administrator policy with the role.

```
resource "aws_iam_role" "iam_admin_role_with_mfa_restriction" {
  name               = "admin_mfa"
  assume_role_policy = jsonencode({
    "Version" : "2012-10-17",
    "Statement" : [
      {
        "Effect" : "Allow",
        "Principal" : {
          "AWS" : "arn:aws:iam::${var.aws_account_id}:root"
        },
        "Action" : "sts:AssumeRole",
        "Condition" : {
          "Bool" : {
            "aws:MultiFactorAuthPresent" : "true"
          }
        }
      }
    ]
  })
  managed_policy_arns = ["arn:aws:iam::aws:policy/AdministratorAccess"]
}
```

Now the user is ready, you can have a look at the full terraform code [here](https://gitlab.com/rt07/examples/terraform/terraform-examples/-/tree/master/iam_mfa_user)

Lets jump into [Part II of the tutorial](https://dev.to/rafaftahsin/how-to-enforce-mfa-in-aws-cli-part-ii-using-aws-cli-and-terraform-with-mfa-e74) where we will discuss about how to access aws using MFA.
How to enforce MFA in AWS - Part II - Using `aws` CLI and terraform with MFA
Tags: aws, security, tutorial, bash
Published: 2023-06-20 08:32:44

Part I => [How to enforce MFA in AWS CLI - Part I]()

Here in Part II we will discuss how to access aws using MFA


# `aws` cli


1\. Use `aws configure --profile mfa_user` to configure mfa user in aws cli. Get the user credentials from terraform outputs. Sensitive outputs can be retrieved with `terraform output <sensitive_output_data>`. After configuration your `~/.aws/credentials` should contains this 

```
[mfa_user]
aws_access_key_id = ABCD$$$$$$$$
aws_secret_access_key = knklvdf093487jps/df\$$$$$$$$$$$$$$$$$$$$$$
```

2\. Lets create role profile

To create a role profile add `admin_role` profile section in `~/.aws/config`.

```
[profile admin_role]
role_arn = arn:aws:iam::<account_number>:role/admin_mfa
source_profile = mfa_user
mfa_serial = arn:aws:iam::<account_number>:mfa/mfa	
```

You can get `role_arn` from terraform output. Get MFA Serial from AWS Console.

3\. Now you can use aws cli with `admin_role` profile

```
aws s3 ls --profile admin_role
```


# terraform

If you enable MFA, configuring terraform gets a bit hacky. You can use [following script](https://gitlab.com/rt07/examples/terraform/terraform-examples/-/blob/master/iam_mfa_user/auth.sh) to automate this process.

```bash
#!/usr/bin/env bash

echo "totp is $1"

ROLE_ARN="arn:aws:iam::<account_number>:role/admin_role"
MFA_ARN="arn:aws:iam::<account_number>:mfa/mfa"

aws sts assume-role \
    --role-arn $ROLE_ARN \
    --role-session-name session-one \
    --serial-number $MFA_ARN \
    --token-code $1 > /tmp/sts.json

aws configure set aws_access_key_id $(cat /tmp/sts.json | jq -r '.Credentials.AccessKeyId') --profile terraform
aws configure set aws_secret_access_key $(cat /tmp/sts.json | jq -r '.Credentials.SecretAccessKey') --profile terraform
aws configure set aws_session_token $(cat /tmp/sts.json | jq -r '.Credentials.SessionToken') --profile terraform
aws configure set region "ap-southeast-1" --profile terraform

rm /tmp/sts.json
```

you can use this script with `./auth.sh <6 Digit MFA Code>`. This will configure aws profile named `terraform`. You can configure terraform aws provider with with this profile.

```
provider "aws" {
  profile = "terraform"
}
```


# AWS Console

Use Switch role button to switch to admin role after signing in to AWS Console.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jesn579kwbtgzahkgt3j.png)
Exam Topics Free: You’re Key to Success in Certification
Tags: webdev, javascript, beginners, programming
Published: 2023-06-20 08:20:31

# Using Online Courses and Video Lectures
 Massive Open Online Courses( MOOCs) have recently gained fashion ability, and numerous estimable platforms offer free courses on colorful test motifs. These <a href="https://examtopicsfree.com/">Exam Topics Free</a> courses are frequently developed by leading universities and professors, icing high- quality content and educational design. Also, videotape lectures on platforms like YouTube give precious perceptivity and explanations, enabling you to grasp complex generalities at your own pace, free of charge.
# Engaging with Online Study Communities
 When studying test motifs, connecting with peers on the same literacy trip can be <a href="https://examtopicsfree.com/">Exam Topics</a> immensely helpful. Online study communities and forums devoted to specific subjects allow one to ask questions, share coffers, and engage in conversations. These communities foster collaboration, allowing you to profit from the knowledge and gests of others, all for free.

Unlock Your Potential with Our Exclusive Offer! >>>> https://examtopicsfree.com/