teleren/devto huggingface dataset:
Level Up Your API Security: Don't Let Hackers Be the Boss of Your Web App
Tags: beginners, api, tutorial, productivity
Published: 2023-02-24 19:55:34


**Welcome back!**

For today's post, I figured I would try a new approach using my favorite classic console, Nintendo, so join me as we start visualizing our web app as one of your favorite classic games.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/YRzMh5cKgmOyuTrtIj/giphy.gif">

You're the hero or heroine, smashing your way through levels, defeating bosses like a boss. You start feeling like the bosses aren't the main thing you need to worry about anymore, and suddenly you stumble upon the shapeshifting Terminator assassin, T100, lurking in the shadows, who is waiting to steal your data and damage your high score.

Here is where the API security comes in, and think of this as the power-up that helps you defeat the assassin, protect your data and learn some ways to level up your API security game.

First, use **encryption** like Link's shield in The Legend of Zelda, you know dude with all green and rides a horse looking serious like this:
<img width="100%" style="width:100%" src="https://media.giphy.com/media/3nhfE47B5flIwdIGqk/giphy.gif">

You get the point, now the use of encryption keeps your data safe from snooping eyes, like a secret dungeon hidden deep within the game.

Next, you can implement **access controls** that help you keep certain users or apps out of your API, think of a locked door which is pretty typical in a classic dungeon-like game. Goal is to find the key, and you will gain access to the hidden treasure area. 

Another part of the holy API grail cup is **rate limiting**, like Donkey Kong throwing barrels at you as you climb to the top. Rate limiting helps you prevent one user or app from dominating all your API resources, like how Donkey Kong tries to stop you from getting to the next level, but you are just a master at dodging his barrels - a piece of cake, right? 

<img width="100%" style="width:100%" src="https://media.giphy.com/media/2kLSK2r8nLRnEePTBg/giphy.gif">

Setting your rate limits is like timing your jumps in the game. Yeah Kong, we know the secret!

Lastly, don't forget about monitoring and logging.

**Monitoring and logging** provide visibility on your API traffic, so you spot any suspicious activity, like Solid Snake sneaking around undetected. 

<img width="100%" style="width:100%" src="https://media.giphy.com/media/gEY69DiqZDolO/giphy.gif">


Just make sure you're logging everything you need to, like the codec messages in Metal Gear Solid.

Remember how Solid Snake uses a codec device to communicate with other characters and gather intel on enemy activity? Similarly, logging everything in your API can help you gather important information about user activity and identify potential security threats.

And just as Solid Snake must be vigilant and aware of his surroundings, you must monitor your API traffic can help you stay on top of any suspicious activity and respond quickly to any threats.

Hope you learned something fun! Until next time.
How to duplicate a browser tab
Tags: productivity, shortcut, browser
Published: 2023-02-24 19:53:59

---
title: How to duplicate a browser tab
published: true
description: Duplicate browser tab shortcut
tags: 
 - productivity
 - shortcut
 - browser
cover_image: https://ik.imagekit.io/gncpb3rwf/posts/richy-great-MAYEkmn7G6E-unsplash_V1sYGqtWW.jpg
---


I'm going to show you how to duplicate a browser tab that you are currently focused on into another tab in the same window.

## Right Click

