teleren/devto huggingface dataset:
Como instalar Solidity
Tags: blockchain, solidity, linux, macos
Published: 2022-02-04 16:08:16

Se você deseja só criar alguns "smart contract" para estudos não é necessário instalar o solidity em seu computador você pode usar o [Remix online](https://remix.ethereum.org/#optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.7+commit.e28d00a7.js), com ele você não precisa instalar nada na sua máquina. Se você quiser usá-lo sem conexão com a Internet também é possível baixar o código fonte dele no seu repositório oficial do [github](https://github.com/ethereum/remix-live/tree/gh-pages).
O Remix é uma opção conveniente para testar compilações noturnas (nightly builds) sem precisar instalar várias versões do Solidity.


## Instalar o Solidity no Linux
Os pacotes binários do Solidity estão disponíveis em [solidity/releases](https://github.com/ethereum/solidity/releases).
Também temos PPAs para Ubuntu, você pode obter a versão estável mais recente usando os seguintes comandos:

```
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
```
A versão noturna (nightly builds) pode ser instalado usando estes comandos:

```
sudo add-apt-repository ppa:ethereum/ethereum
sudo add-apt-repository ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install solc
```
Também é possível instalar via snap para todas as [distribuições linux suportadas](https://snapcraft.io/docs/installing-snapd). Para instalar a versão estável mais recente do solc só usar esse comando:

```
sudo snap install solc --edge
```

## Bibliografia
[Documentação oficial](https://docs.soliditylang.org/en/v0.8.11/installing-solidity.html)
The Road to £1,000,000 - 1 Month in
Tags: challenge, investment, cryptocurrency
Published: 2022-02-04 14:47:53

My new years challenge is to experiment with ways of doubling my money each month. The catalyst behind this was hearing that if you start with £1,000 and double it every year, after 10 years you will have £1,000,000 (see earlier blog post for more information)

This year is all about trying different things, with the 10 year plan kicking off in 2023!! January 2022 I was going to be selling teaching resources from my previous career as a Science teacher. I started the month with £25, with the aim of doubling that. Getting the resources online (with [TES](http://wwww.tes.com)) cost £0, and over the month of January, I sold £49 worth of resources. January 2022 challenge achieved!!!

So, what am I going to try in February? Well I am going to keep adding resources to try and increase the revenue from that platform, but I am looking at investing the money from last month to see what that can achieve. I have looked at several [Stocks and Shares ISA](https://www.moneyhelper.org.uk/en/savings/investing/stocks-and-shares-isas) providers. The returns are not going to double the money, but there is money to be made. I am going to carry on the research, and hopefully start investing later this month!
Mejorando la seguridad con DevOps
Tags: devops, aws, cybersecurity, spanish
Published: 2022-02-04 15:36:14

**Con CI/CD**, las organizaciones pueden satisfacer rápidamente las necesidades más actuales del negocio a medida que evolucionan rápidamente, pero sin un enfoque continuo de la seguridad, una vez más, la seguridad está aislada. Las organizaciones deben ser capaces de adaptar sus requisitos de seguridad a los cambios tanto internos (cambio de bases de datos, diferentes versiones de software, etc.) como externos (requisitos de cumplimiento, panorama cambiante de amenazas, etc.). 

> Necesitamos llevar CI/CD un paso más allá y también tener la seguridad integrada continuamente.
 

Por extensión, la seguridad continua **(CI/CD/CS)**  cumple con los estándares de seguridad más actuales para el negocio, teniendo en cuenta los cambios internos y externos en todo el SDLC. 

**Para adoptar efectivamente un CI/CD/CS, las organizaciones deben centrarse en estos principios clave:**

- No existe un código perfecto, por lo tanto, no existe una seguridad perfecta: 

La buena seguridad de las aplicaciones gestiona el riesgo cibernético de acuerdo con la estrategia comercial general. Cuando tiene la capacidad de aceptar el riesgo dentro de la tolerancia al riesgo de los negocios, sabe los momentos correctos para detenerse y los momentos correctos para continuar porque existen otros controles. No dejes que la perfección sea enemiga del éxito. 

- Seguridad de aplicaciones desde el día uno: 

DevOps no se trata de moverse rápido y romper cosas, se trata de moverse de manera eficiente y arreglar las cosas en el momento adecuado. Entregue la información de seguridad de la aplicación correcta en el momento adecuado a la parte interesada responsable de ejecutarla. Esto asegura una mejor colaboración para que las partes interesadas sepan dónde, cuándo y con quién dirigir su atención. 

- Micro-feedback en tiempo real: 

Aproveche la orquestación para obtener retroalimentación en tiempo real sobre el cumplimiento de las políticas antes de que cree cuellos de botella en el futuro. Esto le permite responder a los cambios tanto internos como externos lo más rápido posible, creando un ciclo iterativo de información para la toma de decisiones en el futuro.

Al administrar continuamente las prácticas de seguridad, las políticas y la deuda en las canalizaciones de CI/CD existentes, este enfoque permite implementar un programa de seguridad de aplicaciones escalable en cualquier SDLC para que pueda evolucionar continuamente para estar siempre al mismo nivel que el negocio actual.  


![DevSecOps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvq1o7t8dl4n79xbhw5n.png)
Paracetamol.js💊| #44: Explica este código JavaScript
Tags: javascript, spanish, beginners, webdev
Published: 2022-02-04 15:33:24

## **Explica este código JavaScript**

```js
var status = "😎"

setTimeout(() => {
  const status = "😍"

  const data = {
    status: "🥑",
    getStatus() {
      return this.status
    }
  }
  console.log(data.getStatus())
}, 0)
```


-     A: "🥑"
-     B: "😍"
-     C: "😎"
-     D: `ReferenceError`

Respuesta en el primer cometario.

---
How to Deploy a FastAPI Application using Docker on AWS?
Tags: python, devops, tutorial, aws
Published: 2022-02-04 15:29:32

Hi Everyone! 🙌

This blog will see how we can deploy a FastAPI application on AWS EC2 instance using Docker and NGINX.

## Step 1: Create an API using FastAPI

For this article, I have created a [Github Repository](https://github.com/theinfosecguy/fastapi). You can use this repository or create your API.

To use my GitHub Repository, Follow the steps mentioned in [README.md](https://github.com/theinfosecguy/fastapi/blob/master/README.md)

## Step 2: Spin up your EC2 Instance

In this tutorial, I won't be going through how to spin up your EC2 instance. There are [hundreds](https://dev.to/genialkartik/aws-ec2-instance-57gb) of tutorials over the internet on starting an EC2 instance.

## Step 3: Install Docker and NGINX on your Server

To install Docker on your EC2 instance. Use the following commands:

```
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
```

To check if Docker is properly installed or not, Use the following command: `sudo docker run hello-world`. This will pull `hello-world` image from Docker Registry.

To install NGINX on your EC2 instance. Use the following command:

```
sudo apt install nginx
```

## Step 4: Get all Application Files

Now that we have Docker and NGINX installed. It's time to get all our application files on EC2. If you are using my repository. Use the following command to clone the repo.

`git clone https://github.com/theinfosecguy/fastapi`

## Step 5: Setup NGINX

After installing NGINX and getting all our files, let's configure NGINX on our EC2 instance.

- Use the following command to create NGINX Config File

`sudo vi /etc/nginx/sites-enabled/fastapi-demo`

This will create a `fastapi-demo` file in the `/etc/nginx/sites-enabled/` directory.

Paste the following `server` block in opened `vi` editor screen. 

```
server {
    listen 80;
    server_name <PUBLIC_IP>;
    location / {
        proxy_pass http://127.0.0.1:8000;
    }
}
```
Replace `<PUBLIC_IP>` with the Public IP of your EC2 instance.

Save the file by pressing the Esc key and then typing `:x` and pressing Enter (Feel free to use any other text editor of your choice).

After saving the file, restart the NGINX server using the following command:

`sudo service nginx restart`

## Step 6: Start the Docker Container

We will now start the Docker Container in Detached Mode so that Docker does not block our terminal. Use the following command to create the Docker container.

`sudo docker-compose up -d`

Here `-d` represents Detached Mode. This will start the Docker Container inside which our application is running.

That's all, guys, Try to visit the server's public IP, and you'll see something like this.

![FastAPI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pztfh20mkqjsn0kcq0ky.png)

You can play around with the API using [Postman](https://www.postman.com/). 

I hope you guys liked the article 😁. Drop a comment if you have any queries or have any questions ⁉.
Replace space with underscore JavaScript - All / Multiple Spaces
Tags: javascript, webdev, beginners, tutorial
Published: 2022-02-04 15:06:25

## Replacing first space

> If you are using it will only replace the first space found.

```javascript
'Hello World'.replace(' ', '_'); //Output :- 'Hello_World'

'Hello My World'.replace(' ', '_'); //Output :- 'Hello_My World'
```

## Replacing every space with underscore

- 1. Using `text.replace(/ /g,"_");`

Here you can replace all the spaces with underscore and if you have multiple spaces in string it will replace it with **multiple** underscores.

```javascript
'frfr frrf f4w'.replace(/ /g,"_");//Output :- 'frfr_frrf_f4w'

'foo  foo'.replace(/ /g,"_");//Output :- 'foo__foo'
```

- 2. Using `text.replace(/\s+/g, '_');`

Here you can replace all the spaces with underscore and if you have multiple spaces in string it will replace it with **single** underscores.

```javascript

'Hallo     World'.replace(/\s+/g, '_');//Output :- 'Hallo_World'

```


That's all. Follow My Account to get more...
Sending HTML Emails With Python
Tags: python, programming, tutorial
Published: 2022-02-04 14:52:02

#Let's Send Eye-catching Emails
Join us as we learn how to [send HTML emails with Python](https://www.iceorfire.com/post/sending-html-emails-with-python)! You won't be MailChimp but you can impress your friends.

# Support Me
If you find these tutorials helpful, please consider [buying me a coffee](https://www.buymeacoffee.com/z4F8QVS6w). Thanks!
Start Unit Testing Your Javascript with Jest
Tags: javascript, tutorial, programming, webdev
Published: 2022-02-04 14:51:28

Most JavaScript developers either ignore or pay the least amount of attention to unit testing. Nevertheless, unit testing is crucial in weeding out issues before they drive away users.

While we can always do manual testing, it is massively more efficient to perform testing by using testing frameworks. In today’s article, we’ll start unit testing using one such framework.

---

###What is Jest?

Jest is a popular JavaScript unit testing framework that is great for minimizing the setup time for testing. It employs matchers to perform testing on the JavaScript codebase. Matchers take in an expected value and compare it with the output of an expect function which takes JavaScript code as input. 

Jest then provides a detailed result of the tests to help make debugging easier by pointing to the exact place where it encountered the error in most cases.

---

###Matchers

Some of the matchers that Jest includes are:

* toBe - For primitive data types to match by value.
* toBeLessThanOrEqual -Checks that the output value is below a certain value.
* toBeCloseTo - Primarily used to compare floating-point values. Since it doesn’t compare exact values it helps avoid false positives due to rounding errors.
* toMatch - Used for matching with regular expressions.
* toEqual - Just like the toBe matcher except that it is meant for reference data types such as objects.
* toContain - As the name suggests it checks if a particular element exists inside a given reference type such as an array.

---

###Setting up Our Project

To set up our project, we’re going to create a new node project with:
`npm init`

We can then install Jest with:
`npm install —save-dev`

Next, in our `package.json` we are going to add the following script:

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

Finally, we’ll create two files: `functions.js` and `functions.test.js`

In general, for each javascript you want to test, you can just create an additional file called <Filename>.test.js
Using Jest in our Javascript Files

We can then implement Jest like so:

{% gist https://gist.github.com/RanjanSushant/d15d9b95d0b8b9fc49e9b21994e4f9c6 %}

---

###Running Jest

We can now run Jest with:
`npm run test`

And see the following output:

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

---

There you have it! We just set up our first test suite using Jest. 

Once you’ve run your tests, fixed all your issues, and your code is ready to deploy, you can use [Codesphere’s](https://link.codesphere.com/IH) hassle-free cloud deployment. It takes just minutes to set up your project and have it live, so you can focus on the important task at hand: writing code. 

Let us know what you’re building down below!
The Easiest & Most Cost-Effective Page Builder You Will Ever Use

 
 
Tags: programming, webdesign, website, javascript
Published: 2022-02-04 14:39:01

If you're one of those people that hate using page builders as they are so complicated then I have some good news for you as I have just discovered one of the fastest and easiest page builders you will ever use and the cost will blow you away.

You see, we all know that a LOT of people want to stick with what they already know and keep things as simple as possible because we all know that time is money.

So, the creators have come up with a simple and easy to use page builder using an extremely simple interface. Just click where you want to edit and you're done, there's literally nothing Faster or Easier!

Yes, this really could not get any simpler, if you can point a mouse, click and type, then you've already mastered Easy Page Buildr.

[Check out](https://tinyurl.com/2p938f52) the video on this page and you'll see why it's called 'Easy Page Buildr'

[https://tinyurl.com/2p938f52]

Plus right now you grab this for a single payment and you can get started for under $10 (I was shocked at the price too) but I am told that they will be switching to recurring billing soon so now is the time to check this out.
Updgrade database sql force shutdown solved
Published: 2022-02-04 14:27:28

In general I use this command line:
`-d dbName --logfile=// --no-xmlrpc --debug --stop-after-init`

or :
`-d dbName -u all --logfile=// --no-xmlrpc --debug --stop-after-init`

The first one, terminal will find it-self modifications.
And second one, you terminal will update all database

But if you have a force shutdown like hereunder: 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1diqekdrk2tlsdtqyrzq.png)

My solution:
-d dbName -u all --logfile=// --stop-after-init --no-xmlrpc --log-level=debug --max-cron-threads=0
I turned my Christmas Lights into a tachometer...
Tags: python, programming
Published: 2022-02-04 14:25:33

So I have some christmas lights - you can control each individiual LED - allowing for some pretty cool effects. In the words of Uncle Ben - with great power comes... **a lot** of options.

So naturally I decided the best course of action was to combine these lights with my car's telemetry data. All I needed to do was have my car send the RPM readout to my Lights and get the percentage RPM (our rpm/4000), and then BOOM - Christmas Light Tachometer!

{% youtube nzCIufXyS5g %}
A CI/CD pipeline for a React app with Google Cloud Build
Published: 2022-02-04 14:20:28

_This tutorial assumes you are familiar with triggers in Google Cloud Build and have connected your repo. You can find an easy tutorial how to set up your first trigger [right here](https://dev.to/johannesvitt/first-cicd-pipeline-with-google-cloud-build-1am3)_.
##Intro
So you understand the idea behind CI/CD pipelines and want to build your own but are wondering how your it looks in real life? If you have a React app that you want to deploy using Google Cloud Platform (GCP) this tutorial is made just for you.

##Prerequisites
As a prerequisite, your application has to be dockerized. I have dockerized a React app in [this tutorial](https://dev.to/johannesvitt/deploy-a-react-app-on-gcp-with-google-cloud-run-il3), so check that out.


##The code
Our `yaml` file consists of three steps: building the docker image, pushing the image to the container registry and deploying a new Cloud Run revision with that image.

## Creating a trigger
First you need to create a trigger that has the repo, that your code is in as a source. You also need to select the event that triggers the trigger (e.g. push to branch). Then edit the yaml file of the trigger in the following way.

###1. Building the Docker image
We use the default Docker cloud build image that Cloud Build provides as a container where we execute the `docker build` command. It creates an image that contains all your React code.
``` yaml
steps:
    - name: 'gcr.io/cloud-builders/docker'
      args:['build', '-t', 'gcr.io/$PROJECT_ID/frontend:$COMMIT_SHA']
      
```
###2. Pushing to Container Registry
Google Container Registry offers a simple place to store your images of your deployments. This step pushes the previously created image to Container Registry.
``` yaml
    - name: 'gcr.io/cloud-builders/docker'
      args:['push', 'gcr.io/$PROJECT_ID/frontend:$COMMIT_SHA']
      
```
###3. Deploying to Cloud Run
Cloud Run offers a simple way to deploy dockerized apps. With the gcloud cloud-builder image you can execute any command that you  would run with the gcloud command locally. So this step does the same as running `gcloud run deploy...`.
``` yaml
    - name: 'gcr.io/cloud-builders/gcloud'
      args: ['run', 'deploy', '<your service name>', '--image', 'gcr.io/$PROJECT_ID/frontend:$COMMIT_SHA', '--platform=managed', '--region=<your service region>']
      
```
Hint: If this steps fails, you might need to give permissions to deploy with Cloud Run to the default Cloud Build service account in your GCP IAM section.
## Testing your trigger
Once the yaml file is saved, you can go ahead and change some of the code of your react app. The commit and push the code with git to trigger the event you have specified. In the history of Cloud Build you will see your build running. After it has completed, you can access your deployment via it's url and see the changes.
Secure Web Apps with Quarkus, Keycloak and Vaadin
Tags: java, quarkus, keycloak, vaadin
Published: 2022-02-04 14:10:37

---
title: Secure Web Apps with Quarkus, Keycloak and Vaadin
published: true
description: How to set up OpenId Connect and more!
tags: java, quarkus, keycloak, vaadin
---

A quick demo presenting how to integrate user authentication in an application with separate application and API tiers, using Quarkus and Keycloak.

Special thanks for the Vaadin folks for helping my rants on twitter :)

Code:
https://github.com/CaravanaCloud/openshift-ris

{% vimeo 673600649 %}
[BTY] Day 1: 7 Reasons Not to Put an External Cache in Front of Your Database | ScyllaDB
Tags: betterthanyesterday, database, caching
Published: 2022-02-04 13:57:02

_I've passed through a few days relaxing from the Tet holiday (aka. Lunar New Year). So now, we start again from the beginning!_

All information is extracted from this article: https://www.infoq.com/vendorcontent/show.action?vcr=207f2eed-6333-49ed-802e-5e5e3567f4e9

**Disclaimer**: I've not used ScyllaDB yet.

### My key takeaways

**Traditional side caching vs transparent caching (NEW)**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfct635ik0ag5og8f7jv.png)

**The Linux page cache**
The Linux page cache, also called disk cache, improves operating system performance by storing page-size chunks of files in memory to save on expensive disk seeks. The Linux kernel treats files as 4KB chunks by default. This speeds up performance, but only when data is 4KB or larger. The problem is that many common database operations involve data smaller than 4KB. In those cases, Linux’s 4KB minimum leads to high read amplification.

**The seven fails of external caches**

1. An external cache adds latency
2. An external cache adds needless expense
3. External caching decreases availability
4. Application complexity — your application needs to handle more cases
5. External caching ruins database caching
6. External caching complicates data security
7. External caching ignores the database’s intelligence and resource




**Scylla's embedded cache**
 
The Scylla NoSQL database offers a better approach to caching, one that addresses the significant problems covered above, while also delivering the performance gains that caching promises. 

* Scylla uses a special-purpose cache instead of Linux default cache. It can dynamically tune itself
to any workload and always controls their eviction and memory footprint.
* Scylla can dynamically balance the different types of caches stored.
* Once data is no longer cached in memory, Scylla will generate a continuation task to read the data asynchronously from the disk using direct memory access (DMA), which allows hardware subsystems to access main system memory independent of CPU.
* The C++ Seastar framework on which Scylla is built will execute the continuation task in a μsec (1 million tasks/core/sec) and will rush to run
the next task. There’s no blocking, heavyweight context switch, waste, or tuning.
* Because Scylla has a very efficient internal cache it obviates the need for a separate external cache, making for a more efficient, reliable, secure and cost-effective unified solution.
Lessons learned: Migrating Spark App to AWS EMR
Tags: bigdata, aws, spark, mlops
Published: 2022-02-04 13:53:11

Some background, the startup that I was working at got acquired, and suddenly all of my programming effort was focused on migrating ML infrastructure to a parent company's infrastructure. I didn't know anything about AWS and EMR at the time, so I had to learn on the job 💪

![Get ready to work](https://media.giphy.com/media/pO7jomKrTwfSw/giphy.gif)

So here are my newbie thoughts about AWS EMR good, ugly and bad sides.

### Good
- Management of Spark cluster is done by AWS, so you can spend time on delivering the value instead of mantaining the cluster. :heart:
- Read/Writes from S3 out of the box. Data input and output can live in S3 which makes it very easy to share data with teamates. :heart: :heart: :heart:

### Ugly
- Logs...
    - To get the logs of you application, you would need to jump through bunch of hoops. Live logs of a running application on the cluster? (Very, very tricky todo). 😭😭
    - You can get the logs after the application has finished running, by `ssh` into EMR master and runing `yarn logs --applicationId`.
    - You can also wait ~5min and get them from the S3 bucket where EMR saves these logs 😭


### Bad
- Finetuning hole...
    - Something that you could run with 4 nodes in your own Spark cluster could take 30 nodes with autoscaling in EMR.

- No Spark standalone mode, no nice debugging...
    - EMR does not support Spark standalone mode. So you would write your PySpark app submit it to EMR cluster as a job. Once it fails, you would need to go through ENORMOUS stack trace of Yarn, Spark and your application to see the error. No more pleasant debugging experience from the comfort of your IDE 😭😭

### Conclusion
Overall, AWS EMR still requires maintenance effort. It's much more involved compared to a simple web app. You would need to understand Spark's inner workings to fine-tune it to get the logs quickly and not bankrupt you in the process with its compute autoscale. (You could disable autoscaling, but then you would need to spend more time tuning your resources)