teleren/devto huggingface dataset:
Commit Changes to a New Branch with Git
Tags: git, github, learning
Published: 2023-07-27 16:34:05

To commit local changes to a new branch with git, we can use the following three steps:

## Create a new branch

```bash
git switch -c new-branch
```

This will leave our current branch unedited, create a new branch called new-branch, and we still have our uncommitted changes. It’s the parameter -c that tells git to create a new branch with a selected name.

We can use `git branch -a` command to verify that the new Git branch to be pushed to the remote GitHub repo was indeed created locally.

## Set upstream repos

```bash
git push -–set-upstream origin new-branch
```

With a new branch created, the `-–set-upstream` switch must be run the first time a push is performed. This step tells the new branch which remote repository to use every time it synchronizes its commit history.

## Add, Commit, and Push

```bash
git add .
git commit -m "First commit on new-branch"
git push origin
```

Once the remote GitHub repository is set as the upstream target for the new Git branch, push and pull operations can be performed normally with a simple `git push origin` command.
Security: What is "Privilege Escalation"?
Tags: cloud, security
Published: 2023-07-27 16:12:15

---
cover_image: https://unsplash.com/photos/mT7lXZPjk7U/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNjkwNDc0MzA0fA&force=true&w=1920
description: Privilege escalation: A crucial security term explained through an everyday example. Discover how granting limited access can lead to unauthorized privilege escalation in cloud security. Learn about potential risks and implications.

---

Privilege escalation is a common term in the Security industry.

Let's illustrate what it means through an example.

Imagine having a key to your house and you give it temporarily to a plumber, so that they can fix something while you are on vacation.

Your intent is to give temporary access to your house to the plumber. But the locksmith visits a locksmith and makes a copy of the key. Essentially, evading the temporary restriction of accessing your house within a limited timeframe.

The same concept can be applied to software security. It's particularly relevant in Cloud security and giving access to some service to access your Cloud account (e.g. temporary access to assume an IAM role within your AWS account).

If the service is limited to just access resources, but not create new resources - everything is fine and security works as intended. But if the limited access allows the service to create new IAM roles (essentially generate new keys at the locksmith), the service can later access your Cloud resources without your permission. Essentially, doing Privilege Escalation.
Switch from live to mock in seconds with Mocker
Tags: javascript, testing, vscode, kubernetes
Published: 2023-07-27 16:12:01