![Right click on the tab](https://ik.imagekit.io/gncpb3rwf/posts/Screenshot_2023-02-23_at_00.30.25_8xgcBc9sG.png)

The first method is to just right-click on the tab that you want to be duplicated in another tab, I've tested this on a MacOS machine and it works on the following browsers:

- [Edge](https://www.microsoft.com/en-us/edge)
- [Brave](https://brave.com/)
- [Chrome](https://www.google.com/chrome/)
- [Safari](https://www.apple.com/safari/)
- [Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/)

## Keyboard Shortcut

Based on the official reference from some of the browsers [below](#references), there's no keyboard shortcut for `Duplicate Tab` on MacOS. But I found a _hacky_ way to do this:

1. Make sure you're in the tab that you want to duplicate.
2. Press `Cmd + L` to focus and highlight the _Address Bar_.
3. Press `Cmd + Return` or `Cmd + Enter` to open the website in a new background tab.

In short:

1. Press and hold `Cmd`.
2. Press `L`.
3. Press `Return` or `Enter`.

## Conclusion

In conclusion, duplicating a browser tab is very useful when developing a web application, but a keyboard shortcut is more conventional.

I hope this is useful for you, let me know if I missed something in the comments.

## References

- [Microsoft Edge Keyboard Shortcut](https://support.microsoft.com/en-us/microsoft-edge/keyboard-shortcuts-in-microsoft-edge-50d3edab-30d9-c7e4-21ce-37fe2713cfad#ID0EBD=Windows)
- [Safari Keyboard Shortcut](https://support.apple.com/guide/safari/keyboard-and-other-shortcuts-cpsh003/mac)
- [Mozilla Firefox Keyboard Shortcut](https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly)
- [Chrome Keyboard Shortcut](https://support.google.com/chrome/answer/157179)
- [Brave Keyboard Shortcut](https://support.brave.com/hc/en-us/articles/360032272171-What-keyboard-shortcuts-can-I-use-in-Brave-)
How to Optimize Robotic Process Automation for Maximum Efficiency
Published: 2023-02-24 19:47:05

Robotic Process Automation (RPA) is a powerful tool for companies looking to streamline their processes and increase the efficiency of their operations. With the right implementation, RPA can help businesses save time, money, and resources by automating mundane and repetitive tasks. However, ensuring that RPA is optimized for maximum efficiency is important. Here are a few tips on how to optimize RPA for maximum efficiency.

Before implementing RPA, it is important to define the goals you want to achieve. This will help you determine which processes should be automated and how they should be automated. It is also important to consider the cost-benefit ratio of automation. You may want to concentrate on low or high priority tasks or a mix of both;

Numerous RPA platforms are available, so it is important to make an informed decision when choosing the right one for your organization. Different RPA platforms offer different features and capabilities, so it’s a good idea to research the options available and select the one that best meets your requirements

Automating the right processes can lead to more efficient operations and save your organization time, money and resources. When you automate the wrong processes, you will face inefficiencies, so it is important to first identify which processes are suitable for automation, and then schedule a project that will help improve your company’s efficiency.

Once you have fully implemented your RPA platform, testing and monitoring the automation is important to ensure it is running as expected. This will help you identify any issues and make sure the automation is running at its optimal level.

Adapt and Improve: As technology evolves, it is important to adapt and improve the automation process. This will ensure that the automation remains relevant and continues to be effective.

By following these tips, your company can optimize your RPA for maximum efficiency. This will help you save time, money, and resources while improving the quality of your operations.

Take a look at [ElectroNeek](https://electroneek.com) to fulfill all your automation requirements

You can also join our community forum [HERE](https://forum.electroneek.com)
Why your manager may not have an engineering background
Tags: devops, todayilearned, career, management
Published: 2023-02-24 19:42:22

{% youtube _BkyfXXY-oU %}

As surprising as it is, many of the best managers that leadership coach Lena Reinhard has encountered aren't engineers themselves. Management isn't all about coding, at it's core it's about being a leader and connecting to your employees. This clip comes from our recent Interact panel about treating devs like human beings hosted by Conor Bronsdon, [check it out here.](https://www.youtube.com/watch?v=tYE36ZcI2p0&t=0s)

### Want to cut code-review time by up to 40%? Add estimated review time to pull requests automatically!
*gitStream is the free dev tool from LinearB that eliminates the No. 1 bottleneck in your team’s workflow: pull requests and code reviews. After reviewing the work of 2,000 dev teams, LinearB’s engineers and data scientists found that pickup times and code review were lasting 4 to 5 days longer than they should be.* 

*The good news is that they found these delays could be eliminated largely by adding estimated review time to pull requests!*

### Learn more about how gitStream is making coding better [HERE](https://linearb.io/blog/why-estimated-review-time-improves-pull-requests-and-reduces-cycle-time/?utm_source=Substack%2FMedium%2FDev.to&utm_medium=referral&utm_campaign=gitStream%20-%20Referral%20-%20Distribution%20Footers).

![Start using gitstream today!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg1l6hxt134px501bf7d.png)
Javascript Event Loop
Tags: javascript, programming, beginners
Published: 2023-02-24 19:13:12

The event loop in JavaScript is in charge of managing asynchronous events such as closures, promises, and timers. The event loop continues indefinitely, scanning the event queue for new events and processing them one by one. This enables JavaScript to execute numerous jobs at the same time without interfering with the primary process.

Here's an illustration of how the JavaScript event loop works:

```
console.log('Starting'); // First to log

setTimeout(() => {
  console.log('First Timeout');  // Forth to log
}, 1000);

setTimeout(() => {
  console.log('Second Timeout');  // Third to log
}, 500);

console.log('Ending');  // Second to Log
```

Running this code results in the following:

The result of the console.log('Starting') line is "Starting," and it is performed simultaneously.

There are two calls to setTimeout methods. When a certain period of time has elapsed, these methods submit a callback code to be performed. One response will run in this scenario after 1000 milliseconds (1 second), and the other after 500 milliseconds. (0.5 seconds).

The output of the console.log('Ending') line is "Ending," and it is performed synchronously.

As soon as the event cycle begins, it scans the event queue for any outstanding events.

The callback code for the second setTimeout function, which has a delay of 500 milliseconds, is the first event in the list. The result of this return function's execution is "Second Timeout."

The event loop keeps checking the event list to see if there are any outstanding events.


The callback method for the initial setTimeout function, which has a delay of 1000 milliseconds, is the next event in the list. The result of this return function's execution is "First Timeout."


The event loop keeps checking the event queue to see if there are any outstanding events, but when there are none, it ends.

```
Starting
Ending
Second Timeout
First Timeout
```

As you can see, the callback functions of the setTimeout functions were performed in the order in which they were filed rather than the order in which they were invoked. This is because the event loop is in charge of controlling how asynchronous code is executed, ensuring that it proceeds in the right sequence and does not obstruct the main process.
Introduction and Installation
Tags: go
Published: 2023-02-24 19:08:22

**_What is golang ?_**
Golang (Go) is a statically and compiled language created by google.
Go is mostly used to develop highly scalable and fast web apps.

**_Benefits of using go for your rest api_**

There are so many programming languages to choose from when you want to make a rest api.Python(flask),node or even java. However go has some benefits which makes it a good choice whenever you are making a rest api.

**some of the benefits of using go:**

1. Quick compilation and execution speed.

2. its very easy and fast to learn -go has a very simple 
   syntax.This makes it very easy to learn.

3. Lightweight goroutines that support concurrency.

4. Extensive and very well documented built-in libraries.


**_Why learn Golang?_**
Now you still might be asking why should I learn Golang with all the other alternatives out there.
list of some of the pros of the Go programming language:

_Simple syntax_ - Go has concise and straightforward syntax that makes writing readable and maintainable code easy.
Compiled language
_Static linking_ - The compiler supports static linking which means you can statically link your project into one massive binary and then simply deploy it to the cloud or a server.
_Open source_ - Go is open-source so you can read the source code and contribute to the repository.

**_Installing / Updating Go_**
If you’re updating a previously installed Go version, you must first delete the older one:

`sudo rm -r /usr/local/go`
Download the latest version of Go archive from https://golang.org/dl/ and extract it:

`sudo tar -C /usr/local -xzf go1.7.1.linux-amd64.tar.gz`
Note: some people use the Go version manager (GVM) to install and set up Go, a tool similar to NVM which I highly recommend for Node.js, but for Go I prefer to set up everything myself.

Next, set the PATH environment variables by adding the following to .bashrc:

`export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go`
Here I use home/neeraj/go as my workspace (which is $HOME/go), but feel free to change it according to your preference.

And, create your workspace:

`mkdir -p ~/go/src/github.com/neeraj`

[Golang Study Point](https://www.linkedin.com/company/go-discussions/)

![Go language](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5whr46rd8zdhd8ue1ahw.png)
Python Recursion Function Tutorial
Tags: programming, python, tutorial, codenewbie
Published: 2023-02-24 18:57:36

Recursion is a technique in programming where a function calls itself repeatedly until a certain condition is met. Recursion is an important concept in many programming languages, including Python.

## How Recursion Works

Recursion works by breaking down a problem into smaller subproblems until a base case is reached. The base case is a condition that, once met, stops the recursion and returns a value.

Each recursive call makes progress toward the base case by reducing the problem to a smaller size. Eventually, the problem becomes small enough to solve directly, and the function returns a value that is used to solve the larger problem.

## Find Factorial Of a Number [Recursion In Python](https://www.programdoc.com/python/recursion-function)

A classic example of recursion is the calculation of a factorial. A factorial is the product of all positive integers up to a given number. 
For example, the factorial of 4 is 4 x 3 x 2 x 1 = 24.

The factorial function can be defined recursively as follows:

```py
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n - 1)
``` 

In this function, we check if the input parameter `n` is equal to 0. If it is, we return 1, as the factorial of 0 is 1. If `n` is not 0, we return `n` multiplied by the factorial of `n - 1`.

Let's test this function with some sample inputs:

```py
print(factorial(0)) # 1
print(factorial(5)) # 120
print(factorial(10)) # 3628800
``` 
Output:
```py
1
120
3628800
``` 


## Explore Other Related Articles
[Python Lambda Function Tutorial](https://dev.to/max24816/python-lambda-function-tutorial-1o30)
[Python If, If-Else Statements Tutorial](https://dev.to/max24816/python-if-if-else-statements-tutorial-2g4k)
[Python Function Tutorial](https://dev.to/max24816/python-function-tutorial-5fh0)
[Python break and continue tutorial](https://dev.to/max24816/python-break-and-continue-tutorial-57kj)
[Python While Loop tutorial](https://dev.to/max24816/python-while-loop-tutorial-463f)
Dank Owl - custom themes in Warp terminal and neovim
Tags: warp, neovim, themes
Published: 2023-02-24 18:52:57

My [warp](https://github.com/warpdotdev/themes) [themes](https://github.com/danieluhl/dotfiles-3/tree/main/public/warp/themes)

These go in your `~/.warp/themes` directory - I have mine symlinked to a clone of the dotfiles referenced above (see `setup.sh` for details).

I use the font [Dank Mono](https://philpl.gumroad.com/l/dank-mono#:~:text=A%20typeface%20designed%20for%20coding,diacritics%20covering%20most%20European%20languages) but you can switch the font. If you do want Dank Mono in all it's glory you'll want to run it through the [nerd-font patcher](https://github.com/ryanoasis/nerd-fonts#option-4-homebrew-fonts).

It's not too bad just pay close attention to the instructions.


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



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


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


# UPDATE:
Made a quick script to pull the top deep dream AI generated image into my theme: https://github.com/danieluhl/random-warp-bg

This runs in a terminal startup script that also pulls my latest dotfiles: https://github.com/danieluhl/dotfiles-3/blob/main/public/login.sh

Which gets kicked off here:
https://github.com/danieluhl/dotfiles-3/blob/main/public/zshrc#L126


# UPDATE 2:
you can now run

`npx get-warp-bg --theme [theme-folder]`

Passing your theme directory, e.g. for `~/.warp/themes/night_owl` you would run `npx get-warp-bg --theme night_owl`
HOW TO DEPLOY AZURE COGNITIVE SERVICES
Tags: webdev, cloud, azure
Published: 2023-02-24 18:49:50

**WHAT IS AZURE COGNITIVE SERVICE**
Azure Cognitive Services brings AI within reach of every developer and data scientist. With leading models, a variety of use cases can be unlocked. All it takes is an API call to embed the ability to see, hear, speak, search, understand, and accelerate advanced decision-making into your apps.


They are available through REST APIs and client library SDKs in popular development languages,Azure Cognitive Services are artificial intelligence (AI) cloud-based services that assist developers in integrating cognitive intelligence into applications without needing specific AI or data science expertise.

**CATEGORIES OF AZURE COGNITIVE SERVICES INCLUDE**
--- Vision
--- Speech 
--- Language
 --- Decision 
--- Azure OpenAI Service

you can deploy any of the services available based on the task you need to complete,but for the sake of this post we'll be using the language service to translate.

 STEP 1.
login to your azure and search cognitive service


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

STEP 2

under Language, click on Create under Translator

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


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

STEP 3
Fill out the neccessary fields then review and create


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


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

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

go to resource


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

STEP 4
Now you can translate from any language you want

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ybe2wqzgcgcfp0th9952.png)
Python Lambda Function Tutorial
Tags: python, tutorial, codenewbie, programming
Published: 2023-02-24 18:47:13

Python lambda function is a small **anonymous function** that can have any number of arguments but can only have **one expression**. It is defined using the keyword `lambda` followed by the parameters and the expression. Lambda functions are often used for short and simple operations that do not require a separate function definition.

## Lambda Function Syntax

```py
lambda argument1,..,argumentN: expression
``` 

## Simple lambda function

Here is an example of a simple lambda function that adds two numbers:

```py
add = lambda x, y: x + y
print(add(2, 3)) # Output: 5
``` 

In this example, the lambda function `add` takes two arguments `x` and `y`, and returns their sum.

## [Python Lambda Function using map and filter](https://www.programdoc.com/python/lambda)

### Lambda function in a filter()

Here is an example of using a lambda function with the `filter()` function to filter out even numbers from a list:

```py
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
even_numbers = list(filter(lambda x: x % 2 == 0, numbers))
print(even_numbers) # Output: [2, 4, 6, 8, 10]
``` 


### Lambda function in a map()

Here is an example of using a lambda function with the `map()` function to square each element of a list:
```py
numbers = [1, 2, 3, 4, 5]
squared_numbers = list(map(lambda x: x**2, numbers))
print(squared_numbers) # Output: [1, 4, 9, 16, 25]
``` 




## Explore Other Related Articles
[Python If, If-Else Statements Tutorial](https://dev.to/max24816/python-if-if-else-statements-tutorial-2g4k)
[Python Function Tutorial](https://dev.to/max24816/python-function-tutorial-5fh0)
[Python break and continue tutorial](https://dev.to/max24816/python-break-and-continue-tutorial-57kj)
[Python While Loop tutorial](https://dev.to/max24816/python-while-loop-tutorial-463f)
[Python For Loops, Range, Enumerate Tutorial](https://dev.to/max24816/python-for-loops-range-enumerate-tutorial-20a2)