teleren/devto huggingface dataset:
3 Free Courses to take in 2023
Tags: webdev, beginners, motivation, tutorial
Published: 2023-01-09 08:56:19

Image source - https://www.highlands.ac.uk/wp-content/uploads/2021/06/freec.png

It is the beginning of the year and as always resolutions were made

- Go to the gym

- Be a better person

- Learn X and Y 

- .....many... many more

On the learning part I have 3 FREE Courses from Google that you should check out this year

## 1. Machine Learning 

> This course teaches the basics of machine learning through a series of lessons that include video lectures from researchers at Google, text written specifically for newcomers to ML, interactive visualizations of algorithms in action and real-world case studies. While learning new concepts, you'll immediately put them into practice with coding exercises that walk you through implementing models in TensorFlow, an open-source machine intelligence library.
https://learndigital.withgoogle.com/digitalunlocked/course/machine-learning-crash-course

## 2. Google Cloud Computing Foundations: Data, ML, and AI in  Google Cloud
> The Google Cloud Computing Foundations courses are for individuals with little to no background or experience in cloud computing. They provide a detailed overview of concepts covering cloud basics, big data, and machine learning, and where and how Google Cloud fits in.
> By the end of the course, learners will be able to articulate concepts around cloud computing, big data, and machine learning, and demonstrate some hands-on skills.

https://www.classcentral.com/course/google-cloud-computing-foundations-data-ml-and-ai-in-google-cloud-98571

## 3. Data Science Foundations

> Data Science is a field which uses methods and algorithms for extraction of information from data provided either it is structured data or unstructured data. Due to growth in data and evolution in technology, the domain of Data Science has seen a tremendous rise.This course will give you a comprehensive introduction to Data Science and Analytics Landscape. You will learn all the fundamentals of Data Science and Data Science Life Cycle.
https://learndigital.withgoogle.com/digitalunlocked/course/data-science-foundations

Have a look and check that one point from your New Year TO DO list.
Write in the comments if you have other links to share or if you liked the article.
Master the Art of Making HTTP Requests with Javascript
Tags: javascript, webdev, beginners, programming
Published: 2023-01-09 08:47:24

You can use the fetch() function to make HTTP requests in JavaScript. The fetch() function is a modern way to make HTTP requests in JavaScript, and it's supported by most modern browsers.

Here's an example of how you can use fetch() to make an HTTP GET request to an API endpoint:

```
fetch('https://api.example.com/endpoint')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
```
This example makes a GET request to the specified API endpoint and logs the response data to the console. The response.json() method parses the response data as JSON, and the .then() method is used to handle the response data asynchronously. The .catch() method is used to catch any errors that occur during the request.

You can also use fetch() to make POST requests, or requests with other HTTP methods, by specifying the method in the options object that you pass to fetch(). For example:



```
fetch('https://api.example.com/endpoint', {
  method: 'POST',
  body: JSON.stringify({key: 'value'}),
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error))
```
This example makes a POST request to the specified API endpoint with a JSON payload in the request body. The Content-Type header is set to application/json to specify the format of the request body.
34. Find First and Last Position of Element in Sorted Array
Tags: java, amazon, 100daysofcode, leetcode
Published: 2023-01-09 08:30:25

**Problem Statement:**

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

If target is not found in the array, return [-1, -1].

You must write an algorithm with O(log n) runtime complexity.

 

**Example 1:**
**Input:** nums = [5,7,7,8,8,10], target = 8
**Output:** [3,4]

**Example 2:**
**Input:** nums = [5,7,7,8,8,10], target = 6
**Output:** [-1,-1]

**Example 3:**
**Input:** nums = [], target = 0
**Output:** [-1,-1]
 
**Constraints:**

- 0 <= nums.length <= 105
- -109 <= nums[i] <= 109
- nums is a non-decreasing array.
- -109 <= target <= 109

**Solution:**
**Algorithm:**
1. Find the target value in the array.
2. If the target value is found,then find the first and last position of the target value.
3. If the target value is not found,return [-1,-1].
4. Return the result.

