teleren/devto huggingface dataset:
Automate VS Code extensions setup across profiles
Tags: powershell, productivity, vscode
Published: 2023-03-19 09:18:47

## Motivation

I now work with Visual Studio Code for several years in many different workloads:
- Azure scripting in Azure CLI and PowerShell
- .NET development
- Python development
- Go development
- Bash scripting
- ...

With that I collected a number of extensions in Visual Studio Code - before writing this article : 53 - which makes startup of VS Code slow, especially when I already have a lot of going on on my machine and much more so with the machine behind the corporate let-inspect-just-everything proxy.

When learning about [VS Code profiles](https://code.visualstudio.com/docs/editor/profiles) I thought that I could create an utility that helps me setup extensions tailored to my various editing workloads.

## Prerequisites

I did not yet figure out how to manage profiles programmatically, hence before running the script the profiles touched by the script need to be created first:

![Visual Studio Code profiles that need to be created before running the sample script](https://raw.githubusercontent.com/KaiWalter/automate-posts/main/images/vscode-profiles.png)

## Automation Script

This bare bone script (no checkings, no safety nets) is capable of removing installed extensions on all profiles specified and then install extensions for those profiles:

```PowerShell
param(
    [string] $ProfilePattern = ".*",
    [switch] $Clear,
    [switch] $Install
)

$config = @{
    "Default" = @("humao.rest-client")
    "pwsh"    = @("ms-vscode.powershell")
    "py"      = @("ms-python.python")
    "az"      = @("humao.rest-client", "ms-vscode.azure-account", "ms-vscode.azurecli")
    "dotnet"  = @("humao.rest-client", "ms-dotnettools.csharp")
}

if ($Clear) {
    foreach ($p in ($config.Keys | ? { $_ -match $ProfilePattern })) {
        Write-Host "clear profile" $p
        code --profile $p --list-extensions | % { code --profile $p --uninstall-extension $_ --force }
    }
}

if ($Install) {
    foreach ($p in ($config.Keys | ? { $_ -match $ProfilePattern })) {
        Write-Host "install profile" $p "extensions"
        foreach ($e in $config[$p]) {
            code --profile $p --install-extension $e --force
        }
    }
}
```

### Usage

| | |
| --- | --- |
| `setupVSCodeExtensions.ps1 -Clear` | remove extensions for all specified profiles |
| `setupVSCodeExtensions.ps1 -Install` | install extensions on all specified profiles |
| `setupVSCodeExtensions.ps1 -Clear -Install` | remove and then install extensions on all specified profiles |
| `setupVSCodeExtensions.ps1 -Clear -Install -ProfilePattern "pwsh"` | remove and then install extensions for `pwsh` profile |

## Note on Settings Sync

As I have [settings sync](https://code.visualstudio.com/docs/editor/settings-sync) activated on all my VS Code instances, above setup was synchronized from my Windows box configuration, where I originally ran the script, to my other Windows and Linux boxes and VMs.
You can simply make a extension that will save your lot of time
Tags: googleextention, chatgpt, javascript
Published: 2023-03-19 09:08:27

Many developer want a time consuming tool that could save a lot of time by doing a particular work .Now it is very easy to make something like a tool or we could make a extension for that case .
You know chatGPT can make almost any thing  with your Creativity.
**You can make a Extension with Chat GPT with Free of Cost**

Simply just write on the chat GPT :

> write a google extension that could save my notes and every notes should be a nested note also.

That's all you'll get all the stuffs you need and where to put the files or what  to do .Believe me , it's really simple and enjoyable.
Summery of lesson 2
Tags: osdc
Published: 2023-03-19 08:46:57

Hi all,
In our last session we learned several topics, such as navigating and following articles in dev.io using tags which is pretty easy, branching git projects and opening issues.
Later on Gabor showed how to follow project and organizations in Git, and explained about the project ranking mechanism in Github.
We concluded the lesson with the YAML file format which seems more robust then JSON or XML.
I got a bit lost with the explanation of crating the organization YAML in the osdc-2023-azriely project, and didn't really understood the interaction with the organization-open-source file. Would appreciate if we could spend some more time next lesson understanding why we should add such a file to our project, and perhaps talk about the structure of project files and directories.
I still feel that I lack more info about committing pull request and the CI mechanism.
Thanks and have a lovely week,
Freddy
Days_7 Nesting Dolls Code
Published: 2023-03-19 08:43:03

Nesting is a programming concept that exists in many programming languages, including Python. In Python, nesting is the practice of placing one statement within another statement or block of code, such as placing an "if" statement within another "if" statement or within a "for" loop or "while" loop.

Nesting can be useful for evaluating complex conditions and executing certain blocks of code only under certain circumstances. However, it is important to maintain proper indentation when using nested statements in Python, as the correct indentation is crucial to ensure that the code is executed correctly and to avoid syntax errors.

```
#Nesting Dolls Code
#
#19 MARCH 2023

def exercies_1():
  TvShow = input("What is your favorite character? ")
  if TvShow == "Peppa Pig":
    print("Ugh,Why?")
    FaveCharacter = input("Who is Your Favorite Character? ")
    if FaveCharacter == "Daddy pig":
      print("Right answer")
    else:
      print("Nah, Dady pig's the greatest")
  elif TvShow == "paw patrol":
    print("Aww, sad times")
  else:
    print("Yeah, That's cool and all....")

def exercies_2():
  order = input("what would you like to order: pizza or humberger?")
  if order == "humburger":
    print("Tanks you")
    cheese = input("Do you wont cheese? ")
    if cheese == "yes":
      print("No cheese it is")
    else:
      print("allright")
  elif order == "pizza":
    print("Pizza coming up")
    toppings = input("do you wont pepperoni on that?")
    if toppings == "yes":
      print("we will add pepperoni")
    else:
      print("your pizza will not have pepperoni")
  else:
    print("please, order again")

def exercies_3():
  Movie = input("What kind of movies do you like? ")
  if Movie == "Marvel":
    print("Nice Movie!!!...")
    Filem = input("What kind of movies do you like a Harry Potter? ")
    if Filem == "yes":
      print("nice Movies")
    else:
      print("i think so...")
  elif Movie == "disny":
    print("I like Too")
  else:
    print("I don't like Movie, I like Music")
    
def call():
  exercies_1()
  exercies_2()
  exercies_3()
call()

```
Google apps review
Tags: android, productivity
Published: 2023-03-19 08:29:32

Hi everyone. 
As you all know growing an app on google apps is really hard and you need to have a lot of good qualities to grow on the platform.
One of them is having 5start reviews. I was searching for ways to buy them and after a lot of searching I saw that most of the sites that offered this kind of service had very high prices.
So I decided to start providing this service for the cheapest price and the best quality, With the help of my team and my friends.
If you are interested contact me at: erfun.a.13@gmail.com
Glogg your way through mountains of logs
Tags: webdev, tooling, devops, productivity
Published: 2023-03-19 08:21:08

When our company recently experienced a crash, we were tasked with analyzing a massive 16GB/perDay log file. Thats when we found out about Glogg.

For those who lack a centralized log management system like `CloudWatch`, `Loggly`, or `Sentry` , `Glogg` is the way.

glogg is a multi-platform GUI application to browse and search through long or complex log files. It is designed with programmers and system administrators in mind. glogg can be seen as a graphical, interactive combination of grep and less.

{% embed https://glogg.bonnefon.org/ %} 

A fork of glogg for mac 
{% embed https://klogg.filimonov.dev/ %}

Regarding very large files, such as the 16GB file in our case, the indexing process typically takes around 30 seconds, while searches can be completed within 1-2 minutes. This approach is much more efficient than using terminal commands such as `less`, `more`, and `tail`, which can be difficult to follow and provide little insight into their processes.

![Klogg/Glogg](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgeyhwqa0sy7i62o24sp.png)

While Glogg can certainly provide a temporary solution for disorganized logs, it's important to note that a comprehensive log management system, such as CloudWatch, Loggly, or Sentry, is the ideal long-term solution. These platforms offer centralized storage, easy accessibility, and powerful search capabilities that enable you to efficiently manage and analyze your logs. 

_Peace 🕊_

---

If you are here it means you may have found this blog helpful. Just follow me @shrihari which will motivate to write more. You can make a [Buttermilk 🥛](https://www.buymeacoffee.com/shriharimohan). Small support comes a long way!

Subscribe If you want to receive these blogs in your mail from @[Medium](https://medium.com/@shriharimohan) for free!

## Try Our new product for free!
[DocsAI](https://docsai.app/) - Create AI support agents with your documents in the most affordable price, starts at **0$**. Don't need a bot , but need ai help on your docs just upload and start chating !

Using for a company ? [Check out our pricing](https://docsai.app/pricing) Just contact me for personalized pricing !

![docsAi](https://firebasestorage.googleapis.com/v0/b/shrihari-personal-storage.appspot.com/o/banner-docs-jpeg.jpeg?alt=media&token=45c47666-de2a-4e02-8881-beb6e43ce581)
activities that people might enjoy after finishing work
Published: 2023-03-19 08:18:29



Engage in physical activity: Going for a walk, jog, or hitting the gym can help relieve stress and boost mood.

Spend time with loved ones: Spending time with friends and family can be a great way to unwind and relax after a day of work.

Pursue a hobby: Engaging in a hobby, such as painting, gardening, or playing an instrument, can be a great way to recharge and engage in an activity that brings joy and fulfillment.

Read a book or watch a movie: Curling up with a good book or watching a favorite movie can be a relaxing way to unwind and escape from the stresses of work.

Meditate or practice mindfulness: Practicing meditation or mindfulness can be an effective way to reduce stress and improve overall well-being.
LeetCode: 211. Design Add and Search Words Data Structure (and others)
Tags: algorithms, swift, mobile
Published: 2023-03-19 07:24:54

```swift
// Solution @ Sergey Leschev

class TrieNode {
    var children: [Character: TrieNode]
    var isWord: Bool

    init() {
        children = [:]
        isWord = false
    }
}

class WordDictionary {
    var root: TrieNode

    init() {
        root = TrieNode()
    }

    func addWord(_ word: String) {
        var node = root
        for c in word {
            if let child = node.children[c] {
                node = child
            } else {
                let child = TrieNode()
                node.children[c] = child
                node = child
            }
        }
        node.isWord = true
    }

    func search(_ word: String) -> Bool {
        return searchHelper(Array(word), 0, root)
    }

    private func searchHelper(_ word: [Character], _ index: Int, _ node: TrieNode) -> Bool {
        if index == word.count {
            return node.isWord
        }

        let c = word[index]

        if c != "." {
            if let child = node.children[c] {
                return searchHelper(word, index+1, child)
            }
            return false
        } else {
            for child in node.children.values {
                if searchHelper(word, index+1, child) {
                    return true
                }
            }
            return false
        }
    }
}

```
---

My LeetCode Solutions / Swift
https://github.com/sergeyleschev/leetcode-swift

My LeetCode Solutions / TypeScript
https://github.com/sergeyleschev/leetcode-typescript

---

**Contacts**
I have a clear focus on time-to-market and don't prioritize technical debt. And I took part in the Pre-Sale/RFX activity as a System Architect, assessment efforts for Mobile (iOS-Swift, Android-Kotlin), Frontend (React-TypeScript) and Backend (NodeJS-.NET-PHP-Kafka-SQL-NoSQL). And I also formed the work of Pre-Sale as a CTO from Opportunity to Proposal via knowledge transfer to Successful Delivery.

🛩️ #startups #management #cto #swift #typescript #database
📧 Email: sergey.leschev@gmail.com
👋 LinkedIn: https://linkedin.com/in/sergeyleschev/
👋 LeetCode: https://leetcode.com/sergeyleschev/
👋 Twitter: https://twitter.com/sergeyleschev
👋 Github: https://github.com/sergeyleschev
🌎 Website: https://sergeyleschev.github.io
🌎 Reddit: https://reddit.com/user/sergeyleschev
🌎 Quora: https://quora.com/sergey-leschev
🌎 Medium: https://medium.com/@sergeyleschev
Advanced Types in TypeScript
Tags: typescript, starchart, senecaosd700
Published: 2023-03-19 04:56:51

Strongly typed languages increase the safety of programs. It doesn't mean that strongly typed languages are always better than weakly typed languages. Weakly typed languages can reduce the development time. So programmers should choose a programming language based on the purpose of the program. Although I contributed some of Typescript projects, but I didn't have much knowledge about Typescript typing. I learned some of very useful typing techniques during Starchart code review. 

### When using the same type with different property names
You could face the situation that it doesn't make sense to have two different type names while only small portion of the properties varies. My DNS module in Starchart is a good example to explain this instance. At the beginning, we use the variable `name` as any type of domains. But in our app, this name could be `subdomain` or `fully qualified domain name` which can be shortened to `fqdn`. This is very confusing when writing a code to use the function. You don't have any idea whether you are going to get `subdomain` or `fqdn` which could result in a wrong implementation or frustrating the writer to look up all the code to figure what it actually is. So we can do something like this. 

```js
type Name = { subdomain: string } | { fqdn: string };
interface BaseDnsRequestData {
  type: string;
  value: string;
}
type DnsRequestData = BaseDnsRequestData & Name;

```

So `DnsRequestData` can have either `subdomain` or `fqdn`. When you extract the data, Typescript knows what type is passing only in runtime. So you should extract the data as below. 

```js
let name;
if ('subdomain' in data) {
  name = data.subdomain;
} else {
  name = data.fqdn;
}
```

### When type naming is not necessary
Sometimes it's better not to name the type when passing data is obvious or varying similar names is more confusing. So you can instead of defining as below,

```js
interface Record {
  type: string;
  name: string;
  value: string;
  description: string;
  ports: string;
}

type DnsRequestData = {
  type: Record['type'];
  name: Record['name'];
  value: Record['value'];
  description?: Record['description'];
  ports?: Record['ports'];
}
```

You can simplify the type without naming. 

```js
Pick<Record, 'type' | 'name' | 'value'> & Partial<Pick<Record, 'description' | 'ports'>> 
```

### Conclusion
It was really good for me not just to learn these techniques, but also to help me to write better code. It seems not important for someone who develops something quickly, but typing is very important when many contributors or developers are working together. It finds the potential errors quickly and gives an idea of what this code does. It also takes a lot of learning from the experienced. I never thought about this kind of problems when I was working alone. Having the experienced developers' feedback is really helpful to learn how to write better code. Thanks for reading my article!
AWS VPC Connectivity Options
Published: 2023-03-19 07:02:51

The following article explains different connectivity options between AWS and On-prem networks


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8z5a0vx1ugoa18etgf99.JPG)


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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7919cb89kqrwin2dorx3.JPG)
How Can Coders Ensure Ethical Practices in Their Work?
Tags: discuss, beginners, codenewbie
Published: 2023-03-19 07:00:00

As coders, we have a responsibility to consider the ethical implications of the projects we work on. From privacy concerns to potential biases, there are many factors to consider. What do you think are some of the ethical considerations that coders need to be aware of, and how can you ensure that your work is responsible and ethical?

Here are some points to get the conversation started:

1. **Data privacy** 
2. **Accessibility**
3. **Bias and discrimination** 
4. **Intellectual property** 
5. **Social responsibility**

Let's strive to be ethical coders and use our skills to make a positive impact on the world!
🪐 Why useState returns an array in React?
Tags: javascript, react, typescript
Published: 2023-03-19 06:39:38

I have always wondered why does React useState returns an _array_ instead of an _object_.
```typescript
const [count, setCount] = useState(0);
```
This assigns the current state value to the count variable, and the update function to the setCount variable. This syntax is _concise and easy_ to read, making it a popular choice for managing state in React.

If useState were to return an object instead of an array, you would need to use [property destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) to access the state value and update function. This can be more verbose, as you would need to provide an explicit property name for each value:
```typescript
const {state: count, setState: setCount} = useState(0);
```
If `useState` returns an Object the [destructring assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) wouldn't be that convenient, because you'd have to implicitly rename the object fields. And if don't rename the object fields, then we would only be able to use only one `useState` in a component.

This syntax is less convenient than [array destructuring](https://kentcdodds.com/blog/react-hooks-array-destructuring-fundamentals), as you need to rename the properties of the returned object to avoid naming conflicts. If you don't rename the properties, you would only be able to use one useState call in a component.

**Overall**, using an array to return the state value and update function is a simple and effective way to manage state in React. While returning an object would be possible, it would require more verbose syntax and would be less convenient for most use cases. By returning an array, React makes it easy to use useState to manage state in your functional components.
Dark light mode toggle
Tags: javascript, css, webdev, programming
Published: 2023-03-19 06:27:05

In this post, I'm going to show you how you can easily create a Dark/Light mode toggle using CSS, JavaScript.

Create two CSS classes, one for the light mode and one for the dark mode.

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

Create a checkbox input in your HTML code to act as the toggle switch:
In this step, we create a checkbox input element that will act as the toggle switch for our dark-light mode. We use the label element to wrap the input element and a span element with the class slider round for the toggle button.

The id attribute of the input element is used to reference the element in our JavaScript code later.


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

Add some JavaScript code to toggle the dark mode class
In this step, we use JavaScript to toggle the dark mode class when the toggle switch is clicked. We add an event listener to the input element that listens for the change event and calls the mode function.


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

We also use the `localStorage` object to store the user's preference for light or dark mode, so that the mode persists even when the user leaves and returns to the site. We check the value of `localStorage.getItem('mode')` to see if the user has previously selected a mode, and if so, we set the data-theme attribute and the toggle button accordingly.

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

By following these steps, you can create a dark-light mode toggle that allows your users to switch between different color schemes for your website or web application.


Source will be available on : https://github.com/erajamanickam/dark-light-mode

Live demo : https://dark-light-mode-css.vercel.app/

Watch on video : https://youtu.be/hBzKhTkLGWU

Codepen : https://codepen.io/erajamanickam/pen/JjaBmpB
Powershell - just pick it up lately? Questions for you!
Tags: discuss, powershell, scripting, beginners
Published: 2023-03-19 05:54:09

Hey all. I've been talking to a few tech community members recently and see that a handful of them have picked up PowerShell recently, spurred on perhaps by a recent book sale or a new job they've started where the automate-everything banner is flying high.

If you've started learning or really digging into PowerShell recently, would love to hear your thoughts!

1. How'd you get started? Any books or resources? If so how helpful?
2. Any big-picture questions or mysteries you're finding that have a "this is fundamental but I can't figure it out" flavor?
3. Doing this by yourself, or is anyone else available to train/mentor?

Let's talk it out!