teleren/devto huggingface dataset:
My New Portfolio and how to make one.
Tags: portfolio, webdev, beginners, tutorial
Published: 2022-06-16 01:45:44

## Intro

I created my first [Portfolio](https://roman1234.w3spaces.com) it took me about 2 weeks and it's still not finished, (This is just an early release. ) In this article I will show you the tips and tricks for making a Portfolio.

## Step 1: Ideas

First we are going to get started on ideas (the basics of your website). On a Portfolio the main ideas are: how to contact me, about me, my blog posts, etc...
Create does ideas into divs and right texts in them like h1-h1, p, span, i, etc... You may really want to create a website like this but you want people to see it right? Without spending a single dime from your pocket you can get a website. I used W3schools spaces, it was simple and easy to use. We are not going to jump into css yet cause that is not concerning for us yet. Now that you have made these few changes to your code let's jump into more advance stuff.

## Step 2, Part 1: Basic CSS

For this part you will need basic CSS knowledge. If you haven't already create classes for your 'ideas', you can do that now. So when I talk about Basic CSS I'm talking real simple. 

## Step 2, Part 2: Fonts and Colors

We are going to focus on fonts and colors, what fonts do you want? That up to you but I can help you a bit, your font tells your users the theme of your website, if i'm doing a website about coding I might want to use a font such as Source Code Pro, that's an example. You maybe like how do I get these fonts? Simple Google Fonts, it provides free font's without any downloading. You go on their site pick a font you like click on the plus button insert the first big shunk of code in the HTML part of it then the small part of code in the CSS section. I think if you are using only one font you should put the CSS code in the 'body tag'.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qheg4jwvy2kpx8155l6h.png)
 
Perfect!!!
 Now lets talk about colors: use two color such as black and white, red and white, colors that match basicaly. You can use more but to start let go simple. In my project I had rainbows of color with CSS animation but that we will talk about later.

## Step 4: I could write about this forever.

I don't want to spend forever to right this article so I'm going to summarize this. First of all you don't need a lot of Image, I recommend just using one such as your profile picture? Doesn't have to be an image of you can be a image you found on the internet (please give credit if you do so the image I have on mine is a drawing I drew so I didn't need to put credits.) Use icons the best sites for free icons without downloading any is Font Awesome you can directly paste the code in your code editor and they have over 1,000 icons! Insert of favicon! Make things interesting for the user! Use some animation if you don't know any CSS animation just find some free ones on codepen.io or something like that! Good animations are like text effects and button on hover those are the most interesting! 

I think that's it for today if you have more questiong just comment it!
I am grateful ☺️
Published: 2022-06-16 01:38:51


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39gyfb7c5mivvhhfosk0.jpg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1x96ruwp1xy6i2gvy6j.jpg)
Event driven architecture
Tags: eventdriven, rabbitmq, bus, microservices
Published: 2022-06-16 01:36:39

event driven architecture is a pattern of architecture for applications following the tips of production, detection, consumption and reaction to events. it is possible to describe an event as a change of state. for example, if a device is shutdown and somebody opens it, the state of the device changes from shutdown to opened. the service to open the device has to make this change like an event, and that event can be known by the rest of the services.

an event notification is a message that was produced, published, detected, or consumed asynchronously and it is the status changed by the event. it is important to understand that an event does not move around the application, it just happens. the term event is a little controversial because it usually means the message event notification instead of the event, so it is important to know the difference between the event and the event notification. this pattern is commonly used in applications based on components or microservices because they can be applied by the design and implementation of applications. an application driven by events has event creators and event consumers.

an event creator is the producer of the event, it only knows that the event has occurred, nothing else. then we have the event consumers, which are the entities responsible of knowing that the event was fired. the consumers are involved in processing or changing the event. the event consumers are subscribed to some kind of middleware event manager which, as soon as it receives notification of an event from a creator event, forwards the event to the registered consumers to be taken by them.
developing applications as microservices around an architecture such as eda allows these applications to be constructed in a way that facilitates more responsiveness because the eda applications are ready to be in unpredictable and asynchronous environments.
the advantages of using eda are as follows:
- uncoupling systems: the creator service does not need to know the rest of the services, and the rest of the services do not know the creator. so it allows it to uncouple the system.
- interaction publish/subscribe: eda allows many to many interactions. where the services publish information about some event and the services can get that information and do what is necessary with the event. so, it enables many creator
events and consumer events to exchange status and respond to information in real time.
- asynchronous: eda allows asynchronous interactions between the services. so they do not need to wait for an immediate response and it is not mandatory to have a connection working while they are waiting for the response.
Sum Root to Leaf Numbers
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 01:30:40

You are given the `root` of a binary tree containing digits from `0` to `9` only.

Each root-to-leaf path in the tree represents a number.

*   For example, the root-to-leaf path `1 -> 2 -> 3` represents the number `123`.

Return _the total sum of all root-to-leaf numbers_. Test cases are generated so that the answer will fit in a **32-bit** integer.

A **leaf** node is a node with no children.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/02/19/num1tree.jpg)

