teleren/devto huggingface dataset:
How to update Firefox on Ubuntu Linux
Published: 2022-06-12 11:54:06

tldr;

```
# Backup the old version
sudo mv /opt/firefox /opt/firefox_bak

# Untar the new Firefox
sudo tar xjf firefox-*.tar.bz2 -C /opt

# Remove the tar from Downloads
rm -r ~/Downloads/firefox-*.tar.bz2
```

---

I installed Firefox on Kubuntu with tarball (no `snap` nor `flatpak`):

1. I went to: https://www.mozilla.org/en-US/firefox/new/ , and downloaded the tarball
2. `sudo tar xjf ~/Downloads/firefox-*.tar.bz2 -C /opt/
`
3. `sudo ln -s /opt/firefox/firefox /usr/bin/firefox`
4. `rm -r ~/Downloads/firefox-*.tar.bz2`

--

When it came to updating Firefox (I got a pop-up in top right corner of the application), I downloaded a new version (used to have 100.x, now I downloaded 101.x), and I used the following commands:

```
# Backup the old version
sudo mv /opt/firefox /opt/firefox_bak

# Untar the new Firefox
sudo tar xjf firefox-*.tar.bz2 -C /opt

# Remove the tar from Downloads
rm -r /Downloads/firefox-*.tar.bz2
```

---

Graphic from: https://en.wikipedia.org/wiki/Red_fox
Leaf-Similar Trees
Tags: leetcode, dsa, theabbie
Published: 2022-06-12 11:30:34

Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a **leaf value sequence**_._

![](https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/16/tree.png)

For example, in the given tree above, the leaf value sequence is `(6, 7, 4, 9, 8)`.

Two binary trees are considered _leaf-similar_ if their leaf value sequence is the same.

Return `true` if and only if the two given trees with head nodes `root1` and `root2` are leaf-similar.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/09/03/leaf-similar-1.jpg)

**Input:** root1 = \[3,5,1,6,2,9,8,null,null,7,4\], root2 = \[3,5,1,6,7,4,2,null,null,null,null,null,null,9,8\]
**Output:** true

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/09/03/leaf-similar-2.jpg)

**Input:** root1 = \[1,2,3\], root2 = \[1,3,2\]
**Output:** false

**Constraints:**

*   The number of nodes in each tree will be in the range `[1, 200]`.
*   Both of the given trees will have values in the range `[0, 200]`.

