teleren/devto huggingface dataset:
Mongo Client-Side Field Level Encryption Project Sample - Christopher Duran
Tags: mongodb, python, flask, endpoint
Published: 2023-01-18 14:17:40

**Introducción:** 

**Client-Side Field Level Encryption (CSFLE)** es una característica que te permite cifrar datos en tu aplicación antes de enviarlos a través de la red MONGO.

Con **CSFLE** habilitado ningún producto de MONGODB tiene acceso a sus datos sin cifrar. [Documentación](https://www.mongodb.com/docs/manual/core/csfle/)

**Proyecto PRE Requesítos:**

- [Flask 2.1.0]()
- [Python 3.10.9](https://www.python.org/)
- [Postman](https://www.postman.com/downloads/)
- [MONGO Compass](https://www.mongodb.com/try/download/compass)
- [MONGO Shell](https://www.mongodb.com/try/download/shell)

**Ejecuta el proyecto:**

Activa el servicio de la base de datos con el comando:
```
> mongod
```
Si MONGO Shell está correctamente configurado verás un resultado como el siguiente:

![Mongo shell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y4yw5dirk00sqc4t587r.png)

Ubícate el la raíz del proyecto y ejecuta el comando:

```
> python3 app.py
```
Si Flask está corriendo perfectamente verás un resultado como el siguiente:

![Flask console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ui7ikd2us7aoelfhv844.png)

Abre MONGO Compass, normalmente no verás ninguna base de datos creada:

![Mongo compass](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u9c4g7zuf0asdbqst9j4.png)

Abre Postman, usaremos una solicitud POST para guardar un nuevo usuario:

![Postman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9112mhexwr12yzqvvp4.png)
Realizada la solicitud anterior podremos visualizar en la base de datos que se ha guardado un nuevo usuario con los campos encriptados:

![Compass database](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xn2oz4wcwxut8wsb6c70.png)

Si deseamos consultar el usuario por id podemos realizar la siguiente solicitud en postman: 

![Postman](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ih2hv3wsxoo1hlsbtmc.png)

- Línea amarilla: enviamos como solicitud de cuerpo [JSON](https://www.json.org/json-en.html) la llave con la cual se decidió encriptar los campos del usuario.
- Línea azul: Se solicita al usuario por id, este será el ObjectId que se ha guardado en la base de datos.
- Zona roja: Si no se utiliza el código de desencriptación FLE, la base de datos mostrará al usuario encriptado.
- Zona verde: Utilizando el proceso de desencriptado de FLE, podremos visualizar de manera legible los datos del usuario.

Descarga el proyecto [aquí](https://gitlab.com/cad1994/pythonfle).
El código de este ejemplo se encuentra en la rama [chris/devfledemo](https://gitlab.com/cad1994/pythonfle/-/commits/chris/devfledemo).
El commit se llama: [feat(app.py): fle demo](https://gitlab.com/cad1994/pythonfle/-/commit/51cc857ddfcd0667ab31344921050ad643017064)

En caso de tener problemas con Python, y Windows no reconoce python3 en la terminal, se recomienda descargar Python desde el Microsoft Store el cual contiene python3.

Artículo disponible también en: [Hashnode](https://hashnode.com/@cad1994)
Wasp Intro Tutorial Video 🎥 "Build a Full-Stack App ~10 min"
Tags: webdev, fullstack, tutorial, lowcode
Published: 2023-01-18 14:16:36

### Attention YouTube tutorial lovers! 📢

We just released a concise video introduction to building a full-stack app with Wasp. At 12 minutes in length, you can get a quick, guided overview on building with Wasp and its most important features.

The video itself compliments our written [ToDo App Tutorial](https://wasp-lang.dev/docs/tutorials/todo-app), which is a great place to start if you’re new to Wasp.

And that's all the news for now. Check it out here:

{% embed https://youtu.be/R8uOu6ZEr5s %}
Human vs. AI: The Ultimatum Game
Tags: ai, gamedev
Published: 2023-01-18 14:13:09


The Ultimatum Game is a classic economic experiment that has been used to study human behavior and decision-making for decades. The game is designed to test how people respond to offers of money, and it can provide insight into how we make decisions in situations where we have the power to share resources.

The origins of the Ultimatum Game can be traced back to the late 1970s and early 1980s, when economists began using it as a way to study the behavior of people in strategic situations. The game is based on the idea that people have different preferences and attitudes towards fairness, and it has been used to investigate a wide range of questions about human behavior, including how we respond to inequality and how we make decisions in situations where we have the power to share resources.

![Game View](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z77z7yv2y7js4iaucxd3.png)

Now, a new version of the Ultimatum Game is available, where you can play against an AI. The AI-version of the game allows us to explore how humans and AI make decisions in a game-like setting. The AI reasoning is based on a model that has been trained on a large dataset of human decisions, it's able to make decisions based on the data it has seen. However, as with any AI model, security concerns are present and it's important to be aware of them. The AI is instructed to only accept a fair offer but there are many ways you can get around that!

The game is a great way to learn about game theory, artificial intelligence, and human decision-making. It's also a lot of fun! We invite you to give it a try and see how you do against the AI. You can play the game at [https://latentweb.ai/ultimatum.html](https://latentweb.ai/ultimatum.html).
Benchmarking web servers in different languages
Tags: webdev, javascript, go, rust
Published: 2023-01-18 14:12:32

Being mainly a JS developer I often find myself testing out new frameworks (new ones pop up every week or so) to find what works best for the next project I do. I mostly worked and tested frontend frameworks, but recently I wanted to try backend development. So I started to look at different options for my next project.

Since I worked only with NodeJS so far I wanted to see how it compares to different JS runtimes (Deno and Bun) and to different languages. So for my research, I chose to test Deno, Bun, Go, Go and Fiber, Rust, and Actix against the ones I know (Node and Express).

## Setup

For testing I set everything on my M2 Macbook and installed NodeJS, Deno, Bun, Go, and Rust. The setup was painless for all of them since for everything you just need to run a single command from their website and you are good to go.

I also used a tool called `wrk` to run the tests. This is an amazing tool to benchmark HTTP requests to your server. I ran it with the following configuration:

- 8 threads
- 256 concurrent requests
- 30-second test duration

I created the simplest web server for every language (+framework) I could find and ran the tests 10 times with the following command:

```bash
wrk -t8 -c256 -d30s http://127.0.0.1:8000
```

## Results

After running the results I found some interesting stuff. While I expected Go and Rust to beat all the JS runtimes that didn't happen. Deno was almost as good as Actix, and Bun almost beat Go for the top spot. Sadly NodeJS fell well behind all of them with the worst being Express. Express came dead last being over 10 times slower than Bun, almost 6 times slower than Deno and 5 times slower than raw NodeJS.

## Conclusion

While this is in no way a comprehensive comparison it gives me an idea of what to expect when choosing the technology for my next project. The results here may be different depending on what I need for my project. My main takeaway here is that it may be time to start moving away from NodeJS, at least when it comes to backend development.

All the results and scripts can be found [here](https://github.com/filipjanevski/server-runtime-benchmark).
Deploy Django App Online
Tags: webdev, django, python
Published: 2023-01-18 14:11:53

There are various ways to deploy your Django application online, everyone of them have some free tire where you can deploy your app for free or for minimum monthly charges.

1. [PythonAnywhere](https://www.pythonanywhere.com/) 
    - PythonAnywhere is a hosting service that specifically targets web applications written in Python, including Django. It provides a simple and straightforward way to deploy and run Django applications in the cloud.
    - PythonAnywhere is one of the easiest ways to deploy your Django App online and share it with the world.
[tutorial](https://www.youtube.com/watch?v=1oOr7o3Cx1Y) 

2.[GCP](https://cloud.google.com/python/django/appengine), [AWS](https://aws.amazon.com/elasticbeanstalk/), [Azure](https://learn.microsoft.com/en-us/azure/app-service/tutorial-python-postgresql-app?tabs=django%2Cwindows)
    - GCP, Aws and Azure provide App Engines and Database services to Deploy your Django app with ease.

3. [Virtual Private Server (VPS) ](https://en.wikipedia.org/wiki/Virtual_private_server) 
    - Virtual Private Server(VPS) like AWS EC2 provide a linux terminal to access a linux server where you can set up your application and host it.
    - With a VPS, you have more control over the environment, but you will need to handle the infrastructure and scaling yourself.

Using PaaS services such as App Engines[2] provided by various cloud providers is easy while VPS[3] are cheaper.

Ultimately there are multiple ways to deploy Django app you just have to find what best suites your needs.
How to do Subnets Tagging in AWS CDK
Tags: aws, awscdk, cdk, iac
Published: 2023-11-04 00:33:52

---
title: How to do Subnets Tagging in AWS CDK
published: true
date: 2023-01-18 14:00:42 UTC
tags: #aws #awscdk #cdk #iac
canonical_url: https://blog.mikaeels.com/how-to-do-subnets-tagging-in-aws-cdk
---

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0krpw1mkmzn4a08kwwaq.jpeg)

Tagging subnets in AWS CDK is a great way to organize and manage your resources within your VPC. By using tags, you can easily identify and filter resources based on their purpose, environment, or any other criteria that are important to your organization. In this blog post, we will show you how to tag subnets in AWS CDK using a few examples.

First, let's start by creating a new VPC in AWS CDK. You can do this by using the `Vpc` class in the `aws-cdk-lib` package.

```
import * as cdk from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';

const app = new cdk.App();
const stack = new cdk.Stack(app, 'my-stack');

const vpc = new ec2.Vpc(stack, 'my-vpc', {
  cidr: '10.0.0.0/16',
  natGateways: 0,
  subnetConfiguration: [
    {
      cidrMask: 24,
      name: 'public',
      subnetType: ec2.SubnetType.PUBLIC
    },
    {
      cidrMask: 24,
      name: 'private',
      subnetType: ec2.SubnetType.PRIVATE
    }
  ]
});

```

In this example, we are creating a new VPC with a CIDR block of 10.0.0.0/16 and two subnets, one public and one private. The `subnetConfiguration` property is used to define the subnets, and the `cidrMask` property is used to specify the CIDR block for each subnet.

Next, we can add tags to the subnets using the `addTags` method. This method takes an object that contains the tag keys and values.

```
vpc.publicSubnet.addTags({
  'Environment': 'Prod',
  'Purpose': 'Web servers'
});

vpc.privateSubnet.addTags({
  'Environment': 'Prod',
  'Purpose': 'Database servers'
});

```

In this example, we are adding two tags to the public subnet, "Environment" and "Purpose", and setting their values to "Prod" and "Web servers" respectively. We are also adding two tags to the private subnet, "Environment" and "Purpose", and setting their values to "Prod" and "Database servers" respectively.

Once you have tagged your subnets, you can use the AWS Management Console or the AWS CLI to filter and view your resources based on their tags. This can help you easily identify and manage your resources based on their purpose, environment, or any other criteria that is important to your organization.

In this way, you can use the `addTags` method to tag the subnets in your VPC. This is a powerful way to organize and manage your resources in AWS CDK, and it can help you easily identify and filter resources based on their purpose, environment, or any other criteria that is important to your organization.
Join the beta test for Falling Square on iOS
Tags: ios, gamedev, programming, news
Published: 2023-01-18 14:00:00

Hello everyone,

I am excited to announce that the iOS version of Falling Square is currently in testing. You can download it on TestFlight using this direct [link](https://testflight.apple.com/join/FDwsjAQR). I welcome any feedback from players. Your input will help me to make the game even better for everyone. I'm thrilled to bring this game to iOS users and can't wait for you to try it out. So, download the game now and let us know what you think!

Falling Square is a fast-paced and highly addictive mobile game that will put your reflexes to the test. The goal of the game is to touch the squares that are falling from the top of the screen before they leave the screen. The game is simple, yet challenging, and it requires quick reflexes.


![game](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cf1r7rva6zo3k5pb7dkb.gif)

Download link: [https://testflight.apple.com/join/FDwsjAQR](https://testflight.apple.com/join/FDwsjAQR)

Thank you for reading this article!
Frontend React Developer, with Relocation to sunny Dubai, is wanted. 🌴
Tags: relocation, seniorfrontenddeveloper, reactdeveloper, react
Published: 2023-01-18 13:54:28


◾Project: a freelance platform.
◾ Requirements: 
-5+ years of experience with React/Redux/Vanilla.js; 
-experience in Node.js 
- AWS or CI/CD familiarity
◾Location: relocation to Dubai 
◾ Good compensation, new stack, relocation support, and benefits package. More details are here: https://djinni.co/jobs/511166-frontend-react-developer-relocation-opportuni/

Please, share if you know someone who might be interested. Let's get in touch here: alina.malysh@allstars-it.com
How to Build a Real world Website Using HTML CSS JavaScript
Tags: css, javascript, beginners, tutorial
Published: 2023-01-18 13:53:35


{% youtube GohJZd9Tu2Y %}

In this course, you will create a completely responsive real-world website with modern UI in HTML, CSS, and JavaScript.
Starting with the interesting parallax effect and gradient backgrounds.
How it works, projects and much more.
By completing this project, you will get a solid foundation in frontend development as well as experience with Figma, which will help you to build more creative websites in the future.


[Source code](https://www.patreon.com/posts/digitalmedia-77406979?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link)
[Figma UI](https://www.patreon.com/posts/digitalmedia-ui-77406747?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link)


⏱️ Timestamps
-----------------------------
0:00 - Demo
1:41 - Project initial
12:59 - Header
30:40 - Hero section
48:42 - Process section
1:00:26 - Work section
1:12:06 - Footer
1:27:34 - Media queries
1:40:51 - Parallax effect
1:46:17 - Media queries
How do you track events/changes in distributed and complex systems?
Tags: discuss, research, devops, sre
Published: 2023-01-18 13:51:28

Hi folks, 

Hope you’re all well! I’m looking for some help and would like to ask you for a small favour 🙏 I’m doing a research and would like to speak to DevOps Engineers and SREs. I want to understand your pains and frustrations when it comes to tracking events/changes in distributed and complex systems. 

To give you some context: over the past year or so I’ve been hearing a lot about GitOps, Terraform, observability and security issues DevOps teams are having on a daily basis. For example:

- Many teams are using GitOps practices. What happens is that they cannot see the actual state of a pipeline, but the declarative one. How do you know what’s ACTUALLY running in your environment or what’s the ACTUAL state of your pipelines? Does the declarative nature of GitOps allow you to answer these questions?
- “Terraform plan is so huge you don't realize it is changing something you don't want to be changed” - [Twitter](https://twitter.com/mistersql/status/1456605428746489861?s=20&t=KJPX5HBOuzhcJUnzgJpHiQ). Do you also experience this when using Terraform? How do you monitor (manual) changes in infrastructure? ([Reddit](https://www.reddit.com/r/Terraform/comments/uirwuv/monitor_changes_in_state_against_infra/?utm_source=share&utm_medium=web2x&context=3))

These are two examples of what I hear fairly often, but I’d love to hear from more DevOps and SRE professionals. What else would you add to this list from your personal experience? 

If you would like to further help with this research, my ask from you is 15-20minutes of your time for a chat. I’d highly appreciate any input or insights 😌 Simply send me a private message to arrange the chat.

🚨 Disclosure 🚨

This is strictly for research. If we have a chat there will be absolutely no sales pitch. I will not store any of your emails nor follow up after the chat.
🧪 How to set up Jest & React Native Testing Library in your Expo App! 💥
Tags: reactnative, testing, tutorial, mobile
Published: 2023-01-18 13:50:05

If you've used React Testing Library in a regular React project before then the React Native version will already seem familiar, however getting everything setup and configured is usually the trickiest part!

---

## What we'll be using:
- [React Native Testing Library](https://callstack.github.io/react-native-testing-library/)
- [react-test-renderer](https://www.npmjs.com/package/react-test-renderer)
- [Jest](https://docs.expo.dev/guides/testing-with-jest/)

---

## Prerequisites
- A React Native [Expo](https://docs.expo.dev/) project.

Create a new one if you don't have one to work on already. [See the Expo docs on creating a new project](https://docs.expo.dev/tutorial/create-your-first-app/))

---

## Installing React Native Testing Library.
Go ahead and install React Native Testing Library. I'm using **npx expo install** since I'm using Expo:
```npx expo install @testing-library/react-native -- --save-dev```

---

## Installing react-test-renderer
We'll also need to install [react-test-renderer](https://www.npmjs.com/package/react-test-renderer), as React Native Testing Library uses it as a dependency. 

**IMPORTANT:** Before you install it, look in your package.json and check what version of react you are using. You need to install the same version of react-test-renderer for compatibility. For example, I'm using **"react": "18.1.0"** - Therefore I need to install **"react-test-renderer": "18.1.0"**:
```npx expo install react-test-renderer@18.1.0```

---

## Installing Jest
Finally, go ahead and [follow the instructions to install jest here](https://docs.expo.dev/guides/testing-with-jest/).
Be sure to add the configuration to your package.json

---


## Test Examples

```js
//App.test.js

import renderer from "react-test-renderer";
import { render } from "@testing-library/react-native";


describe("<App />", () => {
	it("has 1 child", () => {
		const tree = renderer.create(<App />).toJSON();
		expect(tree.children.length).toBe(1);
	});

	it("renders correctly", () => {
		const tree = renderer.create(<App />).toJSON();
		expect(tree).toMatchSnapshot();
	});
	it("renders Hello World message on the home page", async () => {
		render(<App />);
		expect(screen.getByText("Hello, World!")).toBeDefined()
	});
});

// NOTE: You can use either:
// renderer.create(<App />) from  "react-test-renderer"
// or render(<App />) from "@testing-library/react-native"

```

The above tests are based on a super simple app with only one child. If you have a more complex app with additional libraries, then there may be more setup required, and I will go into these scenarios in more detail in future articles. 

Please feel free to comment anything useful or interesting you've found when setting up testing on your Expo project.

Happy testing!
Change the place to refresh your mind
Tags: productivity, habits, tips, advice
Published: 2023-01-18 13:49:52

---
title: Change the place to refresh your mind
published: true
tags: productivity, habits, tips, advice
canonical_url: https://klimchuk.dev/posts/change-the-place-to-refresh-your-mind/
---

![Change the place to refresh your mind](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6fto104s4hqdfptz7x8u.jpg)

This time I want to share some tips that I read in the book “Atomic Habits” written by James Clear. It is not about productivity itself, but it is still very useful.

Our habits often rely on the places where we used to do something. When we visit these locations, we activate certain habits. We don't even think about it. It just happens, like a pattern. It means that if we used to start working days with a cup of coffee and reading the news, changing this behavior just because we have a desire is almost impossible. We need to break the usual behavioral loop.

My example. I’ve tried to read a paper book before work many times. I used to use the same pattern. Every day I usually make a cup of coffee, sit down in my chair, and… start checking emails, Twitter, updating my code environment, and other stuff. When did I remember about the book that was right in front of me? Correct, after around 1 hour. I wasted that hour, to be honest. I did not work or read.

To solve it, I changed the place. I started reading near the sofa, sitting on the floor. It works well for me during the weekends as well, when I'm looking after my 8-month-old daughter. When she plays, I can read. At other times, I also go to the living room and read there. In the cabinet, I can only work with my laptop. Changing places clears our patterns, and it may help you concentrate on the task you would like to accomplish.

If you would like to do something that you could not start for a long time, try to change the place. It should be different from your usual working area. Try to change the room or just site in the room. It is necessary to break your usual patterns.

### More from me

[Subscribe to Ivan's Weekly Focus](https://ivanklimchuk.substack.com/) and get weekly updates about my indie-making journey, and tips, tools, and approaches, which help to be more productive.

Follow me on [Twitter](https://twitter.com/intent/follow?screen_name=ivnklm), [LinkedIn](https://www.linkedin.com/in/ivanklimchuk/), [Medium](https://medium.com/@ivanklimchuk), [DEV](https://dev.to/ivanklimchuk), [Indie Hackers](https://www.indiehackers.com/ivanklimchuk), and [Product Hunt](https://www.producthunt.com/@ivanklimchuk).