teleren/devto huggingface dataset:
Crypto App built with ReactJS, Tailwind and Firebase
Tags: react, firebase, javascript, beginners
Published: 2022-09-15 14:39:38

So today I finished my solo project **Crypto app**! 


Here is **live website** deployed on firebase: https://coinbase-52f8f.web.app

**Source**
- **Github:** https://github.com/robo311/crypto-app

---

**What functionality does it offer?**

- Functional Register/Login page using Firebase database.
- Website shows most popular crypto currencies and trending currencies via Coingecko API.
- As mentioned above website using Coingecko API.
- User can select certain coins and add them to their watchlist.
- Each coin has designated page with informations/prices/changes.
- Dark Mode / Light Mode.

**Technologies used**

- ReactJS
- Tailwind
- Firebase/Firestore
- Axios (for API)
- HTML
- CSS

**Author**
- GitHub: https://github.com/robo311
- Discord: @gatti#7613
- Dev.to: {% embed https://dev.to/gatti %}

**Screenshot of website**

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

**Additional info**

- Website is fully responsive (using Tailwind).
- Mobile website using hamburger menu. (Fully working)
What is Git? - 14 days of Git
Tags: git, 14daysofgit, devops
Published: 2022-09-15 14:20:36

In my last post we explored "what is version control".  In today's 14 days of Git we are exploring "What is Git". 

## What is Git?
[Git](https://git-scm.com) is a tool that is used for code management.  It is a free and [open source tool](https://www.techielass.com/what-is-open-source/).  

Git is a tool that can be used within your DevOps workflows to maintain good version control. 

Linus Torvalds created Git in 2005. 

## Git features
Git has many features and benefits and we intend on exploring a lot of them as part of 14 days of Git.   But let's cover some of the highlights: 

- Free and open source
- Supports collaboration
- Tracks history
- Branching
- Lightweight

## Why is Git used?
As we explored in [what is version control](https://www.techielass.com/what-is-version-control/), we discovered that being able to track your history and collaborate with others is important in any environment that involves code. 
Version control is the theory, the process that is used to do that.  Git is the tool that allows you to put that theory into action.

## Command Line or GUI?
You'll often see people talk about Git as a command line tool.  And yes it is predominately a command line based tool.  But you don't need to use it in that form. 

Git comes with it's own graphical user interface(GUI).  Git GUI that can be launched from the command line. 

There are third party tools out there that allow you to avoid having to interact with the command line: 

- [GitHub Desktop](https://desktop.github.com/)
- [SourceTree](https://www.sourcetreeapp.com/)
- [GitKraken](https://www.gitkraken.com/invite/pYx7cNys)
- [Many more!](https://git-scm.com/downloads/guis)

## 14 days of Git
The next step of 14 days of Git is to walk through the various ways of installing Git on your machine. Be sure to [subscribe](https://www.techielass.com/newsletter)and join us for that step in the learning journey!

You can follow along here: [https://github.com/weeyin83/14daysofgit](https://github.com/weeyin83/14daysofgit)
🔴  It’s TODAY! Luos is hosting a live keynote on Discord at 9:00 am PT (6:00 PM CEST).
Tags: opensource, microservices, systems, luos
Published: 2022-09-15 14:08:11

🔴 It’s TODAY! Luos is hosting a live keynote on Discord at 9:00 am PT (6:00 PM CEST).

To participate ⏩ https://discord.gg/myMhgJvP?event=1013835403465326683

Nicolas Rabault will present the new version 2.6!

![Luos Keynote](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94fjsqlcru3aa8pt3jh0.png)
Ethereum contract call methods do not return any values
Published: 2022-09-15 14:03:29

Hi there,

I have a problem when running the following 4 lines of code from the main JS script (see below):

- await uniswapFactory.getPair(daiAddress, wethAddress)
- await sushiFactory.getPair(daiAddress, wethAddress),
- const uniswapReserves = await uniswapDaiEth.getReserves();
- const sushiReserves = await sushiEthDai.getReserves();

For the first two, if I substituted them with hardcoded token pair addresses from Etherscan into the code it works. If I run the first two directly into Truffle console it resolves the pair addresses but strangely enough it doesn´t resolve when I execute the JS script!

For the above two .getReserves() function calls it doesn´t retrieve any of the reserve values unless if I ran them as they are under Truffle console environment then it retrieves them OK.

I appreciate your assistance here as it´s been bugging me for the full last two days and am running out of options to resolve this.

**Full JS script**

`require('dotenv').config();
const { INFURA_API_KEY, PRIVATE_KEY } = process.env;
const { ethers } = require('ethers');

const UniswapV2Pair = require(".././build/contracts/IUniswapV2Pair.json");
const UniswapV2Factory = require('.././build/contracts/IUniswapV2Factory.json');

const daiAddress = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
const wethAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";

const privateKey = process.env.PRIVATE_KEY;
const infuraProvider = new ethers.providers.InfuraProvider('mainnet', process.env.INFURA_API_KEY);
const wallet = new ethers.Wallet(privateKey, infuraProvider);

const testBasic = async () => {
  const uniswapFactory = new ethers.Contract(
    "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f",
    UniswapV2Factory.abi, 
    wallet
  );

  const sushiFactory = new ethers.Contract(
    "0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac",
    UniswapV2Factory.abi, 
    wallet
  );

  let uniswapDaiEth;
  let sushiEthDai;

  const loadPairs = async () => {
    uniswapDaiEth = new ethers.Contract(
      await uniswapFactory.getPair(daiAddress, wethAddress),
      UniswapV2Pair.abi, 
      wallet
    );
    sushiEthDai = new ethers.Contract(
      await sushiFactory.getPair(daiAddress, wethAddress),
      UniswapV2Pair.abi, 
      wallet
    );
  };
  await loadPairs();

  infuraProvider.on('block', async (blockNumber) => {
    try {
      const uniswapReserves = await uniswapDaiEth.getReserves();
      const sushiReserves = await sushiEthDai.getReserves();
    } catch (err) {
      console.error(err);
    }
  });
};

testBasic();`

Thank you very much for your help!

Best, Samuel
Linux For Cloud Engineers: Understanding SELinux
Tags: linux, cloud, devops
Published: 2022-09-15 13:54:49

Visit my website: [Practical Cloud](https://practicalcloud.net) for more posts and projects on Devops and Cloud engineering.

I find that most Cloud Administrators, DevOps engineers and even some sysadmins shy away from the subject of SELinux.
This is not encouraging, giving the fact that a properly implemented SELinux policy can greatly reduce the attack surface across our Linux-based EC2 instances and on-premise systems.

The best way to think of SeLinux is to think of it as an access control mechanism, which implements Mandatory Access Control. This MAC is implemented on top of Discretionary Access Control (DAC) which is built into all Linux systems. What this effectively means is that SELinux will not grant a permission that has been denied by DAC. It can only deny permissions that might have been granted by your Discretionary Access Control.
In addition to implementing MAC, you can argue that SELinux implements Role-Based Access Control (more on that in the later paragraphs).

Discretionary Access Control can simply be thought of as the read, write and execute (rwx) permissions for users, groups and 'others' that you define for your files across your filesystem.

The purpose of SELinux is to regulate the permissions granted to a process and how it accesses files within a Linux environment. Such that a process will always run under the permissions granted to it, no matter if it is started by a privileged or non-privileged user. In essence, a process will only run with the rights necessary for it to perform its function.

Suppose an application running in our EC2 instance - with root privileges - is compromised by a hacker, the hacker can not be able to cause major damage to our environment. This is because even though the application is running under the context of the root user, our SELinux policy has restricted the permissions granted to this application and the running process is not able to access resources beyond which has been granted to it by an appropriately configured SELinux Policy.

There are quite a few terminologies associated with SELinux.
A few of them are; users, roles, subjects, objects, domains, types and type enforcement.

An SELinux user executes a process. That process, is known as a subject.
This could be a user creating a directory, or modifying a file.
So basically, a subject is a running process (a daemon).

But in order for a user to execute a process, it must have access to a role and that role itself must have access to the subject.
This is where Role Based Access Control (RBAC) comes in. A role acts like a bridge between a user and a subject. The role defines which users can have access to itself. Also, the role has a defined list of subjects that it can access.

An object in SELinux is anything that a subject acts upon. This could a file, a directory, or even a server.
Domains are contexts for subjects while Types are contexts for objects.

Bye for now and thank you for reading.
Git "autofixup"
Tags: git, codequality, alias
Published: 2022-09-15 13:54:30

How many times did you **forget to add a file or change** to a commit, only to discover your mistake later on (after a few commits)?

Since I'm a strong proponent that **atomic commits** are key to **project quality and automation** (see [Conventional Commit](https://www.conventionalcommits.org/) and [Semantic Release](https://semantic-release.gitbook.io/), for instance), I do my best to fix these commits using Git **interactive rebasing**. I strongly recommend you do the same. You don’t have to be afraid of Git rebase, you just have to [learn how to use it](https://delicious-insights.com/en/trainings/360-git/) 😉.

My goal here is to help you do this in a quick, smooth, painless way.

You may already be familiar with the `git commit --fixup` option (or `--squash`) that creates a commit with a special-format message about our intent to fix another commit. Using that, when you run a properly-configured **interactive rebase**, Git will automatically move that commit line as a _fixup_ next to the one you're fixing.

## Step by step

Add the missing files to the stage: `git add …`.

Ask Git to create the fixup commit: `git commit --fixup=<commit-ref-to-be-fixed>`.

Then run an interactive rebase, starting one commit before the one you fixed: `git rebase --autosquash -i -r <fixed-commit-ref>~1`.

Git opens your editor with the list of actions to run, but with the _fixup_ already in the right spot. **There's nothing more to do except save and close the file**, that’s it !

```bash
pick 3f0714b chore(dx): setup ESLint and Prettier
fixup 61eecda fixup! chore(dx): setup ESLint and Prettier
pick 9a7cf39 chore(dx): setup Husky, lint-staged, precommit-checks, commitlint
```

You might want to check your log to confirm everything’s fine. You may also want to check that all the intended files were recorded by the fixed commit `git show --name-only <new-commit-ref>`.

As this is a recurring thing for me, I made a "magic" 🧙‍♂️ alias that calls both commands in sequence (to fix a single commit):

```bash
# Don't forget to stage the relevant fixes first
git config --global alias.autofixup '!!GIT_EDITOR=true && git commit --fixup $1 && git rebase --autosquash --interactive --rebase-merges $1~1 && echo "autofixup finished"'
```

Et voilà !

_(The Git config you may love: there are many useful aliases you can add to your Git configuration. You can [check out the one we’ve built through years of experience](https://gist.github.com/tdd/470582) to learn more.)_
Kubernetes Architecture: Demystifying etcd Data Store.
Tags: kubernetes, devops
Published: 2022-09-15 13:53:18

The kubernetes API server is the gateway to the kubernetes cluster. This is the primary medium through which we interact with our cluster. The front end of the kubernetes control plane. It is also the medium of communication between resources on the control node and those on the worker node. Nothing escapes the Kube API server. All communication passes through it.

However, anybody who has worked with Kubernetes long enough knows that the API server is stateless. This is where etcd comes in. The etcd data store is where cluster configuration is stored. All configurations and secrets are persisted in the etcd data store in order to maintain state. While this is obvious, what is not so obvious is that extra steps must be taken, especially in a production environment, to protect this data and ensure its continuous availability. This etcd is deployed as a pod on the control node and has a its default data directory location in /var/lib/etcd.

This is why knowing how to backup and restore the etcd data store becomes important. For instance, you need to recover from an administrative error such as a delete operation in which you accidentally deleted the data store. Or perhaps, you lost the server in which etcd was being hosted. Knowing how to backup and restore your etcd server is a very important skill which you must add to your skillset.

For starters, etcdctl is the command line client for interacting with etcd. It also provides backup and restore capabilities for etcd data stores. When you backup etcd, it creates a backup file which will contain the complete state of the data stored in etcd. Etcdctl is not installed by default, so you may need to download it first. You can either download the binary from GitHub or you can run the image as a container.

Before making a backup of your etcd, you need to have a backup plan. When making a backup plan, there are a few factors you must consider. The first is encrypting your backup file. Since they are plain-text by default, you need to ensure that they are encrypted after backup. The second factor to consider is an offsite location for storing your backup file(s). You do not want to lose your backup file alongside your etcd data store if the server goes down or you lose access to your cluster.
My place in the Tech Ecosystem
Published: 2022-09-15 13:51:55

Last week we had the pleasure of hearing from Lelia of Build Carolina talk to us about the tech ecosystem in South Carolina. It's hard for me to put a finger on exactly where I fit in at the moment. I feel that I am part of the community with all the people I have had the pleasure of meeting, but I haven't had the chance to contribute much yet. So I'm somewhere between in between coming from a non-traditional certification program and being a professional. Luckily this is the gap that Develop Carolina is built to help close. When I get the chance to contribute to a real world project, that will help build my confidence into being a professional software engineer. 

In the future I would like to give back in some way to new talent, especially people who are coming in from a different profession. I have had so many people be generous to me with advice and acceptance. Without those people I would have never had the confidence to make it this far. So being able to give back as a mentor of some sort would be my ideal way of giving back.
What do u neeeeed? 🤔
Tags: vscode, programming, productivity, discuss
Published: 2022-09-15 13:48:57

Hey! Fellow programmers 
Namaste 🙏

In this post, i would like to ask you all, what problems do u face in our beloved **VS Code** _(if there are any)_ ?

Or what is that thing u feel is ur need but that thing lacks in VS Code _(again, if there is any)_ ?

I would love to know your answers below 😉 _(thanks in advance)_
Алгоритм большинства голосов Бойера - Мура
Tags: algorithms, translatioon
Published: 2022-09-15 13:41:18

#Введение#
Решал задачки на LeetCode и вот небольшой переводик небольшой [статьи](https://www.geeksforgeeks.org/boyer-moore-majority-voting-algorithm/) про небольшой алгоритм.
Алгоритм голосования Бойера-Мура является одним из самых популярных и оптимальных алгоритмов, который используется для поиска преобладающего элемента среди заданных, который имеет более N / 2 вхождений. Алгоритм выполняет 2 обхода по заданным элементам, что работает при O (N) временной сложности и O (1) пространственной сложности.
```
Input :{1,1,1,1,2,3,5}
Output : 1

Input : {1,2,3}
Output : -1
```
Если какой-то элемент встречается больше N/2 раз то отличных от него элементов меньше N/2. Собственно алгоритм на этом и держится.
Для начала выбирается элемент кандидат. Далее для каждого элемента: 
- если элемент равен кандидату, количество голосов увеличивается.
- если кандидат и элемент не равны, количество голосов уменьшается.
- если голосов 0, выбирается новый кандидат.

#На словах#
По сути, увеличивая или уменьшая количество голосов мы увеличиваем или уменьшаем приоритет определенного кандидата. Это сработает, поскольку правильный кандидат встретится более N/2 раз. Если количество голосов оказалось 0, это означает, что элементов отличных от кандидата, столько-же, сколько и равных ему. Получается текущий кандидат не может быть большинством и мы выбираем следующего кандидата. Окончательный кандидат и будет преобладающим элементом, если такой присутствует. Вторым проходом проверим, что полученный элемент встречается больше N / 2 раз. Если нет то такого элемента нет.

#От слов к коду#
```
public static Integer findMajority(int[] nums)
  {
    int count = 0;
    Integer candidate = null;

    for (int num : nums) {
// проверяем, если количество голосов 0 меняем кандидата
        if (count == 0) {
            candidate = num;
        }
// если кандидат и число совпали увеличиваем кол-во голосов
// иначе уменьшаем
        count += (num == candidate) ? 1 : -1;
    }
    count = 0;
// считаем количество элементов равных кандидату
// в исходном массиве
    for (int num : nums) {
      if (num == candidate)
        count++;
    }
// если кандидат подходит условию возвращаем его
// иначе возвращаем null;
    if (count > (nums.length / 2)) return candidate;
    else return null;
  }
```
How to generate Sitemap for your Next JS project
Tags: nextjs, javascript, tutorial, opensource
Published: 2022-09-15 13:10:57

In the following video we generate sitemap and robots.txt for our web badminton open-source Next Js project.

We generate nextjs sitemap with [next-sitemap npm package](https://www.npmjs.com/package/next-sitemap).


{% embed https://www.youtube.com/watch?v=Dud9a8ShCVM&feature=share&utm_source=EJGixIgBCJiu2KjB4oSJEQ %}

[Dspyt Article](https://dspyt.com/how_to_generate_sitemap_for_nextjs_project)


## About Web Badminton:
Decentralized badminton centered dapp on IPFS and Polygon Blockchain. The project is built with react components and nextjs.

Web Badminton GitHub: https://github.com/BadmWe/WebBadminton
Demo: https://webbadminton.com/

We built the application using JavaScript, NextJS, React, Tailwind Css and Wagmi library, IPFS, nft.storage and web3.storage. The application is hosted on vercel. The newsletter list data is stored on ipfs with web3.storage.

We implemented smart contract with solidity, hardhat and polygon blockchain mumbai testnet. Meanwhile the Ipfs data is stored using nft.storage.

## About Dspyt Channel:
We are Data Science with Python DAO
Homepage: https://dspyt.com
GitHub DAO Page: https://github.com/dspytdao
Why Docker isn't always a good idea Part 1
Tags: docker, network, haproxy
Published: 2022-09-15 13:01:24

---
title: Why Docker isn't always a good idea Part 1
published: true
description: 
tags: docker, network, haproxy
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

To briefly explain the situation:
We have a **HAProxy** running on a Debian server as a Docker container. This is the entrance node to a **Docker Swarm** cluster.

Now, in the last few days, there have been several small outages of the websites running in the **Docker Swarm** cluster. After getting an overview, we noticed that no new connections can be established.

As soon as we restarted the **HAProxy**, everything went back to normal. After that I did some research on TCP connections and found out that there is a socket limit.

In Linux we have a limit of sockets that can be opened at the same time. At this point, I unfortunately did not understand that this limit refers to a client connection. So we note that a client can establish a maximum of **65535** socket connections to a server.

This limit refers to a range of ports that you release. We had about 35k sockets available on our server (**HAProxy**). Now the pages are always down when this limit is reached. Thinking back for a moment, we should never get to that limit as it relates to a client. But the problem with us was that Docker's softlayer network didn't route the client address cleanly through the NAT, so everything was coming from one client.

After stopping the Docker container and installing **HAProxy** natively on the server, we were able to cross that boundary as well.

## Assumption

Because we NAT all the requests through the Docker network, the source address is always the same. This is how we reach the socket limit. If we omit the NAT and use HAProxy natively, we do not reach this limit, because the source address is no longer always the same.

![Network Address Translation](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/NAT_Concept-en.svg/1920px-NAT_Concept-en.svg.png "Network Address Translation")

## Conclusion

With this setup, we get overhead into the system that we don't need. We have an extra abstraction layer, every request has to go through the Docker network and we reach the socket limit. All these points fall away when we use it natively.

If we use a lot of micro services it is important that we use something like Docker, because then we can share the kernel and it makes the deployment much easier.

But if we have only one application that is very important, it is better to keep it simple.
How to Make a Creative Website Using HTML, CSS, and JavaScript
Tags: css, javascript, beginners, tutorial
Published: 2022-09-15 13:00:45

{% youtube wWyv5dl0nFg %}

How to make a Creative Website Using HTML CSS JavaScript

This video will show you how to make a creative website using html css javascript

[Github Repo](https://github.com/codewithsadee/fly)

---

HI 👋
I'm Sadee (webdev)
In this channel I make videos about Complete Responsive website.
You can checkout my channel 👇

📺 My Channel : [codewithsadee](https://www.youtube.com/channel/UC1PZHWV6VvICTL1LgFUZq6g)
🔔 Subscribe : [subscribe now](https://www.youtube.com/channel/UC1PZHWV6VvICTL1LgFUZq6g?sub_confirmation=1)

---

🔗 Essential links
-----------------------------
[Download the starter file to practice](https://drive.google.com/file/d/11Rgvoijw2zm6LU7hOCH7xT7ilknzKqcS/view?usp=sharing)

---

⏱️ Timestamps
-----------------------------
0:00 - Demo
4:53 - File structure
5:25 - Project initial
12:39 - Header
30:14 - Hero section
39:37 - Service section
44:42 - About section
52:08 - Feature section
1:05:36 - Offer section
1:11:18 - Flight section
1:20:39 - Newsletter
1:25:10 - Footer
1:39:12 - Media queries

---

[![Become a patreon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnjl14kdm5qf08hu5lop.png)](https://www.patreon.com/bePatron?u=62535867)
How to hide a secret message in image?
Tags: tutorial, steganography, security, cybersecurity
Published: 2022-09-15 12:52:57

Have you ever wondered if it is possible to hide a secret message in a picture so that no one can see it? It is!

You can do it with this one, weird hacking tool using steganography encoding! More technical information and the actual tool at:

https://www.pelock.com/products/steganography-online-codec

## Steganography Online Codec video presentation

{% embed https://www.youtube.com/watch?v=bV2RsM8_UNw %}

It was used in 20k USD crypto-puzzle.