teleren/devto huggingface dataset:
you may need this - bash script
Tags: scor32k, bash, beginners, programming
Published: 2023-09-12 13:40:56

I created a bash script for handling


`git add.`, `git commit -m ""` and `git push`


Don't ask why,
Yes, I will tell
For a developer, these 3 commands are the most important to work on on a daily basis.


But it's a little bit time-consuming—not much, but 2 seconds, I can say.


So I created this script.
Follow me.


### Create a file
```bash
vim gitpush.sh
```
### The **Code**
```shell
#!/bin/bash
git add .
git commit -m "$1"
git push
```

Each line explanation: 
  
`#! -> bash shebang`

git add . -> add all the files to staging

git commit -m "" -> write changes permanently.

git push -> push to the remote origin.



### Exit **the vim**
   
    a. Enter `Esc`

    b. Enter `:`
  
    c: Enter `wq`

    ![exit vim](https://imgur.com/XA9IOdC.png)


The entire file should be like this:

![entire process](https://imgur.com/PglpMBb.png)


Now we need to give execute permission to the file.
Follow the command.

```bash
chmod 700 gitpush.sh
```

<details>
<summary>Command breakdown</summary>
chmod: This is used to change the file permissions.
700: 700 is divided into 3 groups: a) 7, b) 0, and c) 0.

**a**) refers to the current user.
**b**) refers to the group
**c**) refers to other users in the system.

Group **a** is 7, which means the current user has all the permissions. You can understand this by

  [
  4: for read,
  2 for write,
  1 for execute
  ]

So, 7 = 4 + 2 + 1, so the current user will have all the permissions.

0 means no permissions.
</details>


The entire steps will look like:

![entire step](https://imgur.com/CbtNfLo.png)


The gameplay:

![gameplay](https://imgur.com/9Jj7Hhk.png)

As you can see, I have used the absolute path of the file with just the commit message. Liek simple.


But, 
In bash, we can use alias to avoid typing the file path every time.

Follow me:
### Go to the Home directory

```shell 
cd ~
```

### Open your shell script; I'm using zsh.

```shell 
vim .zshrc
```

If you are using bash, it must be `.bashrc`. You can check that by

```shell
echo $SHELL
```

### The core command

```bash
alias -g gitpush='/home/scor32k/blogs/scripts/gitpush.sh $1'
```

restart the shell (close the terminal and open again). This will globally set the alias.


Now the fun
Follow

![final](https://imgur.com/rkkWiJV.png)


I have only used

```bash
git push "commit message"
```
and all three imp git commands are done.


This was just a fun project. I thought of creating
Rumola Bypass Captcha - 2Captcha
Published: 2023-09-12 13:37:09

| [2captcha.com](https://share.kz/g5Dv)

Rumola is a browser extension that automatically solves captchas on websites. It is designed to make the process of solving captchas faster and more efficient for users. However, Rumola is not always effective in solving all types of captchas. Fortunately, 2Captcha offers a reliable solution to bypass captchas that cannot be solved by Rumola.

2Captcha is a captcha solving service that provides an API for developers to programmatically solve captchas. The service uses real humans to solve captchas, which ensures a high success rate and accuracy. With 2Captcha, developers can easily integrate captcha solving into their applications and automate the process of solving captchas that cannot be solved by Rumola.

**Here are the steps to bypass captchas using 2Captcha:**

1. Get the site key and page URL: To bypass captchas, you need to get the site key and page URL from the website where the captcha is located.

2. Send the captcha to 2Captcha: Once you have the site key and page URL, you can send the captcha to 2Captcha using their API. The service will then use real humans to solve the captcha and return the solution in the form of a token.

3. Submit the token: Finally, you need to submit the token to the website where the captcha is located. This will prove that you are human and allow you to access the website's services.

2Captcha offers a variety of example scripts and video tutorials to help developers integrate their API into their applications. The service also supports a wide range of programming languages, including PHP, Java, Python, Go, C++, and more.

In conclusion, Rumola is a useful browser extension for solving captchas, but it may not always be effective in solving all types of captchas. 2Captcha offers a reliable solution to bypass captchas that cannot be solved by Rumola. With 2Captcha, developers can easily integrate captcha solving into their applications and improve the user experience for their customers.
Day 46: Memoization
Tags: javascript, typescript, 100daysofcode, day46
Published: 2023-09-12 13:30:00

### What is Memoization?

Memoization is a technique used to store the results of expensive function calls and return the cached result when the same inputs occur again. It's like having a crystal ball that remembers previous calculations and can instantly provide answers.
🪄

### Creating the Memoization Decorator

Let's create a TypeScript decorator that can memoize the result of a function. We'll call it `@memoize`. 📝

```typescript
function memoize(target: any, key: string, descriptor: PropertyDescriptor) {
  const originalMethod = descriptor.value;
  const cache = new Map();

  descriptor.value = function (...args: any[]) {
    const key = JSON.stringify(args);
    if (cache.has(key)) {
      return cache.get(key);
    }

    const result = originalMethod.apply(this, args);
    cache.set(key, result);
    return result;
  };

  return descriptor;
}
```

### Applying Decorator


```typescript
class Calculator {
  @memoize
  static fibonacci(n: number): number {
    if (n <= 1) return n;
    return this.fibonacci(n - 1) + this.fibonacci(n - 2);
  }
}
```

By adding `@memoize` to the `fibonacci` method, we're telling it to cache the results. As a result, subsequent calls with the same argument won't recalculate the Fibonacci number, making our code much faster! 🚀

### Example

```typescript
console.log(Calculator.fibonacci(40)); // Calculates Fibonacci(40) and caches it
console.log(Calculator.fibonacci(40)); // Returns the cached result instantly
```

### Benefits of Memoization with Decorators

- **Performance Boost**: Memoization can drastically reduce the execution time of functions with expensive calculations.
- **Simplified Code**: You don't need to manually implement caching logic in your functions; decorators handle it for you.
- **Readability**: Code using decorators is more concise and easier to understand.

### Considerations

- Be cautious when using memoization for functions with a large number of potential input values, as it can lead to excessive memory usage. Always evaluate your use case.
Update on huetiful-js v1.5
Tags: javascript, webdev, color, opensource
Published: 2023-09-12 12:23:24

The way software evolves is a matter worth pondering. Over the past few weeks I've seen my package evolve and its API morph over time. I have witnessed the number of downloads of the npm rise and fall like waves in the sea. What I fail to understand so far is why my project has not gathered much attraction on GitHub so far (6 stars so far, not bad for a first project but I was expecting more for the coding hours spent lol). 
  
 Today I released minor version 1.5 of the project and I'm hoping to see changes since I have addressed a lot of hidden bugs, some of which were so critical that they compromised the actual functionality of autility. 
  
 ###  Added features  
  
 Well, for starters, I added a 2 new factors for the `sortBy` and `filterBy` module. 
  
 - sortByContrast 
 - sortByDistance 
 - filterByDistance 
 - filterByContrast 
  
 These utilities apply the respective base functionality based on contrast and Euclidean distance. Of course, the functions make use of Culori under the hood to perform the computations necessary needed for the functionalities to work. 
  
 The minor version also comes along with utilities for fetching data of statistical importance such as the smallest hue in a collection of colors.  
  
 ### Bugs addressed 
  
 Open source software is always a work in progress and sometimes the lack of an active user base makes it take longer to address certain issues in a project. 
  
 The filterByTemp and sortByTemp utilities were not working as intended because of a bug that was caused by precision loss when I had refactored the `rgb2temp` and `temp2rgb` modules to use lodash utilities under the hood for arithmetic operations. The functions responsible for determining the factors needed to sort/filter the colors from collections were throwing only a single value which caused the utilities to hang and not return a value. I addressed the issue by using the simple arithmetic operators on the values necessary for generating the filtering/sorting values. I've learned that over engineering can cause the total opposite of what a developer intended. 
  
 I also extended expression parsing to other core utilities which can mutate colors such as `alpha` , `darken/brighten` 
  
  
 I'm grateful for the support that is coming from the open source community as we work towards making color science in code accessible and easy to use with as low a learning curve as possible. 
  
  
 ### Conclusion 
  
 For more information on the changes you can visit the project repository on [GitHub](https://github.com/prjctimg/huetifulhttps://github.com/prjctimg/huetiful) or download the package on [NPM](https://npmjs.com/packages/huetiful-js) . Contributions of any kind are welcome! 
  
 May the FOSS be with you👽🛸
using fetch on http server
Tags: react, javascript, node
Published: 2023-09-12 13:26:53

hello, new here btw, I'm having a problem when trying to run my react app's build on the internet. The problem is that even if I hardcoded the URL as http://"server's IP address" on fetch, react or fetch try to fetch on https://"server's IP address" this must have an easy solution I simply couldn't find it. Thanks!
Synapse Liquidity Shakeup: Unmasking the 9 Million SYN Token Sell-Off
Tags: token, cryptocurrency, blockchain, bitcoin
Published: 2023-09-12 13:19:22

The blockchain and crypto industry reverberated with intrigue as an undisclosed liquidity provider, intricately linked with the Synapse crosschain bridge, executed a sweeping sale of 9 million SYN tokens. This sudden maneuver precipitated a substantial plunge in the asset's market valuation, denting it by a staggering 25%, from $0.40 to $0.31, as reported by the vigilant blockchain observer, Soingecko. A closer examination of Etherenscan data unveiled the details: the SYN tokens exchanged hands for $2.35 million at an average rate of $0.26 per token.

While this precipitous liquidity event did indeed impact Synapse's market dynamics, Synapse moved swiftly to clarify that the asset's depletion was not triggered by any exploits or breaches of security within the crosschain bridge. In an official statement, Synapse unequivocally stated, "Today, liquidity provider Synapse sold all of its SYN tokens and removed liquidity. There were no protocol or bridge security breaches."

Insiders within the Synapse ecosystem have suggested that the enigmatic liquidity provider could have affiliations with Nima Capital, a prominent long-term partner of the project. DeFi Llama, a noted source in the decentralized finance arena, has reported Synapse's impressive Total Value Locked (TVL) exceeding $113 million, coupled with a formidable market capitalization exceeding $67 million.

This episode of an unexpected [token sale](https://btcnews.biz/ico/massive-token-sale-by-liquidity-provider-triggers-25-plunge-in-syn-token-value/) unfurls a captivating narrative, echoing the ever-vigilant nature of the blockchain realm. It serves as a testament to the importance of transparency and resilience in a landscape characterized by dynamic shifts and unforeseen developments.
Simple, yet easy-to-miss errors in code
Tags: cpp, programming, coding
Published: 2023-09-12 13:07:10

A user wrote to our support about a strange false positive issued by the [PVS-Studio](https://pvs-studio.com/en/?utm_source=pie&utm_medium=DEV) analyzer. Let's see why this case deserves a separate note, and why developers don't notice this simple error.

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

From time to time, users send us various C++ code. From their point of view, the PVS-Studio analyzer has issued strange/false warnings on these fragments. Then, we enhance diagnostics or write down ideas for future fixes. In other words, a routine support job.

But not this time. The developer who received the email from the user eagerly ran to me with the idea of writing about this case. We can't reveal the user's name or show their code. So, here is a rewritten and shortened version:

```
char *SomeGlobalPointer {};

void foo()
{
  SomeGlobalPointer = new char[1024];
}

int main()
{
  foo();

  if (!SomeGlobalPointer)
  {
    delete[] SomeGlobalPointer;
  }

  return 0;
}
```
A developer from the user's team says that PVS-Studio issues a "false-positive" warning:

V575 The null pointer is passed into 'operator delete[]'. Inspect the argument.

> So, why do we think that it is a null pointer? Look! It's explicitly initialized in the function.

This is an interesting case when the code seems so simple that the developer doesn't see the error. The code for memory deallocation is dull, which makes it difficult to look into the code carefully during code review. I've described a similar case before. You can read about it in the article: "[The evil within the comparison functions](https://pvs-studio.com/en/blog/posts/cpp/0509/)".

Actually, here is an inconspicuous typo in the condition:

```
if (!SomeGlobalPointer)
{
  delete[] SomeGlobalPointer;
}
```
The operator _delete[]_ is called only if the pointer is null. A memory leak occurs as a result. Indeed, the condition needs to be inverted:

```
if (SomeGlobalPointer)
{
  delete[] SomeGlobalPointer;
}
```
In fact, the check is unnecessary. The operator _delete[]_ correctly handles null pointers. Let's simplify the code:

```
char *SomeGlobalPointer {};

void foo()
{
  SomeGlobalPointer = new char[1024];
}

int main()
{
  foo();
  delete[] SomeGlobalPointer;
  return 0;
}
```
Since we're talking about refactoring, we also suggest to use a smart pointer here (we can optionally use std::unique_ptr or std::shared_ptr). Sure, the code looks odd. But don't forget that the example given in the article is synthetic. However, we've digressed from the main point.

It's a beautiful typo, isn't it? The error is so simple that the developer missed it even when the analyzer issued a warning for this code. Instead, the developer wrote us an email, saying that the analyzer messed up and issued a false positive because of using a global variable.

If PVS-Studio had not assisted, this error would still remain in the code and lead to a memory leak.

Praise static code analysis! Boost your code review efficiency and let the analyzer assist you!
Leet Code 75–283. Move Zeroes
Tags: java, interviewquestions, twopointers, leetcode
Published: 2023-09-12 13:05:27

This is an easy [problem](https://leetcode.com/problems/move-zeroes/) with the description being:

> Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.

> Note that you must do this in-place without making a copy of the array.

> Example 1:
> Input: nums = [0,1,0,3,12]
> Output: [1,3,12,0,0]

> Example 2:
> Input: nums = [0]
> Output: [0]

> Constraints:
> 1 <= nums.length <= 104
> -231 <= nums[i] <= 231 - 1

Here as the name of the problem says is about moving zeroes around the array, maintaining the order.

To get this sorted out you need to move and stack the amount of zeros as you iterate the list, like a snowball effect.

Every time you encounter an zero you increase the counter, if is not a zero then you add value on a temporary variable and replace the value with zero and use the counter to get the right index for that temporary value new index position to be set.


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

The image bellow illustrates the idea. The green represents the index, the blue box the numbers that will swap, the red is the zero count.

Basically you use the zero count with the index position to determine where the swap will occur.

```java
class Solution {
    public void moveZeroes(int[] nums) {
        int zerosCount = 0;
        
        for(int i=0 ; i<nums.length ; i++) {
            if(nums[i] == 0) { // don't need to swap, just update counter
                zerosCount++;
            } else if(zerosCount > 0) { // if zero counts is 0 there is no need of array update
                final int temp = nums[i];
                nums[i] = 0;
                nums[i - zerosCount] = temp;
            }
        }
    }
}
```

> Runtime: 2 ms, faster than 61.61% of Java online submissions for Move Zeroes.

> Memory Usage: 45.2 MB, less than 44.67% of Java online submissions for Move Zeroes.

This technique is called **two pointers** because you use two identifiable pointers to determine how to arrange the order and get the result (first one being i and the second zerosCount variable).

---

That’s it! If there is anything thing else to discuss feel free to drop a comment, if I missed anything let me know so I can update accordingly.

Until next post! :)
In-context, on-page editing in React, Vue, Svelte and other frameworks
Tags: react, svelte, vue, cms
Published: 2023-09-12 13:02:00

Dear fans of React, Vue, Svelte and other frontend frameworks:

How do you feel about the way these integrate in CMS projects? Is on-page editing an important feature for you? Would you prefer to solve that in the context of a full-featured frontend framework, like NextJS or Astro? Or do you just want the CMS to let you write all your templates in React instead of a legacy template language?

Thanks for your feedback!
Programming Languages as Super Heroes Comics!!
Tags: beginners, programming, python, opensource
Published: 2023-09-12 13:00:00

Hello Everyone, Today we Might Bring something a little Different for you! 

We on the team had a very creative idea and thought about giving some programming languages to AI and ask them how would they be if they were Superheros in a comic book, Can you imagine reading a super history about Python & Java helping the city? Haha!


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


---


### The Python Power

I honestly didn't see python as strong, I thought it would look more lie Reed Richards on the comics, but no, We got ourself Captain America!

So For those Python users, you're as Strong as Captain America!

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

---

### Flash? Or JavaScript 

Okay, I really like his look like reverse flash, that's why JavaScript is trying to run and beat C++ haha!

Maybe you guys are that fast, uh!

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

---

### Java!

This is my favourite so far because java is always there trying to sneaky on us but remember that if you write your code in java it will be read anywhere 

Write once, run anywhere


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

---

### The super Power of R 

Okay, this is giving vibes more like Journalist, so who it is? it can't be anyone in the office that you work at or anyone in the streets but he's always on the look out.


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

---

### C++ and his powers 

Okay, this is very strange but he kinda looks like Super man and batman at the same time?


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

---

### ⭐️IDURAR⭐️
IDURAR is Open Source ERP / CRM (Invoice / Inventory / Accounting / HR).

- Ant design framework
- Build with Mern stack Node.js / Express.js / MongoDb / React.js
- Redux state manager✨
- ERP/CRM
- Inventory & Accounting 

[![Open Source ERP / CRM ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5q8hkcx90gfqlgz3qban.png)](https://github.com/idurar/idurar-erp-crm)

Github Repository: https://github.com/idurar/idurar-erp-crm

---
### Thank You everyone 

Don't forget to Leave a Star on our project!!

I hope you liked to see our Super Heroes and if you have any other idea for programming languages, why don't you share with us in the comments, so we can do more heroes!


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

Best regards,
The [idurar-erp-crm](https://github.com/idurar/idurar-erp-crm) Team
Keyoxide verification
Published: 2023-09-12 12:39:23

This is an OpenPGP proof that connects my OpenPGP key to this forem instance. For details check out https://keyoxide.org/guides/openpgp-proofs

[Verifying my OpenPGP key: openpgp4fpr:74b1f67d8e43a94a755407689ccce36402cb49a6]
6 Best Practices to Follow Before Deploying Next.js to Production 🚀
Tags: webdev, beginners, nextjs, react
Published: 2023-09-12 12:29:32

Read this guide to get useful insights and best practices on how to prepare your Next.js site for production!

Next.js is a flexible framework based on React, a JavaScript library for building interactive user interfaces1. It provides the building blocks to create fast web applications.

Is important your team or team's know how to optimize the application for end-users.

In this post, you will dig into the commons strategies and best practices to deploy Next.js to production!

**1. Use always Image Optimization**

_next/image_ exposes an _<Image>_ component that extends the traditional HTML _<img>_ element with automatic image optimization capabilities.

**2. Use Font Optimization**

_next/font_ optimizes local fonts and removes external network requests for improved privacy and performance. As of Next.js 13, it supports self-hosting on any Google Font to avoid making requests to retrieve font files from Google.

**3. Use Script Optimization**

_next/script_ offers a _<Script>_ component that extends the traditional HTML _<script>_ tag by allowing JavaScript scripts to be loaded only once across multiple pages.

**4. Integrate an Analytics or APM Tool**

Once a Next.js site is in production, you need a way to track its performance. In particular, you should have a system in place to monitor page views and get information about site traffic.

When deploying to Vercel, you can achieve that with Next.js Speed Insights. This tool allows you to analyze and measure the performance of your application’s pages using various metrics.


**5. Enable Error Handling With Custom 500 and 400 Pages**

Like any other application, Next.js sites are subject to errors. One of the most important aspects of error handling is presenting meaningful error messages to users to inform them of what happened. When an error occurs in the frontend or backend, Next.js displays static 500 page.


**6. Optimize Page SEO Performance With Lighthouse**

The ultimate goal of most Next.js sites is to produce excellent SEO results. Google has changed its approach to SEO performance evaluation a great deal over time, and it now focuses primarily on Core Web Vitals:


READ MORE: https://www.codemotion.com/magazine/frontend/optimize-next-js-for-production/
RELIANOID Project
Tags: sre, loadbalancing, network, adc
Published: 2023-09-12 12:22:10

We’re so glad to present the Relianoid project! The core and brain of Zevenet and Zen Load Balancer now creates Relianoid, where a multi-disciplinary and highly trained team continues with the Open ADC vision with improved QA for an advanced system hardening latest high-tech thanks to our own R&D, and more globalized services to deliver the next level of the Site Reliability Engineering (SRE) solutions. Welcome onboard to the Site Reliability Experience with Relianoid!