Today I’ll be talking more about [Mocker](https://marketplace.visualstudio.com/items?itemName=skyramp.mocker-vscode), our VS Code extension that simplifies service mocking in Kubernetes clusters.


Let’s say you’ve already used Skyramp to deploy your system under test in the cluster, which includes your live payment service. Before Mocker, changing from the live payment service in your cluster to a mock was a complex and time-consuming process. You had to create a new microservice called payment-mock, using the same API spec as the original. This involved writing a server stub to provide the desired response. Then, you had to deploy the mock service into the cluster, and update the networking to disconnect the existing payment microservice. If you wanted to change values, you had to rebuild the microservice and update it accordingly.


Mocker allows you to focus solely on the external configuration, while it takes care of all the internal cluster management through a single worker.


Simply connect your cluster to Mocker.

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


Effortlessly modify the return values in your mock configuration.

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


Then hit deploy mocks. 

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


Mocker handles all the heavy lifting behind the scenes, including managing gRPC communications. There’s no Kubernetes expertise required.


That’s it!  You’ve switched from live to mock services in just seconds, all within your IDE. Doing it is probably faster than reading about it in this blog!


Coming soon – Tester, the perfect test client complement to Mocker. Tester makes it easy for devs to go beyond unit testing and generate and run complex scenarios for comprehensive services testing. Sign up [here](https://www.skyramp.dev) to be among the first to hear when we add this new toolkit capability!
69 berufliches Vorwärtskommen: Wie man ein Karriere-Weg-Helfer sein kann.
Tags: deutsch, career, motivation, discuss
Published: 2023-07-27 16:11:00

Moin Moin,

unabhängig davon, ob es Leute gibt die anderen auf dem Karriere-Weg helfen oder nicht, ist wichtig zu wissen wo man selbst steht. Es war, für mich jedenfalls, interessant darüber nachzudenken.


Es sei noch anzumerken, dass in meinen Überlegungen, Leute ausgeschlossen waren, die grundsätzlich bereit wären zu helfen, es jedoch gerade nicht können.

Nun, wie können wir Karriere-Weg-Helfer sein. Ich denke, dass diese Hilfe verschiedene Ausgestaltungen haben kann, ich gehe daher nicht in alle Einzelheiten. 

- Ein Austausch von Erfahrungen kann helfen, 
- Fragen beantworten, 
- Bildungsangebote
- Lehrmeisterschaft  ( „Mentoring“ )
- …

Ich denke, dass für diejenigen, die Helfen möchten, erstmal wichtig ist, dass sie helfen und anschließend wie. Das ergibt sich auf ganz natürliche Weise, denke ich.

1) Habt ihr noch Ergänzungen dazu, wie man anderen auf ihrem Karriere-Weg helfen kann?


Lass uns mittels Kommentaren austauschen.

Beste Grüße,
Mustafa

Oder auch mittels E-Mail: mustafa.kevin.dwenger@posteo.de
Betreff: Austausch
javascript functions
Published: 2023-07-27 16:02:31

JAVASCRIPT FUNCTION :is the way of performing various task by specifying a structured javascript program  and also declaring a meaningful synthax inorder to give out put


DECLARING FUNCTION: happen after a specification and discriptive syntax where you can provide the returning values or names due to the function has made
eg: function name(){
console.log("michael")}

CALLING FUNCTION:this used when we need to specify a function name or data value inorder expect the returning 
eg:function name(){
console.log("michael")}
name();


FUNCTION PARAMETERS: this happen when in getting return or what to receiceve in function you have to set a parameter name value to identify the value to pass through
eg:function sale(name) {
    console.log("type car = " + name + ":)");
}
let name = (" benz ");

sale(name);


ADD TWO NUMBERS:this when your function has two parameters(a,b)to passed though and various agreement which are use to call function where console.log determine 
which operators we can use to get our returns 

function number(a,b) {
    console.log(a + b);
}
number(3,9);
number(8,51)


FUNCTION RETURN: when you make a function call and this is used to retuns the values and when nothing to return its shows undefined

function number(a,b){
return a+b;}

let number1 =8;
let number2 =7.8;

let sum = number(number1,number2);
console.log("sum equal to" + result)
Basics Of Cryptography
Published: 2023-06-19 06:36:24


### What is Cryptography?

![cryptography](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bh8ew28hqdvu25mnuyyv.jpg)

Imagine you're transferring money through online banking. As your sensitive information, including your account number, password, and financial transactions, travels through various routes and networks, ensuring its security becomes paramount. This is where cryptography steps in.

Cryptography plays a vital role in securing transactions. It involves the encryption of data associated with the transaction, ensuring that only the intended recipient, usually the bank, can decrypt and process the transaction.

But what exactly is **encryption**? In simple terms, encryption is the process of converting information into a format that is unreadable by humans. By employing complex mathematical algorithms, cryptography transforms the data into a scrambled form called ciphertext. This ciphertext can only be understood and deciphered by those who possess the appropriate decryption key.


There are several type of cryptography and here is commonly  used:-

- **Symmetric-key cryptography**- This cryptography uses one single key for encryption and decryption process.
Same key is used from the both end (sender and receiver).This cryptography is easy but require secure key distribution. Because as the same key is used in both end if anyone who have the key, can decipher the information.
Symmetric-key algorithms include Advanced Encryption Standard (AES)and Data Encryption Standard (DES).


   
- **Asymmetric-key Cryptography** - This cryptography involves two key, public key and private key. public key is widely distributed. sender will use public key to encrypt the information and receiver(owner) decrypt information with private key. This process remove requirement of secure key distribution.
The most popular asymmetric algorithm is the RSA algorithm.



- **Hash functions** - Hash functions are cryptographic algorithms that take an input (message or data) and produce a fixed-size string of characters, its unique representation of the original input. Hash functions are commonly used to verify the integrity of data, as even a slight change in the input will result in a completely different hash output.
Examples of hash functions include Secure Hash Algorithm (SHA) and Message Digest Algorithm (MD5).

By understanding the fundamentals of cryptography and its various types, we can appreciate its vital role in securing our sensitive data and maintaining the confidentiality and integrity of our transactions.
maximum salary of the employee in each department
Tags: sql, interview, oracle
Published: 2023-07-27 15:58:33

tables

emp


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

dept


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


query and output 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jkj8gqtls9jvytdqidwu.png)
QuickSelect Algorithm - Find the Kth Smallest Element in an Array
Tags: algorithms, learning, python, leetcode
Published: 2023-07-27 15:57:54

## What is QuickSelect?

Quickselect is an algorithm for finding the kth smallest element in an unordered list. It's similar to quicksort.

Quickselect works by choosing a "pivot" element and partitioning the data into two groups: one group with elements smaller than the pivot and another group with elements larger. Unlike quicksort, which recursively sorts both groups, quickselect only focuses on the group where the target element should be. This makes it faster on average, although it can be slower in the worst case.

