teleren/devto huggingface dataset:
Cryptographic Hash Function
Tags: blockchain, cryptography, web3, tutorial
Published: 2023-03-14 10:23:39

Cryptographic Hash Function also known as (Hash Function or Hash) are strings of characters of any length that are converted when inputted into an encrypted output of a fixed length size that is in most cases irreversible.

Cryptographic hash functions are essential when building a decentralized trust protocol because when inputting the string (dark wallet puzzle) in a cryptographic function it will always produce the same hash result. Any small changes on the target string for a hash function lead to outsized effects. Change one letter in the string you hashed in above, it may be as simple as capitalizing the "d" but it will go a long way toward changing the way the hash looks completely.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xf70n1446hysrzclb51n.png)
[Interactive Code: Cryptographic Hash Function Sandbox](https://emn178.github.io/online-tools/sha256.html) A, simple nice way to see the characteristics of hash functions.

**The Three Main Properties Hash Function**

**Uniqueness** You can be rest assured that if you put in the string dark wallet puzzle in a cryptographic function, it will always produce the same hash outcome. This avoids the “hash collision” problem, in that we don’t have to worry about two strings getting the same hash result.

**Avalanche Effect** No matter how small you change the value you passed to the hash function, it leads to huge effects. Change one letter in the string you hashed just like in the image above where I capitalised the "d" in Dark wallet puzzle. You'll see it did not change a little bit but a lot. This illustrates the second characteristic of a good hashing function — “The Avalanche Effect”. This says a single change in the string passed will cause a successive series of changes.

**Speed** The Cryptographic hash functions can also run incredibly fast with little overhead and still maintain their security. This is more of a logistical concern. The hashing function can’t be too slow, otherwise it causes delays. But it also can’t be too fast or it will be easier to find collisions. It needs to be fast for processing but slow for hacking. 

Reference | Resources

[Article: How Hash Algorithms Work](https://www.metamorphosite.com/one-way-hash-encryption-sha1-data-software)
[Article: Cryptographic Hash Function (Wikipedia)](https://simple.wikipedia.org/wiki/Cryptographic_hash_function)
How to Moq ILogger for .net core unit test
Tags: csharp, testing, moq
Published: 2023-03-14 10:21:33

Using Moq, you can create custom implemenation of your service layers.  But what about the standard items we inject into classes such as logging or configuration.

To mock an instance of Microsoft.Extensions.Logging so you can pass it to your underlying class, you create an Mock of ILogger and inject it.

var logger = Mock.Of<ILogger<XXXXXQueryHandlerTests>>();
var xXXXProvider = new XXXXProvider(httpClient,logger,null);

Where the XXXXProvider class has _logger injected into it and you cannot just mock it up.
JavaScript : Void Operator
Tags: javascript, webdev, beginners, programming
Published: 2023-03-14 10:08:52

Are you familiar with the void operator in JavaScript? It's a little-known but powerful feature that can come in handy when working with certain types of data.

In JavaScript, void is a unary operator that takes an expression as its operand and evaluates it to be undefined. Although doing this can seem unusual, there are several situations in which it might be advantageous.

Making a link that doesn't actually go somewhere is one of the most frequent uses of void. You might, for instance, want to design a button that, when clicked, executes some action, but you don't want the visitor to be directed to a different website. An empty link known as a "dummy" link can be made by setting the href attribute of an anchor element to javascript:void(0).

Forcing the browser not to follow a link after it has been clicked is another application for void. You may stop the default action of a link by adding an event listener to it and using event.preventDefault() in the listener (i.e. navigating to a new page). But, some older browsers don't support preventDefault(), thus using void can be a more certain way to get the same effect.

Overall, void might not be the most commonly used feature in JavaScript, but it can definitely come in handy in certain situations. Have you ever used void in your own code? Let me know in the comments! 💭


```
<button onclick="myFunction()">Click me</button>

<a href="javascript:void(0)" onclick="myFunction()">Click me instead</a>
```
The Ultimate Guide to VSCode Keyboard Shortcuts
Tags: webdev, beginners, programming, vscode
Published: 2023-03-14 09:51:45

**Keyboard shortcuts** are an essential aspect of any software development environment. It allows developers to work faster and more efficiently by reducing the time spent switching between keyboard and mouse. Instead, devs can execute commands quickly and easily using a combination of keys.

**VSCode** is a popular code editor that offers a wide range of keyboard shortcuts. In this article, we will explore some of the most useful keyboard shortcuts in VSCode.

By the end of this article, you will have a solid understanding of some of the most important keyboard shortcuts in VSCode, and you will be well on your way to becoming a keyboard shortcut ninja!! 😎

Here are some of the keyboard shortcuts you will learn in this article. For a detailed list with visual representation, check out Canopas' Blog.

**NOTE: All the shortcuts described inside the brackets are for macOS.**

Basic navigation shortcuts

- **Ctrl + P**: Quickly open files by typing their name
- **Ctrl + Tab (Ctrl + Shift + Tab)**: Switch between open files
- **Ctrl + 1–9 (Cmd + 1–9)**: Jump to a specific tab
- **Ctrl + B**: Show/hide the sidebar
- **Ctrl + Shift + E (Cmd + Shift + E)**: Show/hide the file explorer
- **Ctrl + Shift + F (Cmd + Shift + F)**: Search in files
- **Ctrl + F (Cmd + F)**: Find in the file

Please note that if these shortcuts don't work for you,

- Try checking if it’s listed at `**File -> Preferences -> Keyboard Shortcuts.**`
- If it’s listed there but has a different shortcut, it might be possible you’ve customized it before! just start using the same or modify it as you need.

If it’s not listed there, install an extension `Duplicate selection` from the `Extensions` tab.

Voila! you should find it working 🎉.

For more shortcuts, check out [Canopas Blog](https://blog.canopas.com/the-ultimate-guide-to-vscode-keyboard-shortcuts-boost-your-productivity-today-ac1a1ae0232a).
Verify Signature Solidity in Foundry
Tags: solidity, ethereum, blockchain, web3
Published: 2023-03-14 08:57:29

Here is a minimal (copy and paste) example of how to safely create and verify ECDSA signatures with OpenZeppelin in the [Foundry](https://book.getfoundry.sh/) environment.

## Contract: Verifier.sol
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

contract Verifier {
    using ECDSA for bytes32;

    address public verifyingAddress;

    constructor(address _verifyingAddress) {
        verifyingAddress = _verifyingAddress;
    }

    function verifyV1(
        string calldata message,
        bytes32 r,
        bytes32 s,
        uint8 v
    ) public view {
        bytes32 signedMessageHash = keccak256(abi.encode(message))
            .toEthSignedMessageHash();
        require(
            signedMessageHash.recover(v, r, s) == verifyingAddress,
            "signature not valid v1"
        );
    }

    function verifyV2(
        string calldata message,
        bytes calldata signature
    ) public view {
        bytes32 signedMessageHash = keccak256(abi.encode(message))
            .toEthSignedMessageHash();
        require(
            signedMessageHash.recover(signature) == verifyingAddress,
            "signature not valid v2"
        );
    }
}
```

## Test (Verifier.t.sol)
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "forge-std/Test.sol";
import "../src/Verify.sol";

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "forge-std/console.sol";

contract TestSigs1 is Test {
    using ECDSA for bytes32;
    Verifier verifier;

    address owner;
    uint256 privateKey =
        0x1010101010101010101010101010101010101010101010101010101010101010;

    function setUp() public {
        owner = vm.addr(privateKey);
        verifier = new Verifier(owner);
    }

    function testVerifyV1andV2() public {
        string memory message = "attack at dawn";

        bytes32 msgHash = keccak256(abi.encode(message))
            .toEthSignedMessageHash();

        (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, msgHash);

        bytes memory signature = abi.encodePacked(r, s, v);
        assertEq(signature.length, 65);

        console.logBytes(signature);
        verifier.verifyV1(message, r, s, v);
        verifier.verifyV2(message, signature);
    }
}
```

This will work even if you change the data type from "string" to something else.


Note that OpenZeppelin supports two ways to represent the signature. It's generally more convenient to use the bytes version because this is only one extra piece of data to pass around. Note however that ERC20-Permit uses the three part signature `(r, s, v)`.

This article was originally published [here](https://www.rareskills.io/post/openzeppelin-verify-signature).

## Learn More
This article is used as reference material in our [Solidity Bootcamp](https://www.rareskills.io/solidity-bootcamp).
Linkshare - a GitHub Pages template to store links and share them on social media
Tags: github, socialmedia, links
Published: 2023-03-14 09:29:49

---
title: Linkshare - a GitHub Pages template to store links and share them on social media
published: true
description: Scratching my own itch
tags: github, socialmedia, links
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-14 09:19 +0000
canonical_url: https://christianheilmann.com/2023/03/14/linkshare-a-github-pages-template-to-store-links-and-share-them-on-social-media/
---

With Twitter shutting down its APIs my automatic bookmarking of links broke, so I thought I use GitHub and GitHub pages to store links I talked about instead. Enter [Linkshare](https://github.com/codepo8/linkshare), a GitHub Pages template that makes it simple to copy your links in a shareable format to use on Twitter, Mastodon, LinkedIn, etc… 

[![Video recording of linkshare in action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/727bpiggphhmp9gwx2uh.gif)](https://github.com/codepo8/linkshare)

You can see it in action at https://codepo8.github.io/linkshare/ and also see my own links at https://codepo8.github.io/links/ .

Features include: 

* Link categories are markdown lists of links in named documents
* Dark/Light theme automatically applied
* Customisable template for the copied share text 

You can read up all on customisation in the [readme.md](https://github.com/codepo8/linkshare/blob/master/README.md).

To host linkshare yourself, fork it and [set up GitHub Pages for the repo](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site#creating-your-site).
Essential SQL Commands for Data Science
Published: 2023-03-14 09:29:34

 
As a data scientist, there are several SQL commands that are essential for working with databases and performing data analysis. Some of the most important SQL commands for data science include:
1)SELECT: It is used for retrieving data from one or more database tables. It allows you to specify the columns you want to retrieve and the conditions for filtering data. 
2)WHERE: It is used to filter data based on specific conditions. It allows the user to specify one or more conditions that must be true for the data to be included in the results.
3)GROUP BY: It is used to group data by one or more columns. It is often used with aggregate functions like sum, count, average, and max to calculate summary statistics for each group.
4)ORDER BY: It is used to sort data by one or more columns. It allows you to specify the column(s) to sort by and the direction of the sort (ascending or descending).
5)JOIN: It is used to combine data from two or more tables based on a common column. There are several types of joins, including inner join, left join, right join, and full outer join. union: this command is used to combine the results of two or more select statements into a single result set. It is similar to join, but it does not require a common column between the tables.
6)HAVING: It is used to filter data based on conditions that apply to groups created by group by. It allows you to specify one or more conditions that must be true for a group to be included in the results.
7) FROM: It is used to specify the table or tables from which you want to retrieve data.
These SQL commands are essential for data scientists who work with databases and need to retrieve, filter, and analyze large amounts of data. By mastering these commands, you can perform complex queries and gain insights from your data more efficiently.
Digital Marketing DMA
Tags: dmagency, digitalmarketingdma
Published: 2023-03-14 09:06:21

"Tăng X10 doanh thu với chiến lược Digital Marketing tổng thể và SEO ROCKET hiệu quả.
Địa chỉ: 16 Hoa lan, Phường 2, Quận Phú Nhuận, Hồ Chí Minh
Tel : +84967379001
Email: 
Website: [https://dmagency.vn/](https://dmagency.vn/)
Map: [https://goo.gl/maps/Q6X1eFD9RcSvpvEv7](https://goo.gl/maps/Q6X1eFD9RcSvpvEv7)
Hastags, tag: #dma #digitalmarketingdma #dmagency #agencydma"
We are inundated with programming languages.
Tags: python, julialang, programming
Published: 2023-03-14 09:04:10

If you take the time to observe the trends of well-structured training opportunities in the fields of data science, machine learning, or artificial intelligence, you will find that there is, at some point, an emphasis on using programming languages. Interestingly, in some universities across the world, you may find that some graduates from these institutions lack skills in coding and programming. In the marketplace, several employers are looking for smart individuals skilled in coding and programming.

A degree from a university does not necessarily convince employers that you are capable of coding or programming. In fact, I have heard that some companies do not even consider resumes or CVs as the foundation or primary reason to hire someone. Recruiters, although these documents can provide a quick overview of your professional growth, are also looking for portfolios that showcase your abilities to tackle certain world problems or challenges, depending on your area of interest.

A careful observation of graduates reveals that some individuals seem to have a long journey to become adapted to what employers are looking for. Even those graduates who aspire to work independently may lack programming skills.

Therefore, our education system, if its purpose is to train the future generation with a lifelong learning spirit, should be revised to keep up with the demands of the job market. The tech world is moving at a faster pace than the traditional education system.

Lambert KWIZERA
Setting Object Fit in Divi Image Module
Tags: wordpress, divi, css
Published: 2023-03-14 08:59:49

Divi is a popular tool to create a website with WordPress. With Divi, you can get your website project done more quickly thanks to its visual editor. If you are an agency or freelancer, Divi is a perfect Elementor alternative as you can create unlimited websites using a single license.

The visual editor of Divi comes with useful design elements (called modules) you can make use of to create a page. Each module also comes with built-in styling options. One of modules offered by Divi visual editor is Image. The module -- as you can guess -- is aimed at adding image element to your page.

The Image module of Divi comes with some styling options such as CSS filters, box-shadow, border, and so on. Of course, you can also set the size of image by setting the heigh and width.

A setting option that is not available in Divi Image module is _object-fit_. This setting is quite useful, especially to create a rounded image. A little CSS snippet is required to apply object fit in Divi.

## Setting Object Fit in Divi Image Module

CSS has a property called `object-fit` which you can use to resize an object (image and video) to fit its container. However, the implementation is a bit more complex in Divi -- compared to Elementor -- as Divi doesn't allow you to use the class selector on an individual module (read my previous post to learn [how to use CSS selector in Elementor](https://dev.to/sunawang/how-to-use-css-selector-in-elementor-4m1p)).

So, how to set the object fit of the Image module in Divi?

First, add the Image module just like usual and set the width and the height. Once done, click the gear icon on the bottom side to open the page settings panel. On this panel, go to the **Advanced** tab.

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

Next, add the following CSS snippet to the CSS editor (the **Custom CSS** field). 

```
.et_pb_image img{
object-fit: cover;
}
```

You can replace the object-fit value to your liking. The object-fit property itself supports the following values:

- _fill_: image is forced to fill the entire container area
- _contain_: image is displayed in the original aspect ratio
- _cover_: image is also fill the entire container area, but only the certain portion according to the

Don't forget to click the green checklist icon to apply the change.

The above method will apply the object fit to all Image modules on the same page. If you want to target a specific Image module, you can add an ID selector to the above snippet. The snippet will be:

```
#yourclasshere .et_pb_image img{
object-fit: cover;
}
```

Next, edit a column belong to the Image module you want to apply the object fit to and add your CSS ID on the **Advanced** tab on the settings panel.


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

That's it. You can publish your page once done editing it.
CodePen Designs - 45 : CSS Sleeping Blob
Tags: codepen, css, design, javascript
Published: 2023-03-14 08:48:14


### We are excited to introduce our new series that will explore the best design ideas from the Codepen community. 

We will be publishing these each day and hope you find them insightful and inspiring as we showcase some of the most talented designers in this space.

---

---

## Video Tutorial

Don't miss the amazing video we've embedded in this post! Click the play button to be inspired

{% youtube 51tRLhi0JkI %}

---
### Codepen Design - 45
---

{% codepen https://codepen.io/khanhtranngoccva/pen/poOaMoE %}


---
## For more information

1. Check my GitHub profile
[https://github.com/amitSharma7741](https://github.com/amitSharma7741)

2. Check out my Fiver profile if you need any freelancing work
[https://www.fiverr.com/amit_sharma77](https://www.fiverr.com/amit_sharma77)

3. Check out my Instagram
[https://www.instagram.com/fromgoodthings/](https://www.instagram.com/fromgoodthings/)

4. Linktree
[https://linktr.ee/jonSnow77](https://linktr.ee/jonSnow77)

5. Check my project

- EVSTART: Electric Vehicle is the Future
[https://evstart.netlify.app/](https://evstart.netlify.app/)
-  News Website in react
 [https://newsmon.netlify.app/](https://newsmon.netlify.app/)
-  Hindi jokes API
 [https://hindi-jokes-api.onrender.com/](https://hindi-jokes-api.onrender.com/)
- Sudoku Game And API
[https://sudoku-game-and-api.netlify.app/](https://sudoku-game-and-api.netlify.app/)

---
---

---

## Video Tutorial

Don't miss the amazing video we've embedded in this post! Click the play button to be inspired

{% youtube  PnqDy99p3EA %}

---
Top 10 AWS Services You Should Know!
Tags: aws, azure, gcp, cloud
Published: 2023-03-14 08:13:57

**Amazon EC2 (Elastic Compute Cloud)** - It is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.

**Amazon S3 (Simple Storage Service)** - It is an object storage service that offers industry-leading scalability, data availability, security, and performance.

**Amazon RDS (Relational Database Service)** - It is a fully managed database service that makes it easy to set up, operate, and scale a relational database in the cloud.

**Amazon Lambda** - It is a serverless compute service that lets you run code without provisioning or managing servers. You can use it to run code in response to events, such as changes to data in an S3 bucket or a database.

**Amazon CloudFront** - It is a content delivery network (CDN) that securely delivers data, videos, applications, and APIs to customers globally with low latency, high transfer speeds, and no minimum usage commitments.

**Amazon Route 53** - It is a scalable domain name system (DNS) that helps developers and businesses route end users to internet applications by translating domain names like www.example.com into IP addresses.

**Amazon SES (Simple Email Service) **- It is a cost-effective, flexible, and scalable email service that enables businesses and developers to send and receive emails using their own email addresses and domains.

**Amazon SQS (Simple Queue Service)** - It is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.

**Amazon DynamoDB** - It is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.

**Amazon SNS (Simple Notification Service)** - It is a fully managed messaging service that enables you to decouple and scale microservices, distributed systems, and serverless applications.
Django Installation Easy Steps
Published: 2023-03-14 07:57:03

[Django ](https://kodewhiz.com/courses/django)is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It is built by experienced developers. Here [Django ](https://kodewhiz.com/courses/django)installations steps are explained:

**1. Create virtual environment**

python -m venv venv
.\venv\Scripts\activate # For Windows
source venv/bin/activate # For Mac

**2. Install Django**

Pip install django
Pip install --upgrade pip

**3. Create Project**

django-admin startproject mysite
cd mysite
python manage.py runserver

**4. Create App**

python manage.py startapp main

**5. For image field install library**

pip install pillow
Sometimes it shows error so use the following code:
pip install pillow==8.0.0
python -m pip install --upgrade pip 
python -m pip install --upgrade pillow

**6. To check installed Libraries**

pip list

**7. To Uninstall Library**

pip uninstall library_name

**8. Admin**

python manage.py makemigrations
python manage.py migrate
python manage.py migrate --run-syncdb
Python manage.py createsuperuser

Learn more about Django, visit our website [https://kodewhiz.com/courses/django](https://kodewhiz.com/courses/django)