teleren/devto huggingface dataset:
AWS multi-region VPC peering using Terraform
Tags: aws, vpc, terraform, cloud
Published: 2022-11-12 14:23:06


> AWS multi-region VPC peering using Terraform
> How to securely connect two VPCs from different regions.

VPC peering is a networking connection between between two VPCs that enables traffic routing between the two using private IPv4 and/or IPv6 addresses.
AWS blog : What is VPC peering?A way to privately connect the two VPCs without exposing them to the internet and the resources in either VPC can communicate with each other as if they are within the same network.
Check this very detailed article from Ashish Patel for more information.

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

> NB : The two VPCs should not have matching or overlapping CIDR blocks.


## Steps
1/ Create a peering connection using a aws_vpc_peering_connection in one of the VPCs (this VPC will be the 'requester' of the peering connection, and the one that requests access to the other VPC's resources).

```
resource "aws_vpc_peering_connection" "this" {
  vpc_id      = var.requester_vpc_id
  peer_vpc_id = var.accpeter_vpc_id
  peer_region = var.accepter_region
}
```

2/ Create and accept the peering connection in the other VPC using a aws_vpc_peering_connection_accepter . (When using cross-account or cross-region the other vpc will be the 'accepter' side and will need to create and accept the incoming request of peering to allow access to it's resources).

```
resource "aws_vpc_peering_connection_accepter" "this" {
  provider                  = aws.accepter
  vpc_peering_connection_id = aws_vpc_peering_connection.this.id
  auto_accept               = true
}
```

3/ Create the necessary aws_routes in the routes tables of both VPCs so they can handle and know where to redirect traffic and where each resource is. And that's why is the peering requires having different and non-overlapping CIDRs.

A complete example with the all the necessary resources is available [here](https://gist.github.com/Z4ck404/b08f72fb7bdcbc47d7beaa1a70ffd229#file-main-tf) 

{% embed https://gist.github.com/Z4ck404/b08f72fb7bdcbc47d7beaa1a70ffd229 %}




And that's it 👋
10 string methods you must know as a js beginner
Tags: string, beginners, javascript
Published: 2022-11-11 15:35:50

[Naming conventions] (https://en.wikipedia.org/wiki/Naming_convention_(programming)#Multiple-word_identifiers) are most commonly used. Good to remember these terms.

1.UPPERCASE
```
"hello world".toUpperCase()
```
2.lowercase
```
"hello world".toLowerCase()
```
3.camelCase
``` 
"hello world"
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) => {
 if(index === 0) return word.toLowerCase()
 return word.toUpperCase();
})
.replace(/\s+/g, "");
```
4.PascalCase

``` 
"hello world"
 .replace(/(?:^\w|[A-Z]|\b\w)/g, (word) => {
  return word.toUpperCase();
 })
.replace(/\s+/g, "");
```
Few more that are commonly used with forms.

5.is a valid url
```
/^(ftp|http|https):\/\/[^ "]+$/.test("https://leetcode.com/");
```
6.get list of query strings from url
```
const url = "https://www.google.com/doodles/maurice-sendaks-85th-birthday?hl=en-GB"
const params = (url.split('?')?.[1]?.split('&') || [])
 .reduce((prev, current) => {
  const keyVal = current.split('=');
  const key = keyVal[0];
  const val = keyVal[1];
  prev[key] = val;
  return prev;
 }, {});
```

7.remove special string from a text
```
"hello@world".replace(/[^\w\s]/gi, '')
```
8.get ascii value of a character
```
'a'.charCodeAt(0)
```
9.convert json to string
```
const obj = {
 key:'value'
}
JSON.stringify(obj)
```
10.convert object string to json
```
JSON.parse('{"key":"value"}')
```

You can get all these and many more commonly used functions in a single [npm package](https://www.npmjs.com/package/js-string-helper) but as a beginner it's good to know how these are done.

I will be posting bi-weekly for javascript developers. Feel free to request for topics that you would like to learn or recommend in the comment section.
Latest Result Sarkari naukri Online in India
Published: 2022-11-12 13:47:51

Sarkari naukri Result 2022 - सरकारी रिजल्ट : Sarkari Results Info provide the latest SarkariResult or free job alert of government Job, Sarkari Exam, Admit Card, Online Form, Admission, Syllabus and all other details related to the government sector.

Get More Info Visit us:-
[Result Sarkari Naukri](https://resultsarkarinaukri.com/)
[Result Sarkari Naukri](https://resultsarkarinaukri.com/)
Amazon S3 - Pricing
Tags: s3pricing, s3cost, s3costestimation, s3pricecalculation
Published: 2022-11-12 13:19:17

### Storage:
Pay for storing the data based on Object size, How long stored during a month, storage classes, monitoring & automation fee per object for S3 Intelligent-Tiering, per-request ingest fees while PUT, COPY or lifecycle rules moving to any S3 storage class.

### Requests and data retrieval
Pay for API calls such as GET, LIST and browsing Amazon console.

### Data transfer
Charged for bandwidth into and out of S3.
Except:
Data transferred in from internet.
Data transferred between S3 buckets in same region.
Data transferred out from S3 bucket to any AWS Services in same region.
Data transferred out to CloudFront.

### Management
Pay for Inventory, Analytics, S3 Lens, S3 Batch Operations, S3 Select and Object tagging.
Pay for Replication and Object Lambda.

Image by <a href="https://pixabay.com/users/jaho-1265252/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4354598">Ja!</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4354598">Pixabay</a>
Viral Instagram Reels in 2022
Tags: saas, webdev, beginners
Published: 2022-11-12 13:14:48

Instagram Reels is all about making and watching short films, especially those between 15 and 30 seconds long. You may fast develop your account by employing them, but your material must be unique and entertaining. Instagram is also rumoured to have changed its algorithm to provide more visibility to accounts who use Reels, so there's another incentive to give this feature a shot.

Here are more tips: [Viral Instagram Reels](https://saasclubx.com/blog/viral-instagram-reels/)
Full StackE-commerce (myntra clone) series using Flutter, NodeJs, MongoDb and ExpressJs
Tags: flutter, node, mongodb, expressj
Published: 2022-11-12 12:48:57

Hi everyone,

Here is a glimpse of recent progress of shopping app inspired by #myntra series.

1. Created product details card
2. Created post apis using #nodejs/ #expressjs for uploading the csv/excel data of products details and storing it to #mongodb
3. Created a get api for fetching all the products ( filter based on category will be introducing soon)
4. Integrated api with #getx in flutter and plotting card dynamically


🤩  Playlist Link: https://www.youtube.com/playlist?list=PLtIU0BH0pkKoMHtGr0lEpq8j507cGIKf2
🤩  GitHub Repo (Do give star): https://github.com/DevStack06/Shopping-App-UI

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/982yi536oxlva0axt45e.png)
Day36 of #100DaysOfCode
Tags: 100daysofcode, webdev, tailwindcss, javascript
Published: 2022-11-12 12:42:07

Woo! I’m back! 🥳

At the end of Oct, a lot of traveling, work, and sickness got the best of me.

I had a flu that I couldn’t shake off for two weeks 🤢.  And right after my Laos trip, a bunch of work came up (not that it’s bad, we will be launching a few new products and services all in the crypto mining space)

But finally I got the chance to come back to code for Hashing.energy!

I finished the ui for the company details page (watched a few videos about flexbox for Tailwind too ao going forward wireframing would be so much faster!!)

I will have to make a few changes to the company list UI because after I came back I’m not satisfied with the current design.  Once that’s done, I can start working on the backend 🥳🥳🥳
Single-Responsibility Principle (SRP)
Tags: agile, csharp
Published: 2022-11-12 12:32:02

If a class has too many responsibilities (High Cohesion), all classes that depend on this class have to be modified when we want to add a new feature to the class, which increases the difficulty of maintenance.

Here is an example, first define the data structure of an order, which can be output by a photocopier.

```csharp
public class Order
{
    private string id;
    private double price;

    public void Print()
    {
        ...
    }
}
```

Analyze class `Order`, it should only focus on processing the information of an order, `Print()` seems to be beyond its responsibility. Suppose there is a new requirement: export as PDF, then `Order` will be modified as:

```csharp
public class Order
{
    private string id;
    private double price;

    public void Print()
    {
        ...
    }

    public void PrintByPdfExporter()
    {
        ...
    }
}
```

At this point, all code that call to `Print()` must then be rewritten to be compatible with `PrintByPdfExporter()`. That's not a good practice when we calls `Print()` a lot in our code.

Now we apply the SRP principle to `Order`. Define an interface called `IPrinter`, then let `PdfExporter` and `Printer` implement `IPrinter`:

```csharp
public interface IPrinter
{
    void Print(string id, double price);
}

public class PdfExporter : IPrinter
{
    public void Print(string id, double price)
    {
        ...
    }
}

public class Printer : IPrinter
{
    public void Print(string id, double price)
    {
        ...
    }
}

public class Order
{
    private string id;
    private double price;
    private IPrinter printer;

    public Order()
    {
        this.printer = new PdfExporter();
        // this.printer = new Printer();
    }

    public Print()
    {
        this.printer.Print(this.Id, this.Price);
    }
}
```

This way, all changes related to printing orders are confined to individual IPrinter implementations. We only need to modify the contructor of `Order` or use dependency injection to decide what printer we what to use.
How to get a free Domain for website ?
Published: 2022-11-12 12:13:48

If you are looking to make a website or a blog and you don't have enough money to buy a domain here's an amazing method and legit way for getting free Tld(Top level domain)Domain.
Step 1: Open an account on GitHub if  you don't have.
Step 2: Appy for GitHub student developer pack by Just submitting any college document (id card , result,etc).If you don't have then borrow it. https://education.github.com/pack
Step 3 : Go to the benefits section ,there are lot of benefits which we can take but as for now  we want domain

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tceigmjstf589xz1j3h.jpg)
Just grab your domain for FREE from the above website by linking your student pack its very easy .
I have grab .live domain and have hosted a static website on GitHub pages.
https://quranhadith.live

If you want to know how to host static website for free
Checkout: 
https://codelyguy.blogspot.com/?m=1

If you want to host a Dynamic website on I recommend BLUEHOST it's very affordable
Please refer from here :
[BLUEHOST](bluehost.sjv.io/LPQ0XY)
Future of HSEG
Tags: github, unity3d, csharp, programming
Published: 2022-11-12 11:53:08

Hi, Yvonne here, though nothing else makes that obvious.

I just wanted to let it be known that this project is on hold until I acquire some kind of computer science degree.
I'm thinking of this project all the time, but I don't have enough of a programming skillset yet, so I don't see any better course of action.

I'll still probably work on planning and discussion of the game from time to time.

I'll attempt to work on the actual game (hopefully) during the summer of 2025.
Checking if a file or a directory exists in node js
Tags: javascript, node, coding, website
Published: 2022-11-12 11:50:36

**Javascript Code:-**

``` javascript
const fs = require('fs')

// check if directory exists
const dir = './uploads'
if (fs.existsSync(dir)) {
  console.log('Directory exists!')
} else {
  console.log('Directory not found.')
}

// ---------------------------------------------------------------

// check if File exists
const path = "./package.json"
if (fs.existsSync(path)) {
    console.log('File exists!')
  } else {
    console.log('File not found.')
  }
```

Thank You.
You can follow us on:
[Youtube ](https://www.youtube.com/c/ULTIMATEPROGRAMMING)
[Instagram](https://www.instagram.com/full_stack_web_developer1/)
Opening Developer Tools on Chrome, Opera, Firefox & Microsoft Edge
Tags: webdev, javascript, productivity, tooling
Published: 2022-11-12 11:46:21

Recently, I tried to help someone fixed some JavaScript error then I realize I don't know how to find the developer console on safari so... here is what I found.

### To open the Chrome Developer Tools menu:
From the Chrome Menu > More Tools > Developer Tools
Right-click anywhere on a webpage and select Inspect
Use the keyboard shortcut F12 or CTRL + Shift + C (Shift + command + C on Mac)

### To open the developer tools in Mozilla Firefox:
Open the browser.
Press F12 on the keyboard. or Press the Ctrl+Shift+I keys or click Menu > Web Development > Inspector.
Right-click anywhere on a webpage and select Inspect

### Use the developer tools in Safari on Mac
If you’re a web developer, the Safari Develop menu 
If you don’t see the Develop menu in the menu bar, choose Safari > Settings, click Advanced, then select “Show Develop menu in menu bar.”
Press the Command +option+I keys

### To open the developer tools tool in Microsoft Edge:
Open the browser.
Press F12 on the keyboard. or Press Ctrl+Shift+I keys or click the Setting and more ellipsis icon, then click More tools > Developer Tools.
Right-click anywhere on a webpage and select Inspect

### To open the developer tools tool in Opera:
For Mac users, to open developer tools, select View > Show Developer Menu. A new submenu called Developer will appear on the menu bar. To use the tools, select Developer > Developer Tools.
For Windows and Linux users, to open developer tools, go to O Menu > Developer > Developer Tools.
In One Minute : TypeScript
Tags: typescript, javascript, beginners, oneminute
Published: 2022-11-12 10:41:00

[TypeScript](http://typescriptlang.org/) is a typed superset of javascript that [transpiles](https://www.stevefenton.co.uk/2012/11/compiling-vs-transpiling/) to plain JavaScript. It adds optional types, classes, interfaces, and modules to JavaScript. It was developed by Microsoft and is [open source](https://www.github.com/Microsoft/TypeScript).

- TypeScript offers classes, modules, and interfaces to help developers build robust components.
- TypeScript types let developers define interfaces between software components and gain insight into the behaviour of existing JavaScript libraries.
- TypeScript starts from the syntax and semantics millions of JavaScript developers know today.
- With TypeScript, developers can use existing JavaScript code, incorporate popular JavaScript libraries, and be called from other JavaScript code.
- TypeScript transpiles to JavaScript code which runs on any browser, in node.js, or in any other ES3-compatible environment.
- TypeScript as a language extension adds (amongst others) the following features:

> - Type annotations and compile-time type checking
> - Namespaces
> - Interfaces
> - Enums (to define a set of named constants)
> - Generics (classes, types, and functions that can work over a variety of types)
> - Await (suspends the execution until an asynchronous function return promise is fulfilled)
> - Abbreviated "arrow" syntax for anonymous functions
> - Optional parameters and default parameters

{% embed https://youtu.be/t5QmTdNZu-E %}

## Useful Links

- [TypeScript Home](http://www.typescriptlang.org/): Main landing page for TypeScript Language.
- [TypeScript-React-Starter](https://github.com/Microsoft/TypeScript-React-Starter): Get started with TypeScript and React!
- [TypeScript Playground](http://www.typescriptlang.org/Playground/): An online TypeScript editor by Microsoft.
- [TypeScript Samples](http://www.typescriptlang.org/Samples/): Code samples and demos of complete applications written in TypeScript
- [TypeScript GitHub Project](https://www.github.com/Microsoft/TypeScript): Issue tracker and source code
- [TypeScript Blog](https://blogs.msdn.microsoft.com/typescript/): Official TypeScript Blog
- [TypeScript Roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap): The planned future of TypeScript
- [TypeScript Handbook](http://www.typescriptlang.org/Handbook): User-oriented documentation for TypeScript
- [TypeScript Deep Dive](https://basarat.gitbooks.io/typescript/): An open source book on TypeScript targeted at beginners - advanced developers.
- [TypeScript Twitter](https://twitter.com/typescriptlang): Official TypeScript Twitter account
A Date With the Datetime Module in Python | Part - 1
Tags: python, beginners, tutorial, programming
Published: 2022-11-12 10:39:57

We can extract **current date** using two classes.

1. Using `date` class

```python
from datetime import date

today = date.today()
```

2. Using `datetime` class

```python
from datetime import datetime

today = datetime.today()
```

**OR**

```python
from datetime import datetime

now = datetime.now()
```

The main difference between `date.today()` and `datetime.today()` is that **date** class just return the date object. Whereas, **datetime** class returns not only date but time as well.

## Extract Current Day, Month and Year using Python

```python
today = datetime.today()

print(f"Today: {today}")
print(f"Year: {today.year}")
print(f"Month: {today.month}")
print(f"Day: {today.day}")
```

**OUTPUT:**

```bash
Today: 2022-10-22 17:13:37.918735
Year: 2022
Month: 10
Day: 22
```

## Extract Day of the Week using Python

```python
today = datetime.today()

print(f"Today: {today}")
print(f"Weekday: {today.weekday()}")

"""
OUTPUT:

Today: 2022-10-22 17:32:48.396792
Weekday: 5
"""
```

This **weekday()** method will work with both the `date` and `datetime` class.

> Note: Here, weekday() method will return index between **0** to **6**.

## Extract Current Time using Python

```python
today = datetime.now()

print(f"Today: {today}")
print(f"Hour: {today.hour}")
print(f"Minute: {today.minute}")
print(f"Second: {today.second}")
```

**OUTPUT:**

```bash
Today: 2022-10-22 17:41:01.076569
Hour: 17
Minute: 41
Second: 1
```

--- 

Want to learn more?
Signup for my [Newsletter](https://newsletter.sahilfruitwala.com/) and get the best articles into your inbox.

Till the next time 👋
Amazing Website to prepare for interview - suprabhasupi
Tags: career, productivity
Published: 2022-11-12 10:38:42

####   Original Tweet From  [@suprabhasupi](https://twitter.com/suprabhasupi)
{% embed https://twitter.com/suprabhasupi/status/1591034299012218882 %}
 

###1|. Leetcode

LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews

 [https://leetcode.com/](https://leetcode.com/) 

###2. interviewing io

Mock interviews with engineers from FAANG and other top companies. Get actionable feedback, get awesome, get fast-tracked.

 [https://interviewing.io/](https://interviewing.io/) 
AdSpace Here!!
###3. HackerRank

HackerRank is the market-leading technical assessment and remote interview solution for hiring developers.
 [https://www.hackerrank.com/](https://www.hackerrank.com/) 

###4. InterviewBit

InterviewBit prepares you not only for the interviews but for the actual job too.
 [https://www.interviewbit.com/](https://www.interviewbit.com/) 
AdSpace Here!!
###5. TechMockInterview

Mock interview with professional interviewers from Amazon, Facebook, Google, and other top software companies and receive feedback on your performance.

 [https://www.techmockinterview.com/](https://www.techmockinterview.com/) 
AdSpace Here!!
That's a wrap!

If you enjoyed this thread:

1. Follow me [@suprabhasupi](https://twitter.com/suprabhasupi) for more of these
2. RT the tweet below to share this thread with your audience  [https://twitter.com/1383508219/status/1591034299012218882](https://twitter.com/1383508219/status/1591034299012218882) 



Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
Most Frequently Asked SQL question in Interviews - freest_man
Tags: sql, career, programming
Published: 2022-11-12 10:22:28

####   Original Tweet From  [@freest_man](https://twitter.com/freest_man)
{% embed https://twitter.com/freest_man/status/1591075118389657601 %}
I went through SQL 156 question bank and sat for 5 interviews

Here is the most frequently asked 

##What is the difference between DELETE, DROP and TRUNCATE?

Take a moment to think of the possible answer before continuing 

###1/ DELETE 

It is a Data Manipulation Language (DML) command.

It can delete all rows or certain rows under conditions using WHERE. ![Twitter Image 0](https://pbs.twimg.com/media/FhSiZjcXEAcv_qz.png) 

DELETE cannot delete the structure of the table.

ie The column names still exist but with empty rows.

We can restore the deleted rows using the ROLLBACK command. 
AdSpace Here!!
###2/ DROP

It is a Data Definition Language (DDL)  command.

With the help of DROP it can delete the entire table along with its structure. ![Twitter Image 1](https://pbs.twimg.com/media/FhSiaFJXEAEqz74.png) 

ROLLBACK command cannot restore the dropped table.

By using DROP the existence of the whole table is gone. 
AdSpace Here!!
###3/ TRUNCATE 

 It is also a Data Definition Language (DDL)  command. 

TRUNCATE can only delete all the rows from the table in one go. ![Twitter Image 2](https://pbs.twimg.com/media/FhSialPX0AU0dgO.png) 

It cannot be used with the WHERE command.

It is faster than the DELETE command.

Here we cant restore the values using ROLLBACK. 

That's a wrap!
AdSpace Here!!
If you enjoyed this thread:

1. Follow me [@freest_man](https://twitter.com/freest_man) for more of these
2. RT the tweet below to share this thread with your audience  [https://twitter.com/1562857893958823936/status/1591075118389657601](https://twitter.com/1562857893958823936/status/1591075118389657601) 



Click [Here](https://www.knowledge-twitter.com/?utm_source=dev.to)  For More Posts Like This [https://www.knowledge-twitter.com](https://www.knowledge-twitter.com/?utm_source=dev.to)
How to use delimiter in MySQL
Tags: mysql, sql, database, bigdata
Published: 2022-11-12 10:11:53

**when writing SQL statements , we use 
the delimiter to separate betwene 
two Statements**

```
delimiter ;
select * from school ;
delimiter $$
select * from student $$
```
=>the default delimiter 
is semicolon  (;)

```
select * from school ;
```

**=> Setting a different the delimiter 
allows us to execute all statements 
as a single statements**
## for example 

```
delimiter $$
create function (para int) returns int
begin
-- statement 
end
$$
delimiter ;
```
**=> in this statement we want to execute
function or stored procedures in one
statemente . so , we use dilimiter**

## i explaine how to use delimiter in MySQL on youtube
click this => [vidéo](https://www.youtube.com/watch?v=j22I714hyMY)
## this is my channel on youtube 
click this => [The Dream Coding](https://www.youtube.com/channel/UC7EawDV9gGzPcYOLN3FrASQ)