Quickselect is usually done directly on the list, and besides finding the kth smallest element, it also sorts part of the data.

## Complexity Analysis

- Time complexity: {% katex inline %} O(n) {% endkatex %} on average, {% katex inline %} O(n^2) {% endkatex %} in the worst case

  {% katex inline %} T(n) = T(n/2) + O(n) = O(n) + O(n/2) + O(n/4) + ... + O(1) = O(n) {% endkatex %}

- Space complexity: {% katex inline %} O(n) {% endkatex %}

## Python Implementation

The algorithm can be implemented in Python as follows:

```python
class Solution:
    def findKthSmallest(self, nums, k):
        if not nums or k < 1 or k > len(nums):
            return -1
        return self.partition(nums, 0, len(nums) - 1, k - 1)
        
    def partition(self, nums, start, end, k):
        # start <= k <= end
        if start == end:
            return nums[k]
            
        left, right = start, end
        pivot = nums[(start + end) // 2]
        while left <= right:
            while left <= right and nums[left] < pivot:
                left += 1
            while left <= right and nums[right] > pivot:
                right -= 1
            if left <= right:
                nums[left], nums[right] = nums[right], nums[left]
                left, right = left + 1, right - 1
                
        # left is now bigger than right
        if k <= right:
            return self.partition(nums, start, right, k)
        if k >= left:
            return self.partition(nums, left, end, k)
        
        return nums[k]
```

## Understanding the Partitioning Choice in Quickselect/Quicksort: Why using `nums[left] < pivot` and `nums[right] > pivot`?

The partition in quickselect/quicksort is designed to accommodate the pivot value by allowing it to be placed either on the left or right side. This flexibility ensures that when a number equals the pivot value (`nums[i] == pivot`), it can be placed on either side of the partition.

The reason for partitioning the array in this manner is to prevent a situation where all the elements in the array, such as `[1, 1, 1, 1, 1, 1]` (containing identical elements), end up on a single side. By not assigning the case of `nums[i] == pivot` to either the left or right side during partitioning, the results of the partitioning process can be somewhat balanced.
JS Array Reduce - Basics to Advanced and custom Reduce Method 🔥
Tags: javascript, beginners
Published: 2023-07-27 15:47:06

{% youtube Ji7CjnP66YM%}



Initially thought of writing this content but found out later, it's a lot to jot down so ended up recording the video, LOL(for the first time).😄 

Ps: Please don't expect it to be a short video, it is 28mins long but it contains everything for you to understand from very basic understanding to getting used to it really well.

I hope it clears all your doubts around it and if not feel free to reach out in the comment section down below. Cheers!

Keep learning, keep rolling!! 🛼 🙌
Personalizing MUI Stepper
Tags: react, materialui, styling
Published: 2023-07-27 15:42:30

Interested on how to customize your MUI Stepper? 

```
<Stepper activeStep={activeStep}>
  <Step
    sx={{
      '& .MuiStepLabel-root .Mui-completed': {
        color: 'green', // circle color (COMPLETED)
      },
      '& .MuiStepLabel-label.Mui-completed': {
        color: 'black !important', // label color (COMPLETED)
      },
    }}
  >
    <StepLabel>Personal Details</StepLabel>
  </Step>
  <Step
    sx={{
      '& .MuiStepLabel-root .Mui-completed': {
        color: 'green', // circle color (COMPLETED)
      },
      '& .MuiStepLabel-label.Mui-completed': {
        color: 'black !important', // label color (COMPLETED)
      },
    }}
  >
    <StepLabel>Personal Details</StepLabel>
  </Step>
</Stepper>
```
from this default view


![Default style](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4eusgyzznz1qmbdqr4q.png)


to this


![New Style](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eomqqu95ym0w9r8hhzfj.png)
Azure Functions: V2 Python Programming Model Example
Tags: azurefunctions, python, azure
Published: 2023-07-27 15:34:16

Prerequisites:
Before we begin, make sure you have the following 
prerequisites set up:
1.Visual Studio Code installed on your machine.
2.Azure Functions Core Tools installed globally.
3.Azure Functions Extension for Visual Studio Code installed.

after installing the above prerequisites go to visual studio code and in the left hand side bar click on azure icon it will ask you to sign in to you azure account.after successfull login you will be able to see local workspace at the left hand side bar 

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

you will able to see workspace 

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


after this create new project 
you will be prompted to** select programming language
python v2 programing model.**

if you are asking 

- Http Trigger 

- Time Trigger 

- Azure Blob Storage

- Azure Cosmos Db Trigger 
etc 

select for any change in the above cases your function need to call select that particular trigger 