**Input:** root = \[1,2,3\]
**Output:** 25
**Explanation:**
The root-to-leaf path `1->2` represents the number `12`.
The root-to-leaf path `1->3` represents the number `13`.
Therefore, sum = 12 + 13 = `25`.

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/02/19/num2tree.jpg)

**Input:** root = \[4,9,0,5,1\]
**Output:** 1026
**Explanation:**
The root-to-leaf path `4->9->5` represents the number 495.
The root-to-leaf path `4->9->1` represents the number 491.
The root-to-leaf path `4->0` represents the number 40.
Therefore, sum = 495 + 491 + 40 = `1026`.

**Constraints:**

*   The number of nodes in the tree is in the range `[1, 1000]`.
*   `0 <= Node.val <= 9`
*   The depth of the tree will not exceed `10`.

**SOLUTION:**

    # Definition for a binary tree node.
    # class TreeNode:
    #     def __init__(self, val=0, left=None, right=None):
    #         self.val = val
    #         self.left = left
    #         self.right = right
    class Solution:
        def sumNumbers(self, root: Optional[TreeNode]) -> int:
            paths = [(root, root.val)]
            i = 0
            total = 0
            while i < len(paths):
                curr, val = paths[i]
                if curr:
                    if not curr.left and not curr.right:
                        total += val
                    if curr.left:
                        paths.append((curr.left, 10 * val + curr.left.val))
                    if curr.right:
                        paths.append((curr.right, 10 * val + curr.right.val))
                i += 1
            return total
Pure CSS Background Image Scroll Effect
Tags: codepen
Published: 2022-06-16 01:01:16

<p>Works in browsers which support <code>mix-blend-mode</code> <a href="https://caniuse.com/#search=mix-" target="_blank">https://caniuse.com/#search=mix-</a></p>