**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 leafSeq(self, root):
            seq = []
            nodes = [root]
            while len(nodes) > 0:
                curr = nodes.pop()
                if curr:
                    if not curr.left and not curr.right:
                        seq.append(curr.val)
                    nodes.append(curr.left)
                    nodes.append(curr.right)
            return seq
        
        def leafSimilar(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool:
            return self.leafSeq(root1) == self.leafSeq(root2)
Tetragon – Kubernetes eBPF-based Security
Tags: kubernetes, security, devops
Published: 2022-06-12 11:27:26

Cilium’s new Tetragon component enables powerful realtime, eBPF-based Security Observability and Runtime Enforcement.

Tetragon detects and is able to react to security-significant events, such as

    Process execution events
    System call activity
    I/O activity including network & file access

When used in a Kubernetes environment, Tetragon is Kubernetes-aware – that is, it understands Kubernetes identities such as namespaces, pods and so-on – so that security event detection can be configured in relation to individual workloads.

[Kubernetes eBPF-based Security](https://blog.sectool.co/ebpf-based-security)
Pikaso now supports NodeJs
Tags: pikaso, node, canvas, image
Published: 2022-06-12 11:13:56

As of version [2.7.0](https://github.com/pikasojs/pikaso/releases/tag/v2.7.0), NodeJs is supported. 
This will enable collaboration between backend and frontend sides in creating images.

Using Pikaso in a NodeJs environment is similar to using it in a browser.

Note that you must install `node-canvas` separately.

```
npm install canvas
```

```
const { Pikaso } = require('pikaso')

const editor = new Pikaso({
  width: 800,
  height: 600
})

editor.shapes.circle.insert({
  x: 200,
  y: 200,
  radius: 40,
  fill: 'blue'
})

const base64Url = editor.export.toImage()
```

Github:
https://github.com/pikasojs/pikaso

Website:
https://pikaso.app
6 tips to improve your logic in coding
Tags: programming, webdev, codenewbie, computerscience
Published: 2022-06-12 11:02:47

#1- Pen & Paper
Write out everything you are going through trust me, it will help you in a lot of ways once you write what you understand and solve it into a paper your mind will sync with your brain and that will help you to learn more and improve, and it will be saved in your brainstorming note, so you won’t forget what you learned.


#2- Coding a lot
You can learn as much code as you can explore new code is a great way to re-update yourself, and you’ll keep it up, but learning coding is not only applying the same. It’s also learning new code concepts and when you become more logical to think about new things your coding skills will improve and things will begin to assist you.

#3- Code review by other developers
It’s important to share what you wrote the code with other developers and ask for their feedback because they have a great deal of experience in this software development field so make sure you share as much information with other community members as you can because they can help you always so try to share as much as possible in coding community websites.

#4- Learn new things
The best way to enrich yourself is to constantly learn new things in order to develop your mind and develop your ability to learn more new things and upcoming technologies to stay updated on those things, so yes, keep learning and utilizing those techniques to improve yourself.

#5- Consistency rather than motivation
Having consistency is crucial if you want to succeed in your coding journey. Don’t give up because you will never finish if you don’t give this consistency, you have all the power to archive whatever you would like.

#6- Face Problem head-on
In order to grow up as an individual, you must take on challenges and deal with the hardship that you face. If you stay in your comfort zone, you are not able to grow up and face the challenge and learn from it. Yes, when you face a difficult problem, your mind says you are not able to handle it, but if you face it and do it, your mind suffers and grows, and you grow up — that’s what is bringing you to adulthood.
Maximum 69 Number
Tags: leetcode, dsa, theabbie
Published: 2022-06-12 11:00:54

You are given a positive integer `num` consisting only of digits `6` and `9`.

Return _the maximum number you can get by changing **at most** one digit (_`6` _becomes_ `9`_, and_ `9` _becomes_ `6`_)_.

**Example 1:**

**Input:** num = 9669
**Output:** 9969
**Explanation:** 
Changing the first digit results in 6669.
Changing the second digit results in 9969.
Changing the third digit results in 9699.
Changing the fourth digit results in 9666.
The maximum number is 9969.

**Example 2:**

**Input:** num = 9996
**Output:** 9999
**Explanation:** Changing the last digit 6 to 9 results in the maximum number.

**Example 3:**

**Input:** num = 9999
**Output:** 9999
**Explanation:** It is better not to apply any change.

**Constraints:**

*   `1 <= num <= 104`
*   `num` consists of only `6` and `9` digits.

**SOLUTION:**

    class Solution:
        def maximum69Number (self, num: int) -> int:
            currmax = num
            numstr = str(num)
            if '6' in numstr:
                i = numstr.index('6')
                curr = int(numstr[0:i] + '9' + numstr[i+1:])
                currmax = max(currmax, curr)
            return currmax
Atomize
Tags: codepen
Published: 2022-06-12 10:53:39

<p>This is a very old version of this project, but you guys might want to check the current version at <a href="https://sciecode.github.io/" target="_blank">https://sciecode.github.io/</a></p>

{% codepen https://codepen.io/sciecode/pen/wEyrXe %}
.gitignore all .DS_Store files, even if already committed
Tags: git, 10stips
Published: 2022-06-12 10:40:37

Hello everyone, and welcome to _#10stips_! The column where you learn how to solve coding issues within 10 seconds.

In today's episode I show you **how to .gitignore MacOS .DS_Store files in every folder and subfolder of your project.**

## A little bit of background

I recently jumped onboard onto an existing Rails 4 project.

Yes, Rails 4 is still widely used in production and oftentimes is particularly challenging to upgrade an application with newer Rails versions without creating breaking changes.

As soon as I cloned the repository, and opened up the code with Atom, I noticed all those magical .DS_Store files.

"_Fuck! Back up little bastards!_"

![shooting at the computer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w82lrbwnnf6jtofiexok.gif)

## How to .gitignore .DS_Store files

First, unmatch previously committed files:

```
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
```

Then, add `**/.DS_Store` into .gitignore

Finally, commit and push the changes:

```
git commit -m "Remove .DS_Store from everywhere"
git push
```

You're welcome!

Now, your Mac will still create .DS_Store files in every folder. If you become frustrated, you can turn them off.

## (bonus) How to turn off the creation of .DS_Store files

Mac creates the .DS_Store files to retain settings configured for each folder such as the size and orientation of icons, sort settings, and so on.

If you become frustrated, you can turn off the creation of .DS_Store files - just execute the following command in Terminal:

`defaults write com.apple.desktopservices DSDontWriteNetworkStores true`

Reboot your Mac, and you’ll be good to go.
BulkRun Powershell Script for Azure Pipelines
Tags: azurepipelines, devops, powershell
Published: 2022-06-12 10:36:35

---
title: BulkRun Powershell Script for Azure Pipelines
published: true
description: A script to run Azure Devops pipelines on demand
tags: azurepipelines,devops,powershell
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5gwjyzyzbjzp6mn316u0.png
# Use a ratio of 100:42 for best results.
---

Azure Devops provides a great UI for managing and run the pipelines, but sometimes we need to run it manually, just to reuse the deployment logic or when its required to run many of them.

To accomplish this job, I created a simple powershell script to run a set of pipeline programmatically by using the Azure Devops rest API and it requires a [Personal Access Token](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows)

### Example
```yaml
# Step 1: Create the pipeline on Azure Devops with following yaml code. Below an example with parameters.

parameters:
  - name: name
    displayName: "Name"
    type: string
  - name: surname
    displayName: "Surname"
    type: string

pool:
  vmImage: ubuntu-latest

steps:
- script: echo Hello ${{ parameters.name }} ${{ parameters.surname }}
  displayName: 'Run a one-line script'
```  

```powershell
# Step 2: Create a pipeline definition file (pipetorun.csv) with the information to run an ado pipeline for each row.
# The definitionid is the definitionid of Azure Devops pipeline
# Branch is the pipeline's branch.
# Parameters are defined as a dictionary (key=value separate by semicolon, key is equal the pipeline parameter name)

definitionid,name,branch,parameters
12,hello,main,name=Alan;surname=Turing
12,hello,main,name=Clude;surname=Shannon
12,hello,main,name=Tim;surname=Berners-Lee
12,hello,main,name=Edsger;surname=Dijkstra
12,hello,main,name=Leslie;surname=Lamport

# Step 3: Run five pipeline by using the script and the defintion file. (How to create a PAT )

.\BulkRun.ps1 -PAT personal-access-token -File .\pipetorun.csv
```  

```powershell
# Result

hello inProgress on main -> https://dev.azure.com/dimotta/demo/_build/results?buildId=119
hello inProgress on main -> https://dev.azure.com/dimotta/demo/_build/results?buildId=120
hello inProgress on main -> https://dev.azure.com/dimotta/demo/_build/results?buildId=121
hello inProgress on main -> https://dev.azure.com/dimotta/demo/_build/results?buildId=122
hello inProgress on main -> https://dev.azure.com/dimotta/demo/_build/results?buildId=123
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zup7l7t6tij9j2ha0v0.JPG)

The BulkRun script code is available [here](https://github.com/antdimot/devops/blob/main/ado/BulkRun.ps1)
Divide Array Into Equal Pairs
Tags: leetcode, dsa, theabbie
Published: 2022-06-12 10:30:38

You are given an integer array `nums` consisting of `2 * n` integers.

You need to divide `nums` into `n` pairs such that:

*   Each element belongs to **exactly one** pair.
*   The elements present in a pair are **equal**.

Return `true` _if nums can be divided into_ `n` _pairs, otherwise return_ `false`.

**Example 1:**

**Input:** nums = \[3,2,3,2,2,2\]
**Output:** true
**Explanation:** 
There are 6 elements in nums, so they should be divided into 6 / 2 = 3 pairs.
If nums is divided into the pairs (2, 2), (3, 3), and (2, 2), it will satisfy all the conditions.

**Example 2:**

**Input:** nums = \[1,2,3,4\]
**Output:** false
**Explanation:** 
There is no way to divide nums into 4 / 2 = 2 pairs such that the pairs satisfy every condition.

**Constraints:**

*   `nums.length == 2 * n`
*   `1 <= n <= 500`
*   `1 <= nums[i] <= 500`

**SOLUTION:**

    from collections import Counter
    
    class Solution:
        def divideArray(self, nums: List[int]) -> bool:
            ctr = Counter(nums)
            for num in ctr:
                if ctr[num] & 1:
                    return False
            return True
How to launch google-chrome with a specific profile using selenium (python)?
Tags: selenium, google, chrome, profile
Published: 2022-06-12 10:30:04

---
title: How to launch google-chrome with a specific profile using selenium (python)? 
published: true
description: This article is specifically written to avoid invalid argument exception for argument --user-data-dir with google-chrome and selenium
tags: selenium, google, chrome, profile
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

```python
from selenium import webdriver
from selenium.webdriver import ChromeOptions
opts = ChromeOptions()
opts.arguments.append('--profile-directory=Profile 2')
opts.arguments.append(
'--user-data-dir=/home/user_directory/.config/google-chrome/'
)
# In this case the driver is saved in the
# current directory under a folder named driver
driver = webdriver.Chrome(
executable_path="./driver/chromedriver", 
options=opts)
```

~~`Selenium` will throw exception `InvalidArgumentException: Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir` if the argument `--user-data-dir` is passed with a `/` at the end of the argument input if the directory already exits, else `selenium` will not throw exception.~~

**Selenium will still throw an `InvalidArgumentException`**
9 Beautiful Cool Text Effects using Google font Effects👌
Tags: webdev, javascript, css, productivity
Published: 2022-06-12 10:18:49

Looking to style your headers or text in a more decorative way? Then you are in right place. We all use google fonts in our daily projects but did you ever notice google font is more than just that. Google fonts provide a font effect feature that is less popular & can help you in generating stylish text for your projects.


![are you excited gang](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4h5kjkcracl0b2c9xlp.gif)

**_Are you, excited gang?_**

**How to use this feature?**

- 
Simply add **effect=** to your Google Fonts API request and add the corresponding class name to the HTML element(s) that you want to affect. In our example above, we used the **shadow-multiple** font effect, so the request would look like this:

```
https://fonts.googleapis.com/css?family=Rancho&effect=shadow-multiple
```


- 
To use the effect, add the corresponding class name to your HTML element(s). The corresponding class name is always the effect name prefixed with font-effect-, so the class name for shadow-multiple would be **font-effect-shadow-multiple**:

```
<div class="font-effect-shadow-multiple">This is a font effect!<div>
```

- 
You can request multiple effects by separating the effect names with a pipe character (**|**).

```
https://fonts.googleapis.com/css?family=Rancho&effect=shadow-multiple|3d-float
```
👇Here is a list of some of the effects that API offers -

{% codepen https://codepen.io/gulshanaggarwal/pen/Yzedzzd %}

**Note:-** Google font API offers 25+ effects but Some of the font effects (e.g. 3d) do not scale particularly well, and tend to look best when used with larger font sizes. Read more about the feature in the docs [here](https://developers.google.com/fonts/docs/getting_started#enabling_font_effects_beta).

Thanks for reading!

![good bye](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjkkj6ebr3bblk204nqi.png)
Becoming a frontend developer
Tags: webdev, programming, devops, career
Published: 2022-06-12 10:10:17

Many of us make enough mistakes when we are attempting to learn code, such as watching irrelevant videos and tutorials, and not following the right process, and then we end up just learning the code and forgetting what we learned. If you have this problem, this article will help, as I will share how you can become a front-end developer by following the right process.


## One step at a time

Don’t be a robot or computer, make sure that you stay focused on one thing at a time. Your brain isn’t designed to do that. You can’t learn too many things at once, for example, if you’re learning HTML, learn the basic concept first, then CSS, then JavaScript, but don’t try to do both at the same time because chances are that you’ll forget what you learned before. Practice what you learn first and then move on.

## Follow a learning path

Learning new skills requires the right process peoples want to learn quickly fast such as learning HTML today than tomorrow learning JavaScript, it is not going to happen it is going to take the time it will take a long process it will be hard because your brain isn’t designed to learn such complex at once so give yourself time and follow the tutorial learn step by step, that’s the process really helps.

Practice

If you are very passionate about learning to code, don’t just watch tutorials and understand them, try to put them into practice in your own code. Remember, to use logic to find your own code to create an amazing website, and then practice again and again to build your own logic that helps you learn faster than before. Practice makes perfect when learning coding.

## Finally, build something!

It is the best way to learn to code to create a real-world project if you watch a lot of tutorials for websites on how they create beautiful websites, you can also watch the tutorials and create your own beautiful website by learning those tutorials in simple steps, and then you can show in your portfolio what you have done, and you can start your career as a web developer.

·

HTML

CSS

JavaScript

Consequently, you will have the greatest challenge in keeping up with how often the website changes over time, and due to new things that appear on the web, you should always be up-to-date with your front-end development skills and be able to use any tool to build an amazing website.
Simple Todo app in Go for Beginners (Demo)
Published: 2022-06-12 10:05:59

## Introduction
This is a simple Todo application developed in Go.
 
Click here to access [Github Repo](https://github.com/rahul-yr/learn-go-simple-todo-crud)

Click here to access [Postman collection](https://postman.com/rahul-public/workspace/go-simple-todo-crud)

The scope of this article is just to illustrate the features/specs of this Repo. If you are looking for a tutorial on how to build, please skip this article. As well as this repo is developed for **absolute beginners**. 
> This repo is neither a Production nor a stable version. As well as don't expect any database connections or any third party integrations.

This repo has 5 endpoints.

**POST** `https://learn-go-simple-todo-crud.herokuapp.com/todo/create`
  - for creating todo's (E.g : {"title" : "Some task 1" , "completed" : false }

**GET** `https://learn-go-simple-todo-crud.herokuapp.com/todo/list` 
  - for listing all the todo's

**GET** `https://learn-go-simple-todo-crud.herokuapp.com/todo/read/{id}`
  - for reading a Todo by id

**DELETE** `https://learn-go-simple-todo-crud.herokuapp.com/todo/delete/{id}`
  - for deleting a Todo by id 

**POST** `https://learn-go-simple-todo-crud.herokuapp.com/todo/update/{id}`
  - for updating a Todo by id(E.g : {"title" : "Updated Task details 1", "completed": true}

## Deploy to Cloud
Know how to deploy this repo to Heroku ? [Click here to find out right way](https://dev.to/rahulyr/how-to-deploy-any-backend-to-heroku-easily--22mf)

## Note 
If you have any questions or looking for a tutorial then please use the comment section.
Min Cost to Connect All Points
Tags: leetcode, dsa, theabbie
Published: 2022-06-12 09:30:38

You are given an array `points` representing integer coordinates of some points on a 2D-plane, where `points[i] = [xi, yi]`.

The cost of connecting two points `[xi, yi]` and `[xj, yj]` is the **manhattan distance** between them: `|xi - xj| + |yi - yj|`, where `|val|` denotes the absolute value of `val`.

Return _the minimum cost to make all points connected._ All points are connected if there is **exactly one** simple path between any two points.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/08/26/d.png)

**Input:** points = \[\[0,0\],\[2,2\],\[3,10\],\[5,2\],\[7,0\]\]
**Output:** 20
**Explanation:** 
![](https://assets.leetcode.com/uploads/2020/08/26/c.png)
We can connect the points as shown above to get the minimum cost of 20.
Notice that there is a unique path between every pair of points.

**Example 2:**

**Input:** points = \[\[3,12\],\[-2,5\],\[-4,1\]\]
**Output:** 18

**Constraints:**

*   `1 <= points.length <= 1000`
*   `-106 <= xi, yi <= 106`
*   All pairs `(xi, yi)` are distinct.

**SOLUTION:**

    import heapq
    from collections import defaultdict
    
    class Solution:
        def union(self, parent, i, j):
            parent[i] = j
            
        def getParent(self, parent, i):
            if i not in parent:
                return i
            return self.getParent(parent, parent[i])
            
        def isCycle(self, graph, n):
            parent = {}
            for i in graph:
                for j in graph[i]:
                    x = self.getParent(parent, i)
                    y = self.getParent(parent, j)
                    if x == y:
                        return True
                    self.union(parent, x, y)
            return False
        
        def minCostConnectPoints(self, points):
            n = len(points)
            edges = []
            for i in range(n):
                for j in range(i + 1, n):
                    a, b = points[i]
                    c, d = points[j]
                    cost = abs(c - a) + abs(d - b)
                    heapq.heappush(edges, (cost, i, j))
            graph = defaultdict(set)
            rem = n - 1
            op = 0
            while rem > 0:
                if len(edges) > 0:
                    currdist, i, j = heapq.heappop(edges)
                    graph[i].add(j)
                    if self.isCycle(graph, n):
                        graph[i].remove(j)
                    else:
                        rem -= 1
                        op += currdist
            return op