teleren/devto huggingface dataset:
How to Supercharge your terminal with starship🚀
Tags: programming, productivity
Published: 2022-02-25 10:24:01

How I customized my terminal  to look really good using Starship, Powershell and Nerd Fonts

Yesterday, while chatting in our discord server [The Coding Horizon](https://discord.io/code), my friend, [nexxel](https://personal-website-nexxeln.vercel.app/) told me about a really cool cross-platform prompt called Starship

I’ve always been trying to get a new, better looking terminal and this one is literally perfect!


![Yes, I’m learning Rust!](https://blog.dhravya.dev/static/c98d96a7322b0885920d67b85ef5f01b/efc66/cover.png)

Yes, I’m learning Rust!

Setting it up was also super simple and took less than 5 minutes

I installed Starship using [Cargo](https://crates.io), the Rust package manager, using this command

> cargo install starship --locked
> 

Now that Starship is installed, all I had to do is set up my powershell to use it by default.

- Get the config file path using $PROFILE
- Add a code snippet

Since I’m doing all this in powershell, everything is relatively easy. Starship is cross-platform and will work on [pretty much any shell you can think of](https://starship.rs/guide/#🚀-installation)

Get the config file path using `$PROFILE`

![Untitled](https://blog.dhravya.dev/static/4c1ea9872d4e40b4075bd9ec7d173b0f/79e48/profile.png)

Open the file in text editor of you choice (I used the command `code C:\\ ...` )

For powershell, I had to paste this [according to the docs](https://starship.rs)

`Invoke-Expression (&starship init powershell)`

and then after restarting the terminal, Voila! Starship was installed, but not Nerd fonts. 

It looked weird with some characters not in the font

![Untitled](https://blog.dhravya.dev/static/b5f27fb18964b6c546fb7b75c9aa21e7/6af66/without_font.png)

I went ahead to download and install the Jetbrains Mono NF 

![Untitled](https://blog.dhravya.dev/static/a48a7852e6edee6958563f93a744daf4/efc66/jbmononf.png)

And then install it by opening the Zip and the `.tff` or  .`otf` file and clicking on `install`

![Untitled](https://blog.dhravya.dev/static/293b5553c04ca26c797266e9363aa947/f0551/downloading_and_installing_font.png)

Note the `Font name:`, we’ll need it later

Now all that’s needed to do is to tell your VScode to use the jetbrains mono font

I did this by going to the editor settings and adding this snippet 
`"terminal.integrated.fontFamily": "JetBrainsMono NF",`

![Untitled](https://blog.dhravya.dev/static/25188fdcb862853f8ccd71a2aa1a45fd/79e48/preferences.png)

Andddd that’s it!!! I had this BEAUTIFUL Terminal  by the end!

![Untitled](https://blog.dhravya.dev/static/c98d96a7322b0885920d67b85ef5f01b/efc66/cover.png)
TypeScript
Tags: typescript, javascript, beginners, programming
Published: 2022-02-25 10:19:27

 

TypeScript is a strongly typed programming language that builds on JavaScript. It is a superset of Javascript created by Microsoft. It is an updated version of Javascript. TypeScript is an Open Source Project, and the source code for it is available on GitHub.

**Why do we use Typescript:**

TypeScript solves the largest issue in JavaScript. Javascript shows an error or problem in runtime when we trying to find our bug in the whole javascript code. Javascript can't directly show what is the exact error. TypeScript removes this problem by checking for any issue at compile time.

**About typescript:**

Typescript is a programming language. so it has its own syntax, variable, function, operator, loop, type, array, object, class, module and etc.
  
Its data types are string, number, null, undefined, boolean, never, unknown, any.

Arrays method are concat(), every(), filter(), forEach(), indexOf(), join(), map(), pop(), lastIndexOf(), sort(), shift(), unshift(), etc.

Two types of modules.
1. Internal Modules
Syntax
namespace TutorialPoint { 
   export function add(x, y) { console.log(x + y);} 
}

2. External Modules
Syntax
//FileName : SomeInterface.ts 
export interface SomeInterface { 
   //code declarations 
}

**Typescript benefits:**

The main benefit of typescript is showing errors before runtime and we can select the type. Its supports modern features of Javascript. TypeScript additional syntax catches errors early in your editor. Its code converts to JavaScript, which runs anywhere like Javascript browser, on Node.js or Deno, and in your apps.

So, we can use typescript in our project because it is save our time to fix bugs and use more features than Javascript. Typescript is becoming popular with programmers day by day.
The Complete Guide to Uber Clone Scripts
Tags: uberclone, ubercloneapp, uberclonescript, taxiappdevelopment
Published: 2022-02-25 10:17:03


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6expf82oyd2ebm6tisc7.png)
**What is an Uber clone Script?**

In this post we we know about the uber clone app and its benefits for starting a online taxi business.

An uber clone app is a ready-made mobile application used to open a online taxi business.

We already have seen the success stories of uber like apps. Now all the young entrepreneurs and business owners are following the path of opening uber like business . For doing that thing they want a development company to build the uber clone app.

Now by seeing the demand of uber like apps in the market, development companies have started building the uber clone apps. These clone apps are reliable, scable and robust.

**Features of the Uber Clone App**

Personal driver system is a software application that provides a way for individuals to have an on-demand driver for their car. The personal driver system helps users by making the process of booking and driving easier.

**Uber Clone Script Key Features:**

- Users can make a list of drop and pickup locations.
- [Uber clone script](https://www.apporio.com/product/apporio-taxi-uber-clone-script/) also allows sharable rides. Definitely it saves the money of users.
- In built smart powerful GPS navigation system.
- Up to date features and very responsive user interface.

**Why You Need Uber Clone App?**

Ready-made uber clone app is the best and cost-effective option to start their online taxi booking business.

This uber clone is build by development companies by keeping the latest needs and requirements in mind. The UI is is very beautiful that will surely attract the customers. 

Building the app from the scratch is very time consuming and expensive process. So choosing [uber clone app](https://www.apporio.com/product/apporio-taxi-uber-clone-script/) will definitely save your money and time too. You can get the fully customizable app in just 8 days. It will help you to start your business in a short period of time.
Solidity related question when i change compiler version 0.8 then through error
Published: 2022-02-25 10:06:31

by using solidity compiler 0.8 through Explicit type conversion not allowed from "address" to "uint256".

for (uint idx = 0; idx < v.length; idx++){
            address signer = ecrecover(signedHash, v[idx], r[idx], s[idx]);
            require(admins[signer]);
            require(uint256(signer) > uint256(lastVoter));
            lastVoter = signer;
            emit NewCheckpointVote(_sectionIndex, _hash, v[idx], r[idx], s[idx]);

            // Sufficient signatures present, update latest checkpoint.
            if (idx+1 >= threshold){
                hash = _hash;
                height = block.number;
                sectionIndex = _sectionIndex;
                return true;
            }
        }
        // We shouldn't wind up here, reverting un-emits the events
        revert();
    }
My Roadmap to learn Rust
Tags: rust, programming, beginners, webdev
Published: 2022-02-25 10:05:41

*** 


> Hey, i wanted to learn a new language and i have decided to learn rust. I will just be sharing my learning journey. 



## TOC
  1. [Setup](#setup)
  2. [Understand the Basics](#understanding)
  3. [Learn with examples](#examples)
  4. [Rust and Web assembly](#web)
  5. [Building projects3](#projects)


---



I have decided to learn Rust as a web developer. If the trends and what i have heard is true. Web is becoming more powerful and performant. 


Also, a lot of crypto ecosystem in using rust as in building big projects. For example i got to know solana projects use rust a lot.  




Here is the roadmap that i have decided to take. Hope it will help you as well. I will be sharing my learning. I guess it's the best way to learn. 

---

### 1 Setup <a name="setup"></a>

I downloaded rust from [here](https://www.rust-lang.org/learn/get-started). 

Code editor : vscode

Rust has this cargo package manager and packages are called crates. 

---


### 2. Understand the Basics. <a name="understanding"></a>

 - https://doc.rust-lang.org/book/

I will be reading this book for the 1-2 week. Go through basic concept and syntax of the language. I learn better and faster by reading and iterating in the code editor. Also, I want to have a good understanding of the language concept. Learning by video is a bit slow and i am not really doing anything. I get stimulated that i have learnt something but in reality i have done nothing of my own. 

---


### 3. Learn with examples. <a name="examples"></a>

- https://doc.rust-lang.org/stable/rust-by-example/


I will be spending my first 2-3 week with this books. Learning the basics and making simple example project from the second book.

After finishing the two, doesn't matter how much time it take. I would be able to do it in like 1 to 2 months. That much is enough to go through the staff once. Obviously, the aim is to start building projects in rust. 

---


### 4. Rust and web Assembly <a name="web"></a>

- https://rustwasm.github.io/docs/book/

Finally working with web assembly and rust together. The best way to build a cross platform project or app is to use the web. 



This will probably will be my last book. At least as per the plan. I will be sharing if i discover new resources to learn. 
I am trying to restrict myself to this three book only for now. 


Do let me know if you guys already have some resources with me in the comments. 


---


### 5. Build  Large scale project <a name="building"></a>

I don't have any idea right now. I will be collecting ideas as i learn. Suggest me what i should build with rust. 

---


### 6. Large more about Atomic and Locks. 

- https://marabos.nl/atomics/


### 7. Advanced Rust

- https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/nomicon/README.html

Other Resources To learn Rust

[Interactive Book with Quiz](https://rust-book.cs.brown.edu)

Social media links 

Twitter : [@biomathcode](http://twitter.com/biomathcode)


---

### Misc
Visualizing memory layout of Rust's data types
https://www.youtube.com/watch?v=7_o-YRxf_cc
Stringsssssss
Tags: computerscience, interview, beginners, tutorial
Published: 2022-02-25 09:58:10


**A series of characters (letters, punctuation, etc.) is called a string.**

We already know one way to store a series of things—arrays. But how can an array store characters instead of numbers?

Easy. Let's define a mapping between numbers and characters. Let's say "A" is 1 (or 0000 0001 in binary), "B" is 2 (or 0000 0010 in binary), etc. Bam. Now we have characters.

This mapping of numbers to characters is called a character encoding. One common character encoding is "ASCII". 

So since we can express characters as 8-bit integers, we can express strings as arrays of 8-bit numbers characters.

Thanks for reading <3
Just an array???
Tags: beginners, computerscience, interview, tutorial
Published: 2022-02-25 09:44:07

In this post, we'll not see syntax, code and any algorithm.

It is just you and these arrays.

Ok, so we know how to store individual numbers. Let's talk about storing several numbers.

### What is array?

RAM is basically an array already.

It is a linear data structure, stores elements in contigous manner.

Each item in the array is the same size (takes up the same number of bytes).
The array is uninterrupted (contiguous) in memory. There can't be any gaps in the array...like to "skip over" a memory slot Spotify was already using.

address of nth item in array=

`address of array start + (n∗size of each item in bytes)`

Arrays have fast lookups (O(1) time), but each item in the array needs to be the same size, and you need a big block of uninterrupted free memory to store the array.

Thanks for reading
In this blog we were only discussing what exactly the array is, thatswhy not included its types, syntax and drawbacks.
尝试爆破NFT奖励时间限制 （一）
Tags: nft, solidity, vue
Published: 2022-02-25 09:36:11

## 开始

发几天文章，网站上突然有人找我，问题如下：
[你好，我有几个账户有领取某个nft的权限，但是网站活动结束了，我可以求助你写一个claim函数直接从智能合约领取吗？ | 登链社区](https://learnblockchain.cn/question/3051)
本着助人为乐，不让人失望的原则，做了一些尝试，做下记录。

这个朋友是看了我[在没有abi文件的情况下调用智能合约方法，web3py实现](https://learnblockchain.cn/article/3506)
这篇的情况下，觉得通过调用他的智能合约，就可以领取活动奖励。

## 情况分析

根据他提供的网页，了解情况，网页差异：
[Shadowy Super Coder Pack by Galaxy Space | Project Galaxy](https://galaxy.eco/galaxy/campaign/GCxMoUUmZu)
已经结束的：
![16440482411.png](https://img.learnblockchain.cn/attachments/2022/02/B0b3N0n961fe2f9aec161.png)
没有结束的：
![image.png](https://img.learnblockchain.cn/attachments/2022/02/qzFdBJcY61fe2fd1d4bbe.png)

通过对网站的观察，发现网站是vue写的，
![16440484391.png](https://img.learnblockchain.cn/attachments/2022/02/zZrzFnTj61fe304606b67.png)

观察网站流程，用正常的操作一次，发现调用的函数：
![16440485421.png](https://img.learnblockchain.cn/attachments/2022/02/TICRBPrp61fe30c18e0cb.png)

点日志就可以看到调用的函数。

另外还观察了ethscan
[Ethereum Transaction Hash (Txhash) Details | Etherscan](https://etherscan.io/tx/0x38ac1fa8e7a0d1ef42fe14423b977343acdf1afd1374affc4f95b84b6996ec45)
![16440488061.png](https://img.learnblockchain.cn/attachments/2022/02/fCIBXT5X61fe31ad041d4.png)
参数挺多，不是那么好搞。

## 确定方案

初步确定从网页入手，网页连接显示，活动结束，没有按钮点，没有按钮不说明，不能调用函数发起请求嘛。
网站的的vue sourcemap还是完整，没有这个要麻烦很多。
确定要入手的函数，点击浏览器 console信息，跳转源码：
![16440490231.png](https://img.learnblockchain.cn/attachments/2022/02/gPErwGsR61fe3288bf0e6.png)
确定，这个网站就是靠调用这个函数领奖励的。
所以想办法，在那个活动结束的网页，能调用这个函数就可以（如果他没做防护的话，找我这个朋友给我说，别人一直都在领到）

大家都知道，vue的网站，网页里的函数，是不能直接调用的。
虽然有办法使用，document.querySelector('button')获取按钮，再通过按钮发起点击事件，但是这个网页，claim这个按钮都没有。
使用得用其他方式
大家都知道，写js，js函数的this，进入了类的函数，你就能使用this，在网页发起有this调用的时候，你断住，这个时候console是可以使用this的，有了this，你就可以使用一切的vue种的函数，资源，所以这就是关键。
再次观察网页。CampaignTemplate.vue网页就是重点。
确定两个断点：

![16440498551.png](https://img.learnblockchain.cn/attachments/2022/02/3LrfI5bD61fe35cc04472.png)
回到刚才那个结束的页面，断点打好，重新刷新，见证奇迹吧！
输入this.claimDrop()

![16440500791.png](https://img.learnblockchain.cn/attachments/2022/02/pmOC3spP61fe36ab6afd8.png)

## 效果怎么样

浏览器点继续，领取claim就开始了。
很遗憾没有成功。

![16440503001.png](https://img.learnblockchain.cn/attachments/2022/02/XGoaxlJt61fe3786b2d06.png)

![16440503561.png](https://img.learnblockchain.cn/attachments/2022/02/Xdx9XXbu61fe37bc72118.png)
流程开始了，但是没有成功，发起了一个这样的Gql请求，截图是回复内容。

他的网页还是有防护的，不是不能点按钮发请求就可以，服务器对请求是有验证的。

关于网页爆破的内容，到此为止。
后面还有一系列的办法，涉及到claim函数爆破，下一篇再写。
[尝试爆破NFT奖励时间限制 （二） | 登链社区 | 深入浅出区块链技术 (learnblockchain.cn)](https://learnblockchain.cn/article/3518)
Fixed width Integer
Tags: beginners, interview, tutorial, computerscience
Published: 2022-02-25 09:27:14

**How many different numbers can we express with 1 byte (8 bits)?**

**2^8=256** different numbers. How did we know to take 2^8?

What happens if we have the number 255 in an 8-bit unsigned integer (1111 1111 in binary) and we add 1? The answer (256) needs a 9th bit (1 0000 0000). But we only have 8 bits!

This is called an **integer overflow**. At best, we might just get an error. At worst, our computer might compute the correct answer but then just throw out the 9th bit, giving us zero (0000 0000) instead of 256 (1 0000 0000)! **(Javascript automatically converts the result to Infinity if it gets too big.)**

The 256 possibilities we get with 1 byte are pretty limiting. So we usually use 4 or 8 bytes (32 or 64 bits) for storing integers.

32-bit integers have 2^{32} possible values—more than 4 billion
64-bit integers have 2^{64} possible values—more than 10 billion billion (10^{19})

**"How come I've never had to think about how many bits my integers are?" Maybe you have but just didn't know it.**

Have you ever noticed how in some languages (like Java and C) sometimes numbers are Integers and sometimes they're Longs? The difference is the number of bits (**in Java, Integers are 32 bits and Longs are 64)**.

Ever created a table in SQL? When you specify that a column will hold integers, you have to specify how many bytes: 1 byte (tinyint), 2 bytes (smallint), 4 bytes (int), or 8 bytes (bigint).

In big O notation, we say fixed-width integers take up constant space or O(1) space.

And because they have a constant number of bits, most simple operations on fixed-width integers (addition, subtraction, multiplication, division) take constant time (O(1)O(1) time).

So fixed-width integers are very space efficient and time efficient.

But that efficiency comes at a cost—their values are limited. Specifically, they're limited to 2^n2 possibilities, where nn is the number of bits.

Thanks for reading <3
Object Oriented Programming (OOP)
Tags: oop, beginners, programming, tutorial
Published: 2022-02-25 09:02:40

## What is OOP ? 

Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects.


![oop Pic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fji9i7xywfn6roxssum5.png)

## Advantage :

- Reusable, objects can be used across programs

- OOP models complex things as reproducible, simple structures

- Easier to debug, classes often contain all applicable information to them

- Secure, protects information through encapsulation


## Structure of OOP :

_The structure, or building blocks, of object-oriented programming include the following:_

 - Classes 

 - Objects 

 - Methods 

 - Attributes 

##  Main Principles of OOP :

- Encapsulation

- Abstraction

- Inheritance

- Polymorphism

**Programming languages designed primarily for OOP include:**
Java,Python,C++

**Other programming languages that pair with OOP include:**
PHP,JavaScript
React typescript
Tags: javascript, typescript, react
Published: 2022-02-25 08:59:15

Recently I am working on a large-scale project using MERN and typescript. We are using typescript because we can handle most of the errors easily before publishing the project at the production level. As far I understood It is a strict superset of JavaScript that adds optional static typing and class-based, object-oriented programming to the language. Sometimes it is very painful to set the types for values. Also sometimes it is hard to understand what type would be for the value. 
If the state will be a string then we need to set the typed string and if the state is an array string we need to type like this way string[]. All element default value is any which is not recommended to use, otherwise, we will face some error in the frontend if the data pass wrong data. There is a file called tsconfig.json in each project's root folder that contains instructions for TypeScript. It loads the tsconfig.json file and uses its settings to build the project when it finds it.

As I am using react. I think TypeScript and React are a perfect fit. I am enjoying combining both technologies together to get a huge productivity boost when writing my applications!

There are some pros and cons to typescript  which is:
**Pros:**
We will get an instant error if we set any wrong property so that we can fix it instantly.
Readable, easily understandable code
Better support for JSX

**Cons:**
Sometimes we need to use NPM packages, if the package does not have any typescript version then we can not use it.
Git/Github workflow and Tips 

Tags: github, git, career, programming
Published: 2022-02-25 08:52:10

This post is written to guide and help the junior software developers. I want to share the useful tips and information I learned about Git/Github during my first 3 months of experience.

- Before starting to work, always pull the latest from the master.
- Always work on a separate branch.
- Prevent direct commits, don't `git push` straight to the master.
- All commits should be pushed to the master through "pull requests".
- Pay attention to branch naming conventions.
- Write meaningful commit messages. You can use “verb + context” pattern when commenting on descriptions in PRs. e.g: fixed card width.
- Make sure to write a PR description about the work you have done or the problems you encounter.
- Track the PRs that you created. Don’t forget to check all the changes requested and pipelines. Make sure all checks have passed.
- Avoid committing large files. Optimum commit is between 300-500 lines of code.
- Delete outdated branches.
- Always check your github notifications.

**Some useful git commands:**

- `git diff` (shows unstaged changes since last commit)
- `git reset` <filename>(undoes git add before commit)
- `git log` (shows a list of all the commits made to a repository)
- `git push –no-verify` (uploads local repository content to a remote repository without verification) 
- `git status` (gives all the necessary information about the current branch)
- `git branch` (viewing branches)
- `git branch -r` (shows your remote branches)
- `git checkout -b <branch-name>` (creates a new branch)
- `git checkout -` (switches back to previous branch)
- `git checkout -- .` (cancels all changes for the current branch you're working on)
- `git reset --hard origin/master` (this commands  basically  forgets everything on your current local branch and makes it exactly the same as the origin/master)

**How to merge your current branch with another branch?**

Step 1: Commit and push your changes to your current branch.
Step 2: Switch from your current branch to the branch you want to merge.
Step 3: `git pull`. Make sure the branch you want to merge  has the latest version before you merge your branches, otherwise you may face conflicts or other problems.
Step 4:`git merge <branch-name>` you can merge your feature branch into the branch you want to merge.
Step 5: push your changes.

**How to resolve conflicts?**

Step1: To resolve a conflict git checkout master and pull the latest.
Step2: `git checkout <target branch>`.
Step3: `git merge master`

After this process if everything is fine no error message will appear. If it's not, a message will appear that says "This branch has conflicts that must be resolved". In this stage you'll need to fix the conflict manually in Github or your code editor. Open your code editor and accept the current changes (what's on your branch), incoming changes (master) accept one of these options or both according to your needs.
Minimal create-react-app
Published: 2022-02-25 08:48:06

## The problem:
When I start a new create-react-app (CRA), it has a lot of files and stuff I don't need. This includes:
- `reportWebVitals`(Analytics and performance, etc.)
- `logo.svg` and some other stuff to create the React "Hello World" app.
- `setupTests.js`, and other test related defaults.
Although I might be yelled at for saying: "I don't need testing", I just don't need it for smaller prototype setups.

## The solution
When I tried to research for a solution for this problem (fancy way of saying, I googled it), I encountered a post on Stackoverflow, and I am obviously not the only one with this problem, so a guy from CRA (if I remember correctly), commented and mentioned they have developed `templates` to satisfy users which had a different workflow than the default one.
And that I could find all the templates available on npm, simply by searching for [cra-template-*](https://www.npmjs.com/search?q=cra-template-*).

Here I found the [template I was looking for](https://www.npmjs.com/package/cra-template-minimal) and can now create my simple and basic CRA Apps, simply by typing:
```bash
npx create-react-app my-app --template minimal
```