{% codepen https://codepen.io/carpenumidium/pen/LeOjKM %}
Minimum Cost For Tickets
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 01:00:45

You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array `days`. Each day is an integer from `1` to `365`.

Train tickets are sold in **three different ways**:

*   a **1-day** pass is sold for `costs[0]` dollars,
*   a **7-day** pass is sold for `costs[1]` dollars, and
*   a **30-day** pass is sold for `costs[2]` dollars.

The passes allow that many days of consecutive travel.

*   For example, if we get a **7-day** pass on day `2`, then we can travel for `7` days: `2`, `3`, `4`, `5`, `6`, `7`, and `8`.

Return _the minimum number of dollars you need to travel every day in the given list of days_.

**Example 1:**

**Input:** days = \[1,4,6,7,8,20\], costs = \[2,7,15\]
**Output:** 11
**Explanation:** For example, here is one way to buy passes that lets you travel your travel plan:
On day 1, you bought a 1-day pass for costs\[0\] = $2, which covered day 1.
On day 3, you bought a 7-day pass for costs\[1\] = $7, which covered days 3, 4, ..., 9.
On day 20, you bought a 1-day pass for costs\[0\] = $2, which covered day 20.
In total, you spent $11 and covered all the days of your travel.

**Example 2:**

**Input:** days = \[1,2,3,4,5,6,7,8,9,10,30,31\], costs = \[2,7,15\]
**Output:** 17
**Explanation:** For example, here is one way to buy passes that lets you travel your travel plan:
On day 1, you bought a 30-day pass for costs\[2\] = $15 which covered days 1, 2, ..., 30.
On day 31, you bought a 1-day pass for costs\[0\] = $2 which covered day 31.
In total, you spent $17 and covered all the days of your travel.

**Constraints:**

*   `1 <= days.length <= 365`
*   `1 <= days[i] <= 365`
*   `days` is in strictly increasing order.
*   `costs.length == 3`
*   `1 <= costs[i] <= 1000`

**SOLUTION:**

    import bisect
    
    class Solution:
        def mincost(self, days: List[int], costs: List[int], i) -> int:
            n = len(days)
            if i >= n:
                return 0
            if i in self.cache:
                return self.cache[i]
            today = days[i]
            tomorrow = i + 1
            nextweek = bisect.bisect_right(days, today + 6)
            nextmonth = bisect.bisect_right(days, today + 29)
            cost = min(costs[0] + self.mincost(days, costs, tomorrow), costs[1] + self.mincost(days, costs, nextweek), costs[2] + self.mincost(days, costs, nextmonth))
            self.cache[i] = cost
            return cost
        
        def mincostTickets(self, days: List[int], costs: List[int], i = 0) -> int:
            self.cache = {}
            return self.mincost(days, costs, 0)
Construct K Palindrome Strings
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 00:30:34

Given a string `s` and an integer `k`, return `true` _if you can use all the characters in_ `s` _to construct_ `k` _palindrome strings or_ `false` _otherwise_.

**Example 1:**

**Input:** s = "annabelle", k = 2
**Output:** true
**Explanation:** You can construct two palindromes using all characters in s.
Some possible constructions "anna" + "elble", "anbna" + "elle", "anellena" + "b"

**Example 2:**

**Input:** s = "leetcode", k = 3
**Output:** false
**Explanation:** It is impossible to construct 3 palindromes using all the characters of s.

**Example 3:**

**Input:** s = "true", k = 4
**Output:** true
**Explanation:** The only possible solution is to put each character in a separate string.

**Constraints:**

*   `1 <= s.length <= 105`
*   `s` consists of lowercase English letters.
*   `1 <= k <= 105`

**SOLUTION:**

    from collections import Counter
    
    class Solution:
        def canConstruct(self, s: str, k: int) -> bool:
            n = len(s)
            if n < k:
                return False
            if n == k:
                return True
            ctr = Counter(s)
            oddctr = sum(1 if v & 1 else 0 for v in ctr.values())
            if oddctr > k:
                return False
            return True
Maximum Gap
Tags: leetcode, dsa, theabbie
Published: 2022-06-16 00:00:41

Given an integer array `nums`, return _the maximum difference between two successive elements in its sorted form_. If the array contains less than two elements, return `0`.

You must write an algorithm that runs in linear time and uses linear extra space.

**Example 1:**

**Input:** nums = \[3,6,9,1\]
**Output:** 3
**Explanation:** The sorted form of the array is \[1,3,6,9\], either (3,6) or (6,9) has the maximum difference 3.

**Example 2:**

**Input:** nums = \[10\]
**Output:** 0
**Explanation:** The array contains less than 2 elements, therefore return 0.

**Constraints:**

*   `1 <= nums.length <= 105`
*   `0 <= nums[i] <= 109`

**SOLUTION:**

    import heapq
    
    class Solution:
        def maximumGap(self, nums: List[int]) -> int:
            maxGap = float('-inf')
            n = len(nums)
            if n <= 1:
                return 0
            heapq.heapify(nums)
            prev = heapq.heappop(nums)
            while len(nums) > 0:
                curr = heapq.heappop(nums)
                maxGap = max(maxGap, curr - prev)
                prev = curr
            return maxGap
Downloading Lambda layer versions using the AWS CLI
Tags: aws, lambda
Published: 2022-06-16 00:00:00

---
title: "Downloading Lambda layer versions using the AWS CLI"
date: "2022-06-16T00:00:00.000Z"
tags: ["AWS", "Lambda"]
---

The packaged .zip for a [Lambda layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) can be downloaded using the AWS console (appropriate IAM permissions notwithstanding) - as long as you have access to the host AWS account of course.

If the Lambda layer originates in a _different AWS account_ you don't have console access to, __you will need to use the AWS CLI__. 

Why would you want or need to do this though?

1. As with any third party dependency it makes sense to examine it rather than simply trusting it to be benign in nature
1. You want to override the layer's behaviour in a specific way (i.e. by merging a later layer) and need to examine its implementation

Fortunately, the `aws lambda` CLI provides two useful options - one for downloading a layer version by name, the other by its [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).

## Downloading a Lambda layer version by name

To download version 99 of a Lambda layer called `acme-corp-lambda-layer` using its name, use the `get-layer-version` option:

```bash
URL=$(aws lambda get-layer-version --layer-name ars:aws:lambda:$AWS_REGION:$AWS_ACME_CORP_ACCOUNT:layer:acme-corp-lambda-layer --version-number:99 --query Content.Location --output text)

curl $URL -o acme-corp-lambda-layer.zip
```

## Downloading a Lambda layer version by ARN

If you want to download version 99 of of the layer using its ARN instead, use `get-layer-version-by-arn`:

```bash
URL=$(aws lambda get-layer-version-by-arn --arn arn:aws:lambda:$AWS_REGION:$AWS_ACME_CORP_ACCOUNT:layer:my-lambda-layer:99 --query Content.Location --output text)

curl $URL -o acme-corp-lambda-layer.zip
```
Q: As a #CodeNewbie, what are your learning goals for the next #30Days?
Tags: codeland, beginners, javascript, discuss
Published: 2022-06-15 23:59:48

---
title: Q: As a #CodeNewbie, what are your learning goals for the next #30Days? 
published: true
description: Join @AzureAdvocates and @msdev at #Codeland2022 and let's discuss what #CodeNewbies should focus on to jumpstart their learning journey to Cloud+AI!
tags: #codeland, #beginners, #javascript, #discuss
series: Microsoft Developers + Azure Advocates at Codeland
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qr3u7elijvnicxok1u59.png
---

> Microsoft is sponsoring [Codeland Conference](https://codelandconf.com/) again this year. Come join us in the [#CodeNewbie Forem](https://community.codenewbie.org/msusdeveloper) Jun 16-17 to jumpstart your learning journey into Azure & AI, and meet your peers!

---

In her popular [Learning To Learn](https://www.coursera.org/learn/learning-how-to-learn) course, Barbara Oakley talks about learning modes (diffused and focused), learning sprints (focus for X minutes, relax for Y minutes) and learning practices ("chunking" into small activities that build on each other) that help improve your understanding and recall of what you learn. 

Planning a #30Days learning journey is one way to put these ideas into practice. Learn or make something in 30 Days  by breaking down the end goal into daily chunks of activity that build on each other! Get automatic "breaks" between those focused periods, to help your brain process and recall the information better.

**What would *you* like to learn in #30Days - and how do you plan to go about it?**

Some examples: 
 * I want to become a power user of (this) developer tool
 * I want to build my first app using (this) framework
 * I want to learn the fundamentals of (this) technology

---

Please do leave us your thoughts and ideas in the comments. If you are looking for ideas, check out these options:
 * [#30DaysOfPWA](https://dev.to/nitya/series/16849) - learn to build and ship Progressive Web Apps.
 * [#30DaysOfSWA](https://aka.ms/30DaysOfSWA) - learn to build and deploy Static Web Apps on Azure
 * [#30DaysToLearnIt](https://developer.microsoft.com/en-us/offers/30-days-to-learn-it) - cloud skills challenges with Certifications in mind

If you are an experienced developer, do share your experiences with any #30Days of learning projects or resources that may be useful for beginners.
Reconstruct a 2-Row Binary Matrix
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 23:30:35

Given the following details of a matrix with `n` columns and `2` rows :

*   The matrix is a binary matrix, which means each element in the matrix can be `0` or `1`.
*   The sum of elements of the 0-th(upper) row is given as `upper`.
*   The sum of elements of the 1-st(lower) row is given as `lower`.
*   The sum of elements in the i-th column(0-indexed) is `colsum[i]`, where `colsum` is given as an integer array with length `n`.

Your task is to reconstruct the matrix with `upper`, `lower` and `colsum`.

Return it as a 2-D integer array.

If there are more than one valid solution, any of them will be accepted.

If no valid solution exists, return an empty 2-D array.

**Example 1:**

**Input:** upper = 2, lower = 1, colsum = \[1,1,1\]
**Output:** \[\[1,1,0\],\[0,0,1\]\]
**Explanation:** \[\[1,0,1\],\[0,1,0\]\], and \[\[0,1,1\],\[1,0,0\]\] are also correct answers.

**Example 2:**

**Input:** upper = 2, lower = 3, colsum = \[2,2,1,1\]
**Output:** \[\]

**Example 3:**

**Input:** upper = 5, lower = 5, colsum = \[2,1,2,0,1,0,1,2,0,1\]
**Output:** \[\[1,1,1,0,1,0,0,1,0,0\],\[1,0,1,0,0,0,1,1,0,1\]\]

**Constraints:**

*   `1 <= colsum.length <= 10^5`
*   `0 <= upper, lower <= colsum.length`
*   `0 <= colsum[i] <= 2`

**SOLUTION:**

    class Solution:
        def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) -> List[List[int]]:
            n = len(colsum)
            op = [[0 for i in range(n)] for j in range(2)]
            ctr = []
            for i in range(n):
                if colsum[i] == 2:
                    op[0][i] = 1
                    upper -= 1
                    op[1][i] = 1
                    lower -= 1
                elif colsum[i] == 1:
                    ctr.append(i)
            if upper >= 0 and lower >= 0 and upper + lower == len(ctr):
                if upper > 0:
                    for i in ctr[:upper]:
                        op[0][i] = 1
                if lower > 0:
                    for i in ctr[-lower:]:
                        op[1][i] = 1
                return op
            return []
Maximum Product Difference Between Two Pairs
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 23:00:46

The **product difference** between two pairs `(a, b)` and `(c, d)` is defined as `(a * b) - (c * d)`.

*   For example, the product difference between `(5, 6)` and `(2, 7)` is `(5 * 6) - (2 * 7) = 16`.

Given an integer array `nums`, choose four **distinct** indices `w`, `x`, `y`, and `z` such that the **product difference** between pairs `(nums[w], nums[x])` and `(nums[y], nums[z])` is **maximized**.

Return _the **maximum** such product difference_.

**Example 1:**

**Input:** nums = \[5,6,2,7,4\]
**Output:** 34
**Explanation:** We can choose indices 1 and 3 for the first pair (6, 7) and indices 2 and 4 for the second pair (2, 4).
The product difference is (6 \* 7) - (2 \* 4) = 34.

**Example 2:**

**Input:** nums = \[4,2,5,9,7,4,8\]
**Output:** 64
**Explanation:** We can choose indices 3 and 6 for the first pair (9, 8) and indices 1 and 5 for the second pair (2, 4).
The product difference is (9 \* 8) - (2 \* 4) = 64.

**Constraints:**

*   `4 <= nums.length <= 104`
*   `1 <= nums[i] <= 104`

**SOLUTION:**

    class Solution:
        def maxProductDifference(self, nums: List[int]) -> int:
            nums.sort()
            return nums[-1] * nums[-2] - nums[0] * nums[1]
Minimum Time to Type Word Using Special Typewriter
Tags: leetcode, dsa, theabbie
Published: 2022-06-15 22:30:39

There is a special typewriter with lowercase English letters `'a'` to `'z'` arranged in a **circle** with a **pointer**. A character can **only** be typed if the pointer is pointing to that character. The pointer is **initially** pointing to the character `'a'`.

![](https://assets.leetcode.com/uploads/2021/07/31/chart.jpg)

Each second, you may perform one of the following operations:

*   Move the pointer one character **counterclockwise** or **clockwise**.
*   Type the character the pointer is **currently** on.

Given a string `word`, return the **minimum** number of seconds to type out the characters in `word`.

**Example 1:**

**Input:** word = "abc"
**Output:** 5
**Explanation:** 
The characters are printed as follows:
- Type the character 'a' in 1 second since the pointer is initially on 'a'.
- Move the pointer clockwise to 'b' in 1 second.
- Type the character 'b' in 1 second.
- Move the pointer clockwise to 'c' in 1 second.
- Type the character 'c' in 1 second.

**Example 2:**

**Input:** word = "bza"
**Output:** 7
**Explanation:**
The characters are printed as follows:
- Move the pointer clockwise to 'b' in 1 second.
- Type the character 'b' in 1 second.
- Move the pointer counterclockwise to 'z' in 2 seconds.
- Type the character 'z' in 1 second.
- Move the pointer clockwise to 'a' in 1 second.
- Type the character 'a' in 1 second.

**Example 3:**

**Input:** word = "zjpc"
**Output:** 34
**Explanation:**
The characters are printed as follows:
- Move the pointer counterclockwise to 'z' in 1 second.
- Type the character 'z' in 1 second.
- Move the pointer clockwise to 'j' in 10 seconds.
- Type the character 'j' in 1 second.
- Move the pointer clockwise to 'p' in 6 seconds.
- Type the character 'p' in 1 second.
- Move the pointer counterclockwise to 'c' in 13 seconds.
- Type the character 'c' in 1 second.

**Constraints:**

*   `1 <= word.length <= 100`
*   `word` consists of lowercase English letters.

**SOLUTION:**

    class Solution:
        def minTimeToType(self, word: str) -> int:
            curr = 'a'
            t = 0
            for c in word:
                d = abs(ord(c) - ord(curr))
                t += min(d, 26 - d)
                curr = c
            return t + len(word)