**Code:**
```
public class Solution {
    public int[] searchRange(int[] nums,int target){

        int[] result = new int[2];
        result[0] = -1;
        result[1] = -1;
        int left = 0;
        int right = nums.length - 1;
        int mid = 0;
        while(left <= right){
            mid = (left + right) / 2;
            if(nums[mid] == target){
                result[0] = mid;
                result[1] = mid;
                break;
            }
            else if(nums[mid] < target){
                left = mid + 1;
            }
            else{
                right = mid - 1;
            }
        }
        if(result[0] == -1){
            return result;
        }
        int i = mid - 1;
        while(i >= 0 && nums[i] == target){
            result[0] = i;
            i--;
        }
        i = mid + 1;
        while(i < nums.length && nums[i] == target){
            result[1] = i;
            i++;
        }
        return result;
    }
    
}
```

**Time Complexity:**
O(log N)

**Space Complexity:**
O(1)
Share private code using Share code snippets
Tags: webdev, programming
Published: 2023-01-09 08:08:29

Hi,

I am back with a new update for GoOnlineTools.

After 2 years, the share code snippets tool has improved a lot.

Now, you can create private code snippets. We've also added support for 5 new code languages. 

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

**Here's how to create private code snippets:**

1. Type or paste your code and then change the visibility to private.
2. Enter a four-digit pin to protect your code snippets.
3. Click the "Share Code" button and copy the published URL.

**To view protected code snippets:**

1. Open the published URL - for example, https://goonlinetools.com/snapshot/code/#ca7ro20f0s8pfbsqkadnei
2. Enter the four-digit pin (eg - 1111) that you set while sharing, and then click the "Unlock" button. 
3. When you enter the correct pin, you will be able to see your code snippets.
CodePen Designs - 18 : Video Sharing Platform UI
Tags: codepen, css, webdev, beginners
Published: 2023-01-09 08:07:56

### We are excited to introduce our new series that will explore the best design ideas from the Codepen community. 

We will be publishing these each day and hope you find them insightful and inspiring as we showcase some of the most talented designers in this space.

---


#### Codepen Design - 18

<p>Inspired by Live Spline.one 
<a href="https://dribbble.com/shots/3860602-Video-Application-4" target="_blank">https://dribbble.com/shots/3860602-Video-Application-4</a></p>