you will get the following files after successful creation of function 


1. function_app.py 
2. host.json
3. local.settings.json
4. requirements.txt 


here make sure your local settings are like env variables in python these wont be deployed when we deploy this to azure functions , these variables we need to defines in app settings when deployed .

create function app code in function_app.py and all the requirements in requirements now you can test the changes locally.

after sucessfully testing the changes we can directly deploy from in the same local workspace to deploy app.
Whatcha Watchin'? 👀📺
Tags: watercooler
Published: 2023-07-27 15:31:11

Hey, let's switch gears today and give ourselves a break from interview prep and coding chatter. What shows are ya'll watching right now? "Futurama," "Based on A True Story," "Justified"? Has anyone seen "Kevin Can F**k Himself"? 

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
Learn More About JSON.stringify & JSON.parse Methods
Published: 2023-07-27 15:15:26

 
 
JSON.stringify() is method by which you can convert javascript object or array in JSON string.
Is JSON.stringify methods takes only one parameter? The answer is NO.
syntax : `JSON.stringify(value, replacer, space)`
What is value? Which can be array or object.
 Mostly we used this single parameter.But remaining two parameters are also important.
**What is replacer?** Replacer can be function or array we can use it according to our needs. 
By using replacer function we can modify key value pairs before final output. 
Here replacer function takes two arguments one is key and another is value.

Let's see example:

```

const student = {
    name: "Shubham",
    email: "shubham123@gmail.com",
    password: "shubham1234"
}

function replacer(key, value) {
    if (key === "password") {
        return undefined;
    }
    else if (key === "email") {
        return "shubham1122@gmail.com"
    }
    else {
        return value
    }
}
const jsonObj = JSON.stringify(student, replacer, 10)
console.log(jsonObj)

OUTPUT-
{
          "name": "Shubham",
          "email": "shubham1122@gmail.com"
}
```
We know that stringify function only return values which are not undefined. That's why in final output password key is not present.

**replacer act as array** which specifies which key value pairs should display in final output

```

const student = {
    name: "Shubham",
    email: "shubham123@gmail.com",
    password: "shubham1234"
}

const replacer = ["name", "email"]

const jsonObj = JSON.stringify(student, replacer, 10)
console.log(jsonObj)

OUTPUT-
{
          "name": "Shubham",
          "email": "shubham123@gmail.com"
}

``` 
This parameter usually null if we  don't want any changes in final output.
Last parameter is space which specifies indentation space which improves the readability which can be maximum 10.

---
JSON.parse() method is used to convert JSON string into object or array. 
JSON.parse() method takes two parameters.
Syntax-`JSON.parse(string, reviver)`

Means first parameter is JSON string but we are not aware about second parameter.
Because second parameter is optional but what it does?
This is a function which is used to transform actual key value pairs before final output. This function takes two arguments one is key and another is value and this function will apply on each key value pair.
Ex:

```
const user = `{
    "name": "Shubham",
     "age":25,
     "location":"Pune" 
 }`

const reviver = (key, value) => {
    if (typeof (value) === 'number') {
        return value * 2
    }
    else {
        return value;
    }

}
const result = JSON.parse(user, reviver)
console.log(result)
OUTPUT-{name: 'Shubham', age: 50, location: 'Pune'}
```
Asking how can I become better
Tags: ai, machinelearning, python
Published: 2023-07-27 14:47:54

_That will be a short article._

To become a good Python Freelance dev, I'm searching to interview some CTOs or founders of companies in the AI or Data Science domains.

**For example, I ask them:**
* to talk about their activity and job,
* what are their expectations when they work with a freelance dev,
* talk about good and bad experiences with a freelance dev,
* the quality and skills they think are essential for a freelance dev.

It's very interesting to share a moment with these persons who take some of their time to answer me and help me in my journey to become a great Python Dev in AI domains.

This habit will be certainly a game changer in my progression and I think we should do it sometime in our career.

And you, how do try to be better?
How did Slack’s failure as a video game company impact its product?
Tags: programming, learning, architecture, history
Published: 2023-07-27 14:27:47

Slack was born out of a failed video game company called Tiny Glitch. The team worked on Tiny Glitch for three years before scrapping it.

During this time, they had built an internal communication tool built around an open source protocol called IRC.

This internal communication tool was the inspiration for Slack. The team wrote Slack from scratch, but their DNA as a video game company is still present.

Keith Adams, the chief architect of Slack, gave a great talk called “How Slack Works”. Below is a screenshot from that clip. You can view the full clip [here](https://askadev.joinperch.com/q/how-did-slacks-failure-as-a-video-game-company-impact-its-product-e959992a).


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