teleren/devto huggingface dataset:
Utilities I use for web development. 🗿
Tags: javascript, web3, typescript, programming
Published: 2022-08-07 11:35:01

##[1. TS faker](https://ts-faker.vercel.app/)
Generate Fake data using typescript interfaces. Supports JSON and SQL. Its merely a proof of concept it doesn't help when having interfaces composed of other interfaces.

But works well when you have simple structures. I am trying to contact with the author to have more features. [Post by author](https://dev.to/sirwanafifi/ts-faker-generating-fake-data-using-typescript-interfaces-2em2)

![TS Faker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jadxtevd88wyw1gg96o8.png)

##2. Tailwind Colors
One of the best color pallete available and that too open source ❤️. I use this to choose colors on all projects.

{% embed https://tailwindcss.com/docs/customizing-colors#default-color-palette %}

##[3. Make Types from JSON](https://jvilk.com/MakeTypes/)
I am a huge typescript guy , I use types for almost everthing. Those extra times save a lot of trouble. When working with 3rd party apis,[](url) this is very helpful.

![Make Types](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bdvjk28ap6qj9daqbpl.png)

##4. Excalidraw
Easy to create sketches and share as png/svg.
{% embed https://excalidraw.com/ %}

##5. MDN Docs
Everything is here !
{% embed https://developer.mozilla.org/en-US/ %}

_Peace_ 🕊

--- 

If you are here it means you may have enjoyed reading this blog. Just follow me @shrihari which will motivate to write more, contribute open source.

You can make me drink [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)

---
## More Free Articles From me 

{% embed https://dev.to/shrihari/the-chrome-dev-tool-you-are-missing-feat-recorder-4ao5 %}

{% embed https://dev.to/shrihari/51-100-510-why-you-have-to-be-careful-with-doubles-and-floats--29eg %}

{% embed https://dev.to/shrihari/top-ui-frameworks-for-angular-and-react-1951 %}
If You Use Visual Studio Code . Know these Shortcuts
Tags: coding, html, css, shortcuts
Published: 2022-08-07 11:30:07

Knowing Visual Studio code shortcuts will save you more time than you can imagine when writing your codes . Checkout some of these shortcuts you can try in order to save on time.

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

**1.	ID and Class Attributes**

•	Adding an Id attribute in an HTML tag 
(div#info)

```
<div id="info"></div>
```

•	Adding a class attribute to a html tag 
(div.header)

```
<div class="header"></div>
```

•	Adding an Id and a class attribute 
(Form#.info)

```
<form action="" id="" class="info"></form>
```

•	Adding multiple Id and class attributes 
(p.info1.info2.info3.info4#info)

```
<p class="info1 info2 info3 info4" id="info"></p>
```

**2.Item Numbering** 

•	Adding an ordered number of class names to the child elements.
(ul>li.items$*5)

```

<ul>
    <li class="items1"></li>
    <li class="items2"></li>
    <li class="items3"></li>
    <li class="items4"></li>
    <li class="items5"></li>
</ul>
```

**3.Child elements in the same class (Implicit Tag names )**

(ul>.item)

```
<ul>
    <li class="item"></li>
</ul>
```

 
                 OR

(table>.row>.col*3)

```
<table>
    <tr class="row">
        <td class="col"></td>
        <td class="col"></td>
        <td class="col"></td>
    </tr>
</table>
```

**4.Putting Into Groups** 

(div> (header>ul>li*2>a) +footer>p)

```
<div>
    <header>
        <ul>
            <li><a href=""></a></li>
            <li><a href=""></a></li>
        </ul>
    </header>
    <footer>
        <p></p>
    </footer>
</div>
```

**5.HTML tag with a text**

(a{Google})

```
`<a href="https://www.google.com/">Google</a>`
```

**6.Adding a HTML tag to another HTML tag (Siblings)**

(div+sec+p)

```
<div></div>
<sec></sec>
<p></p>
```

**7.Adding Child and Parent Elements**

•Adding multiple child elements 

(ul>li*)

```
<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

```
•Adding child elements to the parent elements 

(ul>li)

```
<ul>
    <li></li>
</ul>
```
Fix Microsoft Teams screen sharing on Ubuntu 22.04
Tags: linux, ubuntu, msteams, microsoft
Published: 2022-08-07 11:23:00

### Problem

When you install [Microsoft Teams](https://www.microsoft.com/nl-be/microsoft-teams/download-app#desktopAppDownloadregion) on Linux Ubunut 22.04, screen/desktop sharing doesn't work (v1.5.00.10453)
When you open the sharing tray on the native or the web-client of MS teams, its empty as shown below.

![Screenshot empty sharing tray MS Teams](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76zsbx9r2e95ijyg4un0.png)


### Cause

The origin of this problem is that Linux Ubuntu 22.04 uses [Wayland](https://wayland.freedesktop.org/) as main communication protocol between a display server and its clients. And the Elektron version that Teams is currently using doesn't support Wayland as it should.


### Solution 

[Source](https://linuxconfig.org/how-to-enable-disable-wayland-on-ubuntu-20-04-desktop)

Solving the screen sharing issue is easily resolved by just disabling Wayland in your display manager

Assuming GDM3 is your default display manager, editing the config can disable Wayland

```bash
 sudoedit /etc/gdm3/custom.conf
```

![Image config Wayland enabled](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rg723njqlo69185j3ka.png)
Uncomment `#WaylandEnable=false` and save your changes

Restart your device or restart GDM3 
``` bash
sudo systemctl restart gdm3
```
After restart, this should resolve the issues with MS Teams screen sharing
An e-commerce website
Tags: javascript, beginners, css, webdev
Published: 2022-08-07 11:16:20

This is by far my **most challenging project.** 
I was the team lead and i didn't know most of
what will be needed, but i learned on the
job. Still working on the project but i'm
glad with the improvements.
you can check the site[ here ](https://muubaraq.github.io/kodetech-test/)
Python Main Function
Tags: python, beginners
Published: 2022-08-07 11:03:35

Those who have coded in for example in C have interacted with the [**main()**](https://en.cppreference.com/w/c/language/main_function) function. In python we also have the main() function but its declaration is somehow different .The **Main function** is like the entry point of a program. However, Python interpreters run the code right from the first line. The execution of the code starts from the starting line and goes line by line. It does not matter where the main function is present or it is present or not.

Since there is no main() function in Python, when the command to run a Python program is given to the interpreter, the code that is at level 0 indentation is to be executed. However, before doing that, it will define a few special variables. `__name__ `is one such special variable. If the source file is executed as the main program, the interpreter sets the `__name__` variable to have a value `__main__`. If this file is being imported from another module, `__name__` will be set to the module’s name.
`__name__` is a built-in variable which evaluates to the name of the current module.
Lets look at an **example:**

```
# Python program to demonstrate
# main() function


print("Hello")

# Defining main function
def main():
	print("hey there")


# Using the special variable
# __name__
if __name__=="__main__":
	main()

```
**Output**
`Hello
hey there`
**Explanation**
When above program is executed, the interpreter declares the initial value of name as “main”. When the interpreter reaches the if statement it checks for the value of name and when the value of if is true it runs the main function else the main function is not executed.

**Main function as Module**
Now when we import a Python script as module the `__name__` variable gets the value same as the name of the python script imported.

**Example2:** Let’s consider there are two Files(File1.py and File2.py). File1 is as follow.


**# File1.py **
    

```
print("File1 __name__ = %s" %__name__)
    
if __name__ == "__main__": 
    print("File1 is being run directly")
else: 
    print("File1 is being imported")
```
**Output:**

`File1 __name__ = __main__`
File1 is being run directly
Now, when the File1.py is imported into File2.py, the value of `__name__` changes.

**# File2.py** 
    

```
import File1 
    
print("File2 __name__ = %s" %__name__)
    
if __name__ == "__main__":
    print("File2 is being run directly")
else: 
    print("File2 is being imported"){% embed  %}
```
**Output:**

`File1 __name__ = File1
File1 is being imported
File2 __name__ = __main__
File2 is being run directly`

As seen above, when File1.py is run directly, the interpreter sets the `__name__ `variable as `__main__` and when it is run through File2.py by importing, the __name__ variable is set as the name of the python script, i.e. File1. Thus, it can be said that if `__name__ == “__main__”` is the part of the program that runs when the script is run from the command line using a command like Python File1.py.
There you have it.
You can visit the docs here for more info:

{% embed https://docs.python.org/3/library/__main__.html %}
[css] Responsive cards
Tags: css, webdev, tutorial
Published: 2022-08-07 10:49:00


It often happens that a set of cards needs to be made responsive, here is a simple solution:

https://codepen.io/maurerkrisztian/pen/dymeBmr

{% codepen https://codepen.io/maurerkrisztian/pen/dymeBmr %}

```html
<div class="container">
  <div class="element">1</div>
  <div class="element">2</div>
  <div class="element">3</div>
  <div class="element">4</div>
</div>
```

```css
:root {
  --min-width: 300px;
  --space-between: 2rem;
}

.container {
  display: grid;
  grid-gap: var(--space-between);
  grid-template-columns: repeat(auto-fit, minmax(var(--min-width), 1fr));
}

.element {
  display: grid;
  place-items: center;
  background: lightpink;
  height: 100px
} 
```

![Maurer Krisztián demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gaghkc7s1vn569i8i46j.gif)
Coding is hard!!!
Tags: career, codenewbie, webdev
Published: 2022-08-07 10:43:00

I have always been fascinated by the things my fellow humans are able to accomplish with the internet. In a space where it is only a few can thrive in. You have to be kind of special to be in that space. For years, I have been trying to take a stand if I should focus solely on software development. Watched Youtube videos where I saw people doing amazing stuffs. My brain began to process and assimilate what I have been watching and observing. It is actually easier to watch videos and feel you can do or replicate what that individual did. Not the case, you get stuck for a while.  I decided i will like to do things with world technologies: web development most especially. It's been a hard and tough journey. Frustrating moments and days of giving up. I guess that's where grit comes into play. To keep you going. It's been an interesting journey and i'm loving the experience. Accomplished so many stuffs in the last 3 months.
Got To Start Somewhere...
Tags: javascript, beginners
Published: 2022-08-07 10:41:10

Hi, and welcome to my first ever blog post on here as a  student and overall JS NOOB. I know I should've made this post sooner but here we are up 3am uploading a blog post. Regardless I want to tell you all a little about myself, my name is Jorge I'm 20 years old, I'm 5'11 (well 5'9 but you gotta hype yourself up a bit), my only hobby is overthinking everything, and I'm from Northern California. At the moment I'm in my very early stages of becoming a software developer as evident from my small understanding of the meaning of a 'JSON' or even how to center a 'div'. Regardless I hope to one day look back on this post and think, "Wow its been 2 years and now I get paid to center a 'div's'". If you're also a beginner hit me up I may be a little introverted but I'm always down to meet new people. :)
Android: การส่งแอปที่เขียนไปรันบนโทรศัพท์แบบไร้สาย (ADB Wi-Fi)
Tags: flutter, android
Published: 2022-08-07 10:36:00

ปกติเราต้องต่อสาย USB เข้ากับโทรศัพท์ android เพื่อให้เครื่องคอมพิวเตอร์ (flutter) ของเรา detect เจอว่ามีโทรศัพท์ต่ออยู่ บางทีก็ไม่สะดวก เพราะมีสายเกะกะ ซึ่งใน android version ใหม่ๆ (จำไม่ได้แล้วว่า 10 หรือ 11 ขึ้นไป) จะมี feature ให้สามารถเชื่อม adb ผ่านทาง wifi ได้ โดยมีขั้นตอนดังนี้

1. ต่อสาย usb กับโทรศัพท์แบบปกติก่อน (ตรวจสอบด้วยว่า มันเชื่อมกันชัวร์แล้วใช่ไหม) โดยคำสั่ง adb devices
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vuwji2d6rc16sjm0rpwc.png)
2. จากนั้นสั่งให้เครื่องที่เราเชื่อมต่อนี้ เปิดการเชื่อมต่อแบบ Wi-Fi โดยระบุ port การเชื่อมต่อเป็น 5555 (ปกติเค้าก็ใช้ port นี้กัน) ด้วยคำสั่ง adb tcpip 5555
![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sngeitwhdsd5as9bcbng.png)
กรณีทีมีอุปกรณ์ต่ออยู่หลายตัว เราสามารถระบุอุปกรณ์ที่จะเชื่อมต่อแบบเฉพาะเจาะจงได้โดยการใส่หมายเลขเครื่องด้วยพารมีเตอร์ -s ตามตัวอย่างข้างบน
3. ตอนนี้เครื่องมือถือจะเปิดการเชื่อมต่อผ่านทางเน็ต (tcpip) แล้วเราก็จะเชื่อมต่อผ่านทาง wifi ได้แล้ว โดยเรา ถอดสาย usb ออกเลย
4. ใช้คำสั่ง abd connect 192.168.1.116:5555 => 192.168.1.116 คือ ip ของเครื่องโทรศัพท์นะ ถ้าไม่รู้ ip ให้ดูในโทรศัพท์ตรงการเชื่อมต่อ Wi-Fi เลือก Access point ที่มือถือเชื่อมอยู่แล้วกดฟันเฟือนเข้าไปดู (กรณีที่เป็น android samsung)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zpntph16aygp5w8vdsb.png)
5. เท่านี้เครื่องคอมพิวเตอร์ ก็เชื่อมกับโทรศัพท์ผ่าน wifi แล้ว โดยตรวจสอบได้จากคำสั่ง adb devices อีกครั้ง จะเห็นว่ามันเชื่อมผ่าน ip แล้ว
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/61wqypr80cyji8sgciuo.png)
6. การยกเลิกการเชื่อมต่อผ่าน ip ใช้คำสั่ง adb disconnect 192.168.1.116:5555 => 192.168.1.116 คือ ip ของเครื่องโทรศัพท์นะ
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/041g22tcdhri9ef2vuj8.png)
How can You earn daily 1000 INR daily using my Intraday NIFTY50 F&O Strategy?
Tags: nifty50, intraday, tradingstretegy, earnmoneyonline
Published: 2022-08-07 10:11:00

Hello Every one, in this post I will be guide you through how you can consistently make one thousand rupees daily by just following below Intraday NIFTY50 F&O Strategy. 

**Pre-requisite:**
1. Demat or trading account - [Zerodha](https://zerodha.com/?c=KKT635&s=CONSOLE), [Groww](https://app.groww.in/v3cO/j3p7tjit) or [Upstox](https://link.upstox.com/PKSZgU9qi6EQnCZj9)
2. Capital requirements - 10000 INR

**Accuracy:** 80%

**Steps:**
1. Open Demat or trading account - [Zerodha](https://zerodha.com/?c=KKT635&s=CONSOLE), [Groww](https://app.groww.in/v3cO/j3p7tjit) or [Upstox](https://link.upstox.com/PKSZgU9qi6EQnCZj9) using highlighted link.

2. Enable Futures and Options segment in your trading account and Add 10,000 rupees into your demat account.

3. Now, Everyday at 9:07 AM, after pre-market is over, you need to check whether NIFTY50 is opening gap-up or gap-down.
Note: gap-up or gap-down should not more than 250 points and should not less than 50 points. If anything else then we should not trade on that day.

4. Now let's consider if market is opening gap-up, then select nearest ITM(In-The-Money) strike price. For example if last closing price is 17,382 and today's opening price is 17415 then we should select 17,400 strike price.

5. After selecting strike price, select 1 lot of it and get ready to place Market order with SL(Stop-loss) of 10 points and Target of 20 points before 9:15 AM.

6. Once market opens then, place order on 9:16 AM quickly with proper SL and Target as we discussed earlier.

7. Now, if target hits then we're good, you just earned 20 points * 50 quantities(1 lot) = 1000 rupees and if stop-loss hits than you will loose 10 points * 50 quantities(1 lot) = 500 rupees. (Note: we're not considering any transaction charges here)

You can adjust above strategy according to your risk-to-reward and position sizing. For example, 1:1, 1:3 risk:reward. 

You can also use this if market opens gap-down. In that case, you just need to buy nearest ITM(In-The-Money) put option.

**Disclaimer:** I'm not any SEBI registered analyst. This is not advise to buy/hold/sell any position. You should trade on your own risk.
How to calculate big o notation ?
Published: 2022-08-07 09:53:33


## What is Big O Notation ?

Big O notation is **a mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity**. [src](https://en.wikipedia.org/wiki/Big_O_notation)


## What is Time Complexity ?
**Time complexity** is defined as the amount of time taken by an algorithm to run, as a function of the length of the input.

You can check out the different complexity times in the table below:

| Time Complexity Name | Complexity |
| -------------------- | ---------- |
| Constant             | O(1)       |
| Linear               | O(n)       |
| Logarithmic          | O(log n)   | 
| Quadratic            | O(n²)      |
| Exponential          | O(2^n)     |
| Factorial            | O(n!)      |

You can see the big o notation of common functions [here](https://en.wikipedia.org/wiki/Big_O_notation#Orders_of_common_functions).

To get a good perspective of time complexities, we can use the graphical calculator of these constants. You can use [desmos](https://www.desmos.com/calculator?lang=en) graph calculator. I created a simple demo, you can check out [here](https://www.desmos.com/calculator/fx3cqrl4b6).


By calculating time complexity of an algorithm, we can get an information about scalability and performance. If we have an algorithm that performs in quadratic or exponential time complexity, we can try to optimize it, so it can scale.

You can see some examples of time complexities of loops.

```js
//O(n)
for(let i=0; i<n; i++){

}

//O(n*m) --> O(n²)
for(let i=0; i<n; i++){
	for(let j=0; j<m; j++){
	
	}
}

let s = 0; //O(1)


//O(log(n))
for(let i=n; i>0; i=i/2){

}

```


When we check out the graph examples in the desmos calculator, we get a better picture of how algorithms can scale. And this is not related to the only algorithms, we can use this knowledge for database queries. For example, if we have a table with no index defined, the time complexity for **search** will be O(n). But if we define an index, the time complexity of search will be O(log(n)). Because when we create an index, we don't have to check every row in the table; instead, we can use a divide-and-conquer algorithm by looking based on index.


## Calculation 

Let's see how can we calculate big o notation of an algorithm.

```js

let sum = (n) => {
	let res = 0 // O(1)
	for(let i=0; i<n; i++){ //O(n)
		res += i // O(1)
	}
	return res // O(1)
}
```

So when we sum all time complexity, we get O(n).
```
sum = 1 + n*1 + 1 = n + 2 => O(n)
```

An example for `n*log(n)` time complexity

```js

let sumDivide = (n) => {
	let res = 0 // O(1)
	for(let i=n; i<n; i/2){ //O(log(n))
		for(let j=n; j<n; j/2){ //O(n)
			res += j // O(1)
		}
	}
	return res // O(1)
}
```

```
sumDivide = 1 + log(n)*n*1 + 1 = n*log(n) + 2 => O(n*log(n))
```
Portfolio Project CS 102: Book Recommendation System
Published: 2022-08-07 09:45:36

This is the last steps to complete the Codacademy's course CS102: Data Structures and Algorithms!

Project Objectives:
 - Store data in a data structure
 - Use an algorithm to sort or search for data within a data structure
 - Use Git version control
 - Use the command line and file navigation
 - Write a technical blog post on the project


As I love reading, I have created a book recommendation system in phyton, where you can find a list of books by your selected genre.
Of course it can be improved, and I will continue working on it.

https://github.com/Othamae/Books-Recommendation-System

Thanks!!
Raspberry Pi: Introduction to Linux
Tags: iot, rasberrypi, guide, linux
Published: 2022-10-04 09:27:45

---
title: Raspberry Pi: Introduction to Linux
published: true
date: 2022-08-07 09:34:43 UTC
tags: iot, rasberrypi, guide, linux
canonical_url: https://tech.forums.softwareag.com/t/raspberry-pi-introduction-to-linux/259929
---

 

## Introduction

This is a basic introductions and an important knowledge to make it easer to deal with Linux installed in Raspberry Pi and any other single board computer.

## Pre-requisite

- Raspberry Pi, follow this tutorial to set it up, if it is new: [Raspberry Pi: From Box to C8y](https://tech.forums.softwareag.com/t/raspberry-pi-from-box-to-c8y/259766)

## Steps to follow

- Follow attached document:

[Introduction to Linux.pdf](https://tech.forums.softwareag.com/t/raspberry-pi-introduction-to-linux/259929#steps-to-follow-3)

## Next steps

- Apply and discover the commands in the sheet:

[Linux\_Cources Documentation.pdf](https://tech.forums.softwareag.com/t/raspberry-pi-introduction-to-linux/259929#next-steps-4)

> **Important Note:** In Raspbian distro, use “apt-get” instead of “yum” to install new software tools.

## Useful links | Relevant

* [Linux CentOS 7: Overview and Installation](https://www.linkedin.com/learning/linux-centos-7-overview-and-installation)

* [Learning Linux Command Line (2018)](https://www.linkedin.com/learning/learning-linux-command-line-2018)

[Read full topic](https://tech.forums.softwareag.com/t/raspberry-pi-introduction-to-linux/259929)
B𝗮𝗹𝗮𝗻𝗰𝗲 𝘀𝗵𝗲𝗲𝘁 of your life.
Tags: career, discuss, productivity, codenewbie
Published: 2022-08-07 09:20:52

Distribute your day into 𝟴+𝟴+𝟴 hours to make a good 𝗯𝗮𝗹𝗮𝗻𝗰𝗲 𝘀𝗵𝗲𝗲𝘁 of your life.

8 hrs. of honest 𝗵𝗮𝗿𝗱 𝘄𝗼𝗿𝗸,
8 hrs. of 𝗴𝗼𝗼𝗱 𝘀𝗹𝗲𝗲𝗽,
8 hrs. should be spent on (3Fs, 3Hs and 3Ss)

3Fs are family, friends and faith!
3Hs are health, hygiene and hobby!
3Ss are soul, service and smile!

Agree?
Copy to clipboard URL in Next JS
Tags: nextjs, javascript, react
Published: 2022-08-07 09:00:00

First import useRouter and useState.

```
import { useRouter } from "next/router";
import { useState } from "react";
```

In function

```
const share = useRouter();
    const base = "http://localhost:3000";
    
    const links = base + share.asPath;
    const copylink = (e) => {
        navigator.clipboard.writeText(links)
    }
```
In Html

```
<div onClick={copylink} className="shareicon" >
    <p> Copy to CLipboar </p>
</div>
```