{% codepen https://codepen.io/TurkAysenur/pen/abvrNgx %}


---
## For more information

1. Check my GitHub profile
[https://github.com/amitSharma7741](https://github.com/amitSharma7741)

2. Check out my Fiver profile if you need any freelancing work
[https://www.fiverr.com/amit_sharma77](https://www.fiverr.com/amit_sharma77)

3. Check out my Instagram
[https://www.instagram.com/fromgoodthings/](https://www.instagram.com/fromgoodthings/)

4. Linktree
[https://linktr.ee/jonSnow77](https://linktr.ee/jonSnow77)

5. Check my project

- EVSTART: Electric Vehicle is the Future
[https://evstart.netlify.app/](https://evstart.netlify.app/)
-  News Website in react
 [https://newsmon.netlify.app/](https://newsmon.netlify.app/)
-  Hindi jokes API
 [https://hindi-jokes-api.onrender.com/](https://hindi-jokes-api.onrender.com/)


---
---
JavaScript Destructuring
Tags: javascript
Published: 2023-03-03 15:24:25

---
title: JavaScript Destructuring
published: true
date: 2023-01-09 08:00:00 UTC
tags: JavaScript
canonical_url: https://www.90-10.dev/js-destructuring/
---

Destructuring is the process of unpacking (extracting) data from arrays or objects, into distinct variables to make it easier to work with complex data structures.

## Array Destructuring

Given an array, we can "extract" some of its content and assign them to variables in a single statement, using square brackets `[]`:

```
let colours = ['red', 'blue', 'green']
let [colour1, colour2] = colours
console.log(colour1) // prints: red
console.log(colour2) // prints: blue
```

It is possible to ignore certain values when required - notice the extra comma between `colour1` and `colour2` in the example below:

```
let colours = ['red', 'blue', 'green'];
let [colour1, , colour2] = colours;
console.log(colour2) // prints: green
```

### Undefined

If not enough values are present, the destination will be `undefined` (as expected when declaring but not assigning variables):

```
let colours = ['red', 'blue']
let [colour1, colour2, colour3] = colours
console.log(colour43) // prints: undefined
```

### Default value

However, default values can be provides:

```
let colours = ['red', 'blue']
let [colour1, colour2, colour3 = 'yellow'] = colours
console.log(colour3) // prints: yellow
```

## Object Destructuring

This will feel very similar to the destructuring from arrays - however, the names of the variables to destructure to must match the name of the object properties:

```
let colour = { name: 'blue', score: 42}
let {name, score} = colour
console.log(name) // prints: blue
console.log(score) // prints: 42
```

### Renaming

To unpack to different variable names, we need to specify both them alongside the object properties:

```
let colour = { name: 'blue', score: 42};
let {name: colourName, score: colourScore} = colour;
```

### Default values

Just like before, we can specify default values:

```
let colour = { name: 'blue', score: 42};
let {
    id: colourId = 1, 
    name: colourName, 
    score: colourScore
} = colour;
console.log(colourId) // prints: 1
console.log(colourName) // prints: blue

```

* * *

## Tip: Multiple assignment via destructuring

Sometime we need to assign values to multiple variable at the same time and destructuring makes is simpler and visually more appealing:

```
let colour, score;
[colour, score] = ['blue', 42];

```

* * *

## Tip: Swap values

Another common scenario is when swapping the values of 2 variables - usually it requires a third temporary variable to hold one the values. With destructuring assignment, it becomes much easier:

```
let x = 1
let y = 2
[x, y] = [y, x]
console.log(x) // prints: 2
console.log(y) // prints: 1

```

* * *

## Take Away

JavaScript destructuring is a powerful feature that can make our code more concise and readable, by allowing us to extract values from arrays and objects with ease and provides us with more control over variable assignment.
Beautify your LinkedIn profile link!
Tags: linkedin, career, watercooler
Published: 2023-01-09 07:29:14

---
title: Beautify your LinkedIn profile link!
published: true
description: A nicer LinkedIn URL will help you remember it.
tags: linkedin, career, watercooler
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-09 07:17 +0000
---

One of the things that unnecessary disturb me is seeing LinkedIn profile links that look like this one:

`https://www.linkedin.com/in/foo-bar-15037626/`

That trailing number just drives me crazy.

I know it would be much easier just to change my attitude, but then I think a nicer URL is good for you too.

A nicer LinkedIn URL will help you remember it.

Luckily you can easily change your **public profile URL**. LinkedIn has the [instructions here](https://www.linkedin.com/help/linkedin/answer/a542685)

So that user could change her link to either of these

```
https://www.linkedin.com/in/foo-bar/
https://www.linkedin.com/in/foobar/
```

and if those are taken then she could change it to

```
https://www.linkedin.com/in/fbr/
```

or

```
https://www.linkedin.com/in/foo-bar-the-great/
```

BTW if we are already talking about it, feel free to follow me here on DEV and/or on [LinkedIn](https://www.linkedin.com/in/szabgab/) as well.
How do you find the Roku IP address without a remote or wifi
Tags: roku, rokutv, rokuipaddress, howto
Published: 2023-01-09 07:16:13

In some cases Roku’s remote and wifi does not work, at that time this question comes up how to find Roku IP address without remote or wifi today we will know how to find it in an easy way

First of all, let us know if your Roku remote is working properly then how to find Roku's IP address with the help of the Roku remote.

follow these steps: 

First of all, go to the home screen and select the option **Settings** 

After that follow this setting **Network>About** Now the Roku IP Address will appear on the right side of the screen.

Open the PC browser and sign in to go to the admin interface of your router.

visit the router status page and check all your devices are connected to the router.

Now here your Roku device will be listed in the name of the hostname and next to the hostname you will see the IP address of the device

If Roku is not listed here, use the MAC Address of the listed device.

Here, you will find your Roku IP address next to the name.

**By using the Roku mobile app**

In addition to finding your Roku IP address, you can also use the Roku App on your mobile device to do the same thing. You can do this by downloading the Roku App on your mobile device and installing it.

Open the Roku Mobile app on your phone
Make sure your phone and your roku device are connected to the same network
Tap on the settings icon of the app and then go to system info
Now here, you will find your IP address
DevOps is Dead!
Tags: devops, beginners, webdev
Published: 2023-01-09 07:10:36

DevOps is dead ❗ ❗ ❗ 
Platform engineering takes over.

I heard this several times over the last month. 

But is it true? Are companies turning away from DevOps, and should you switch careers???

I've made a video to set the record straight 👇

{% embed https://youtu.be/hN6a2Q6yq0g %}
convert number to words in javascript [ with explanation]
Published: 2023-01-09 07:03:46

{% youtube Iv6efNYNobI%}

```js

// Define an object that maps numbers to their word form
const numbersToWords = {
  0: "zero",
  1: "one",
  2: "two",
  3: "three",
  4: "four",
  5: "five",
  6: "six",
  7: "seven",
  8: "eight",
  9: "nine",
  10: "ten",
  11: "eleven",
  12: "twelve",
  13: "thirteen",
  14: "fourteen",
  15: "fifteen",
  16: "sixteen",
  17: "seventeen",
  18: "eighteen",
  19: "nineteen",
  20: "twenty",
  30: "thirty",
  40: "forty",
  50: "fifty",
  60: "sixty",
  70: "seventy",
  80: "eighty",
  90: "ninety",
};

// Define the convertNumberToWords function
function convertNumberToWords(number) {
  // if number present in object no need to go further
  if (number in numbersToWords) return numbersToWords[number];

  // Initialize the words variable to an empty string
  let words = "";

  // If the number is greater than or equal to 100, handle the hundreds place (ie, get the number of hundres)
  if (number >= 100) {
    // Add the word form of the number of hundreds to the words string
    words += convertNumberToWords(Math.floor(number / 100)) + " hundred";

    // Remove the hundreds place from the number
    number %= 100;
  }

  // If the number is greater than zero, handle the remaining digits
  if (number > 0) {
    // If the words string is not empty, add "and"
    if (words !== "") words += " and ";

    // If the number is less than 20, look up the word form in the numbersToWords object
    if (number < 20) words += numbersToWords[number];
    else {
      // Otherwise, add the word form of the tens place to the words string
      //if number = 37, Math.floor(number /10) will give you 3 and 3 * 10 will give you 30
      words += numbersToWords[Math.floor(number / 10) * 10];

      // If the ones place is not zero, add the word form of the ones place
      if (number % 10 > 0) {
        words += "-" + numbersToWords[number % 10];
      }
    }
  }

  // Return the word form of the number
  return words;
}

console.log(convertNumberToWords(123));

```
Next.js and Docker configuration
Tags: nextjs, docker
Published: 2023-01-09 07:02:09

To configure a Docker container for a Next.js application, you will need to create a `Dockerfile` and a `docker-compose.yml` file.

Here is an example `Dockerfile` that you can use as a starting point:

```
FROM node:latest

WORKDIR ./app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD npm run dev

```

This `Dockerfile` starts from the `node:latest` base image, which is a latest version of Node.js. It then sets the working directory to /app and copies the `package.json` file to the container. It runs `npm install` to install the dependencies of the application. Finally, it copies the rest of the application code to the container and exposes the default Next.js port (3000) and runs the `npm run dev` command to start the application in development mode.

To build and run the container, you can use the following commands:

```
version: "3.3"

services:
  nextjs:
    ports:
      - 3000:3000
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/app
```

This `docker-compose.yml` file defines a single service called `nextjs`, which is built from the `Dockerfile` in the current directory. It exposes the container's port 3000 on the host's port 3000 and mounts the current directory and the node_modules directory as volumes in the container. This allows you to make changes to the code and have them reflected in the running container without having to rebuild the image.

To build and run the container, you can use the following commands:
```shell
$ docker-compose build
$ docker-compose up
```

This will build the service and start the container. You should then be able to access the Next.js application at `http://localhost:3000`.
Blink an LED v.2
Tags: microcontoroller, atmega128
Published: 2023-01-09 07:00:31

```
#define F_CPU 16000000L
#include <avr/io.h>
#include <util/delay.h>


int main(void)
{
	DDRB |= 0x0F;	// xxxx1111
	
	PORTB = 0x01;
	while (1)
	{	
		while (PORTB != 0x08) {
			_delay_ms(500);
			PORTB = PORTB << 1;
		}
		
		while (PORTB != 0x01) {
			_delay_ms(500);
			PORTB = PORTB >> 1;
		}		
	}
}
```

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

Easy
Lets build an email scraper in python that will scrape a bunch of emails from text and save them in a .csv file
Tags: python, webdev, programming, marketin
Published: 2023-01-09 06:58:25

Welcome to the Email Extractor-inator! This wacky Python program will turn your messy pile of emails into a neatly organized CSV file. Just follow these simple steps:

1. Copy and paste your string of email-filled gibberish into the input_string variable.

2. Sit back and watch as the Email Extractor-inator uses its trusty regex (regular expression) to pluck out all the emails like a chicken at a county fair.

3. The extracted emails will be stored in the emails list, ready to be written into a CSV file with a simple command.

4. BAM! Your emails are now organized and easy to access. No more digging through piles of paper or scrolling through a never-ending inbox.

Are you ready to try out the Email Extractor-inator? Here's the code:

```
import csv
import re

# input string containing emails
input_string = '''
Paste your string of emails here.
'''

# regex to extract emails
regex = r'[\w\.-]+@[\w\.-]+'

# extract all emails
emails = re.findall(regex, input_string)

# write extracted emails to a CSV file
with open('emails.csv', 'w') as csvfile:
    writer = csv.writer(csvfile)
    for email in emails:
        writer.writerow([email])

```

Give the Email Extractor-inator a try and see how it can revolutionize your email organization game!

If you don't know what to search for to scrape emails, [click here](https://www.google.com/search?q=%22web+designer%22+%22%40gmail.com%22-intitle:%22profiles%22+-inurl:%22dir/+%22+site:www.linkedin.com/in/+OR+site:www.linkedin.com/pub/&ei=V7a7Y-OyK6be4-EP_-GRsAc&start=0&sa=N&ved=2ahUKEwijus-Y8Ln8AhUm7zgGHf9wBHY4ZBDy0wN6BAgEEAQ&biw=1366&bih=625&dpr=1). It will redirect you to a Google search with a pre-filled query. You can modify the query to fit your needs. just `ctrl + A` and `ctrl + c` and paste in the `input_string` variable
How to deploy your App to Kubernetes in 14 seconds
Tags: kubernetes, webdev, productivity, opensource
Published: 2023-01-09 06:47:56

Sounds crazy, right? At the end of this article, I will prove with a video that this is possible. What we want to achieve is to see our code as fast as possible running in Kubernetes after we've pushed it to our GIT-Repository.

But let's first have a look at a traditional deployment:

➡️ Push your changes to the repository to trigger a build job
1) Buildcontainer starts and installs all requirements
2) Fetch the code on the Buildcontainer
3) Build the actual software
4) Build the Docker image
5) Push the Docker image
6) Trigger an update on Kubernetes (ArgoCD or similar)
7) Pull the new build Image
8) Run the new image and wait for the health check to come up.

Seems like a lot of work. This means a lot of time passing by and a lot of potential failures in this chain.

How about just keeping the essential steps:
➡️ Push your changes to the repository to trigger a webhook
1) **Fetch** the Code
2) **Build** the actual software
3) **Run** the Code.

That's exactly how [Kubero](https://github.com/kubero-dev/kubero) works. 

Kubero is an free and open-source PaaS for Kubernetes. It comes with a UI, API, and CLI and connects directly to your GIT repository. Therefore it is also possible to automatically start a preview instance within 14 seconds. 

But there are even more benefits: Kubero uses official maintainer images to build and run the code. No need to write and maintain a Dockerfile. 

The maintenance of the CI/CD pipeline is also eliminated since all these tasks are performed by Kubero. Kubero itself is automatically maintained as it is an [operator](https://operatorhub.io/operator/kubero-operator) with a single UI-Container.

But you might be wondering what happens when there are hundreds of pods running in production. Building the app for every running pod is not efficient. Thats why Kubero supports running pre built images too.

And finally the proof: 
![deploy code in 14 seconds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pwj4mkyevz7r6p1lw2a7.png)

{% embed https://www.youtube.com/watch?v=-_XcC_8cpis %}


![Kubero Pipelines](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehegjr1h4sl26c3w2tlb.png)