teleren/devto huggingface dataset:
I-Snail - Gitpod is about three times faster than my i9 Mac
Tags: gitpod, macos, cdk
Published: 2021-06-13 15:07:51

Just checking gitpod.io.

Trying aws CDK 2.0 with go...

Just look at these numbers:

## MacBook Pro 2019 Intel 8 Core i9

![View on Mac](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aruqjhpo5g2r9hb1t5ob.png)

This `go test` needs about 11 seconds.

## GitPod (Intel(R) Xeon(R) CPU)

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

This is the same command on a gitpod (free version) - 3.8 seconds!

Some time is wasted on the sophos engine running on the mac.. but 3 times faster is really fast!

Or - please not - is it that linux is so much more efficient? And don`t talk about GO alone, this is CDK, so there is some Node.JS in the background too!

What are your experiences?

## Thanks

Photo by <a href="https://unsplash.com/@zmachacek?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Zdeněk Macháček</a> on <a href="https://unsplash.com/s/photos/snail?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Spot Instance Scenarios
Tags: aws, spotinstance, kms, role
Published: 2021-06-13 14:55:45

**Scenario**

* Instance stopped by AWS due to Insufficient Capacity but not started automatically by AWS when Capacity is available again.
* No issue when user start the instance manually.

**Reason**

* Service role is not able to access the KMS key that is cross account and the instance is using this KMS for their volume.

**Troubleshooting**

* Look at the configuration changes and you will see “Client error on launch”.

![1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxc7mcw4k7uk6zg71o4c.jpeg)

* Check CloudTrail logs and you can see the Access Denied error on KMS.

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

**Solution**

On the account whereby the instance is launched, run the following command to grant the KMS permission to service role.
```
aws kms create-grant — region <region> –key-id <arn of the KMS> — grantee-principal <arn of the Spot Service Role> — operations “Decrypt” “Encrypt” “GenerateDataKey” “GenerateDataKeyWithoutPlaintext” “CreateGrant” “DescribeKey” “ReEncryptFrom” “ReEncryptTo”
```
Example:
```
aws kms create-grant — region ap-southeast-1 — key-id arn:aws:kms:ap-southeast-1:123456789:key/479d6414-e442–4873–9b10-123dwdas343 — grantee-principal arn:aws:iam::987654321:role/aws-service-role/spot.amazonaws.com/AWSServiceRoleForEC2Spot — operations “Decrypt” “Encrypt” “GenerateDataKey” “GenerateDataKeyWithoutPlaintext” “CreateGrant” “DescribeKey” “ReEncryptFrom” “ReEncryptTo”
```
*Result:*

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

Note: 
Monitor the situation to ensure that instance starts up whenever spot instance is reclaimed by AWS due to insufficient capacity.
The Satoshi Mindset | Bitcoin, a stoic response to a financial problem
Published: 2021-06-13 14:49:58

Satoshi Nakamoto is a symbol of hope.Not because the pseudonymous creator of Bitcoin birthed a brand new currency, a payment system, or even that he solved an ages old computer science problem, no it’s much deeper than that.

On January 03 2009, block 0 of a new distributed system was mined. Contained within, was a message, “The Times,03/Jan/2009, Chancellor on brink of second bailout for banks”, revealing some of the thinking behind its genesis.

Taking into account that this was in the midst of the financial crisis, and combining that with later writings, we can infer that Satoshi wasn’t happy with the economic system he found himself in.

What’s interesting though, is that instead of complaining,grumbling, whining, lobbying politicians, voting,protesting, occupying wall street, or any of that — ALL which I might add, never achieved any of their desired outcomes — he dared to create an alternative, and asked permission from no-one.He saw the problems of the world and what he could do about them without crying out or bawling out to anyone.

Even though we still live in this imperfect world, with many of the same corrupt forces,you could argue that Bitcoin has already succeeded in that it:

- Created a censorship-resistant system used by millions of people

- Created the most powerful computer hashing network in existence

- Created a market valued at multiple billions, all from nothing

- Has been used as a safe haven by citizens in failed states around the world

- Spawned a whole raft of other important software innovations

As Peter Thiel would say, that is a 0 to 1 development. Satoshi started all of this when he sat down and figured out how to solve a seemingly unsolvable problem.

continued - https://vocal.media/theChain/the-satoshi-mindset
How to remove duplicates element from array
Tags: javascript, beginners, react
Published: 2021-06-13 14:32:40

In this post i'm going to remove duplicates element from array,i will try with multiple approaches to remove duplicates element from array.

***Method 1*** 
Using Set
```javascript
const array = ["a","b","c","d","a","c","e","f"];
const m1 = [...new Set(array)];
console.log(m1);
// ["a", "b", "c", "d", "e", "f"] 
```
***Method 2***
Using object

```javascript
const array = ["a","b","c","d","a","c","e","f"];
let obj = {};
for (let arr of array){
obj[arr]=true;
}
console.log(Object.keys(obj));
// ["a", "b", "c", "d", "e", "f"] 
```
***Method 3***
Using Loop
```javascript
const array = ["a","b","c","d","a","c","e","f"];
const m3 = [];
for(var i = 0;i<array.length;i++){
const arr = array[i];
m3.indexOf(arr) === -1 && m3.push(arr);
}
console.log(m3)
// ["a", "b", "c", "d", "e", "f"]
```
***Method 4***
Using Filter
```javascript
const array = ["a","b","c","d","a","c","e","f"];
const m4 = array.filter((el,index)=>array.indexOf(el) == index);
console.log(m4);
// ["a", "b", "c", "d", "e", "f"]
```
Dropdown menu using CSS Flexbox
Tags: codenewbie, css, codepen, todayilearned
Published: 2021-06-13 14:10:46

Hello dear folks, As you might know I'm a full-time wordpress CMS developer, currently learning core languages like #HTML #CSS #javascript and I'm on mission to learn and share daily but because of my job i don't have much time for content creation work. But i always try to give my best so please support my work by following me :)

I have spend this whole week and #sunday too to learn and make this basic dropdown menu using flexbox. Because new things/learning takes time.

Now play with this codepen project to clear your question.

{% codepen https://codepen.io/atulcodex/pen/qBrJxwb %}

Comment below your suggestions/opinion/queries, I'm waiting.
Formas de ganar dinero como programador
Tags: programming, programador, development, money
Published: 2021-06-13 14:08:03

A continuación, puede encontrar una lista de formas en que puede ganar dinero como desarrollador. Escribí estos artículos hace un tiempo y pensé que las personas podrían encontrarlo valioso, así que decidí compartirlo con ustedes. 😄

Lo más habitual es tener un trabajo en una empresa o trabajar como autónomo para varios clientes
Cree y venda productos digitales (complementos, componentes (en React, Angular, Vue, Bootstrap, etc.), temas, etc.)
* Construir un SAAS (software como servicio)
* Cree aplicaciones web , móviles y / o de escritorio donde pueda tener anuncios o compras dentro de la aplicación.
* Crea un blog y monetízalo a través de:
anuncios (Google Adsense, carbonads, etc.)
patrocinios
convertirse en afiliado y promover los productos de otras personas
promociona tus propios productos y se les paga por escribir artículos para publicaciones
* escribir y vender libros electrónicos y / o libros físicos 
* crear un canal de YouTube (sobre temas como: tutoriales, estilo de vida de los desarrolladores, consejos y trucos, noticias sobre el terreno, etc.) y monetizarlo a través de:
Anuncios de YouTube
patrocinios
la comercialización del afiliado
promociona tus propios productos
* crear cursos en línea y / o programas en línea
transmisión en vivo (en Twitch, YouTube, etc.) y monetizarla a través de: donaciones con suscripciones mensuales
* crear un podcast patrocinio promociona tus propios productos
* trabajar en proyectos de código abierto y obtener donaciones y patrocinios
* crea una página de Patreon donde la gente pueda apoyarte
* crear una bolsa de trabajo y que las empresas les paguen para conectarlas con desarrolladores , diseñadores , etc.
* vender botín
* vender un boletín
* tener sesiones de coaching individualizadas
* crear un robot comercial
* participar en desafíos de codificación pagados
participar en programas de recompensas por errores

¡No dudes en comentar cualquier otra forma que deba agregarse a la lista! 😃
How to increase/decrease FileSystem under LVM
Tags: filesystem, storage, volume, ebs
Published: 2021-06-13 14:00:17

**Steps**

a. Before starting, ensure the following packages are installed
```
e2fsprogs
lvm2
```

b. Run pvdisplay to check which EBS is under LVM.
```
sudo pvdisplay
```
c. Run vgdisplay to check unallocated space available for a volume group
```
sudo vgdisplay
```
d. Find the lvm fs that you want to increase/decrease.
```
sudo lvscan
```
e. Example: Increase vol17 size from 5Gb to 15Gb
```
>>lvextend -L15G /dev/vgs1/vol17 --resizefs
```
f. Example: Reduce vol17 size from 5Gb to 1Gb ( you can only do this if no process is holding to the fs. Best is to unmount the fs)

* Important to ensure package e2fsprogs is installed, else the below command can cause superblock/partition table corruption.
```
>>lvreduce -L1G /dev/vgs1/vol17 --resizefs
```
g. If the EBS is resized, then need to do the following, example /dev/xvdg was resize from 950Gb to 1150Gb
```
lsblk
> growpart /dev/xvdg 1
```
h. Resize the physical volumes using the pvresize command.
```
pvresize /dev/xvdg1
```
i. Use vgdisplay to see the increased free size. To see what fs type that the LVM fs is run,
```
lsblk -f
```
j. 
i. If you are restoring an EBS snapshot with LVM, after mounting the restored EBS volume, then you need to do the below.
```
sudo yum install lvm2 (if lvm command not found )
sudo vgchange -ay
```
ii. If doing pvdisplay shows an unknown physical volume, then run command
```
vgreduce — removemissing <VG NAME>
```
k. To increase swap space under LVM, do the following
```
>>swapoff -v /dev/vgs1/vol54swap
```
Disable the vol that contain the swap, might need to stop appls if swap is in-use and free memory not available.
```
>>lvextend -L32G /dev/vgs1/vol54swap
>>mkswap /dev/vgs1/vol54swap
>>swapon -va
>>cat /proc/swaps
```
l. If the disk increased is greater than 2Tb and is using MBR partition type, you need to convert to GPT partition type.
```
gdisk /dev/nvme1n1
```
[https://superuser.com/questions/1250895/converting-between-gpt-and-mbr-hard-drive-without-losing-data]
When should we use Machine Learning to solve a problem?
Tags: article
Published: 2021-06-14 15:50:11

---
title: When should we use Machine Learning to solve a problem?
published: true
date: 2021-06-13 13:51:56 UTC
tags: Article
canonical_url: https://reinforcement-learning4.fun/2021/06/13/when-should-we-use-machine-learning-to-solve-a-problem/
---

We use Machine Learning for problems that traditional programming can’t solve.

In other words, we use Machine Learning for problems in which we can’t infer a logical sequence of steps or rules to solve the problem.

For example, let’s say that we want to build a program to recognize the fruit contained in a picture.

… [Continue reading When should we use Machine Learning to solve a problem? →](https://reinforcement-learning4.fun/2021/06/13/when-should-we-use-machine-learning-to-solve-a-problem/)
Update #1 on Learning in Public 
Tags: roamresearch
Published: 2021-06-13 13:50:53

Hello everyone,

It's been 2 weeks since I launched my [Learning in Public] Roam Research graph. 

As I wrote in the initial blog post, the goal of the graph is to start documenting my learnings in a manner that is usable by others. Moreover, I hope that this graph will result in a multiplayer learning experiment. That means that multiple people will log their learnings on the graph and enrich the various **Locations of Knowledge**.

After running with this for 2 weeks, here are a couple of learnings

## New Locations of Knowledge

You can find all the Locations of Knowledge on the [Roam Research Graph](https://roamresearch.com/#/app/Symposium/page/mG9aABxkw)

### Solidity

- Baseline architecture for an oracle
- What is a library? 
- What is the delete keyword
- Fallback Functions
- What is delegatecall()
- How to force ether into a contract
- Security implications for
  - Interfaces
  - `transfer()`, `send()`

Solidity has been going great, having finished [CryptoZombies](https://cryptozombies.io/) and investing considerable time into [Ethernaut](https://ethernaut.openzeppelin.com/). 

As you will see, the new additions are vastly more advanced concepts than the first iteration of the Location of Knowledge for Solidity


### Mechanism Design

I am happy to share with you all the I started a new course for Mechanism Design. Notes from the 2 first lectures have been added in the Graph. 

Mechanism Design is hugely relevant to blockchains, since it's about designing systems that achieve a certain goal in the presence of strategic players. 

It's a science that compliments psychology, computer science and game theory. As you can see, with blockchains having an intrinsic economic part, being able to create systems that align the interests of different players is challenging. 

A very good example of good mechanism design is MakerDAO. The good design stems from the fact that the system has been able to work for all these years, providing both lending services and a stablecoin that is fully transparent. In it's very essence, the stability is due to good mechanism design and not obscure storage of dollar equivalents 

### DeFi

I have started learning more about DeFi, thus a couple of interesting insights have been already logged into the Graph. 

- What is MakerDao
- What is Uniswap
- How AMM work? 
- What is slippage?

This is a first pass and I will enrich the content as I read more about them. 


## System

Minor changes have been implemented in the personal pages. 

There are 2 new categories, one to log the **Open Questions** that the person has while taking **fleeting notes**. Another to keep track of videos that are relevant to a **fleeting note** and the person wants to view them alter. 

I consider to re-evaluate the system on a monthly basis. 

## Want to engage?

Take a look inside the graph. If it's interesting to you, drop into Discord and let's have a chat!

Discord: https://discord.gg/CqpaY9FAgU

See you in 2 weeks :)
New release for fpdf2
Tags: python
Published: 2021-06-13 13:50:32

This release brings basic Markdown styling, JPEG storage improvements, presentation transitions and many other features!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6upl1do5vsknegrnylbf.png)

More details, including how to convert GIFs to PDFs, in this announcement blog post: https://chezsoi.org/lucas/blog/fpdf2-4-0-and-converting-gifs-to-pdfs.html
Understanding Kubernetes in a visual way (in 🎥 video): part 16 – Nodes
Tags: kubernetes, devops, docker, beginners
Published: 2021-06-13 13:40:33

---
title: Understanding Kubernetes in a visual way (in 🎥 video): part 16 – Nodes
published: true
description: Serie of videos about Kubernetes. Explaining in a visual way Kubernetes principles.
tags: Kubernetes, DevOps, Docker, beginners
series: Understanding Kubernetes in a visual way - (in video) in video
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukp7dswfsoo0e3emlrna.jpg
---

Understanding Kubernetes can be difficult or time-consuming. In order to spread knowledges about Cloud technologies I started to create sketchnotes about Kubernetes, then I've auto-published a book and since now I've started a new serie of video! :-)

I imagined a serie of short videos with a mix of sketchnotes and speech.

I think it could be a good way, more visual, with audio & video to explain Kubernetes (and others technologies).

This episode is focused on Nodes and operations we can make on Nodes: Cordon, Drain, Taint...

{% youtube 12I7UwT7xXQ %}

The video is in French BUT I done the subtitles in english (and french too).

If you liked the video and are interested to watch another ones, please give me some feedbacks (and you can also subscribe to [my Youtube channel](https://www.youtube.com/channel/UCrRk0kOP58lBMl9B8ZS8Vlg), if you want to ❤️).

If you are interested, I published all the sketchnotes on Kubernetes (and new ones!) to make a "book" of 165 pages: ["Understanding Kubernetes in a visual way"](https://gumroad.com/aurelievache#uCxcr).

If you like theses sketchnotes, you can follow me, I will publish others sketchs shortly :-).
Image Transformation: Convert pictures to add styles from famous paintings
Tags: tensorflow, nuxt, tailwindcss, image
Published: 2021-06-13 13:09:00

Hey guys!

I have developed an application, that converts your pictures look like famous paintings with the click of a button!

[![Image from Gyazo](https://i.gyazo.com/190f53a9bbdef934a251581b42e07b68.gif)](https://gyazo.com/190f53a9bbdef934a251581b42e07b68)
 
* This article is the fourth week of trying to write at least one article every week.

Past articles are listed below.

- [Face detection with Tensorflow【React + TypeScript】](https://dev.to/yuikoito/face-detection-by-using-tensorflow-react-typescript-3dn5)
- [UI Components website Released!](https://dev.to/yuikoito/ui-components-website-released-2g8e)
- [I made 18 UI components for all developers](https://dev.to/yuikoito/i-made-18-ui-components-for-all-developers-17l6)

# Usage

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

The usage is really simple.
Select a picture and choose your favorite style.

[![Image from Gyazo](https://i.gyazo.com/44f89e5c5e911f9e15115afdf9c8c8c0.gif)](https://gyazo.com/44f89e5c5e911f9e15115afdf9c8c8c0)

Then you will get your original art with your picture!

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jun9r0wy2llsfukcjihe.png)
 
Freely share and save it.

## How to develop

The front part of this project is built using Nuxt.js and Tailwind CSS.
For image processing, I made API from the following repository.

https://github.com/lengstrom/fast-style-transfer

To make the API, I used AWS service in the following configuration.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0nfd1lgdz8r52ywiy9fo.png)
 

Initially, I used the following configuration, but when processing with Lambda, it inevitably took a long time to start up from cold-starting. So I changed it to the above configuration.
By using Lambda only as an intermediary with EC2, not for image processing, and by doing the processing on EC2, the startup of Lambda became much faster.

![image (1)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jancal1fv17t15jzaved.png)
 
## Finally

I hope you will enjoy using my application, even though it is probably still inadequate in some ways.

I'm always looking forward to your feedback and bug reports.

Thank you for reading.

🍎🍎🍎🍎🍎🍎

Please send me a message if you need.

yuiko.dev@gmail.com
https://twitter.com/yui_active

🍎🍎🍎🍎🍎🍎
Zigzag tree traversal
Tags: tree, ds, cpp
Published: 2021-06-13 13:00:55

In this article I will show you how to traverse a tree in zigzag manner

```cpp
// zigzag trav for tree
             
            --->
//           12
//         /	\
		<------------
//        9		 15
//       / \
	  ------------>
//      4	10

// output :- 12 15 9 4 10

#include<iostream>
#include<stack>
using namespace std;
class Node
{
public:
	int data;
	Node *right,*left;
	Node(int data)
	{
		this->data=data;
		right=left=NULL;
	}
};
void zigzagtrav(Node *root)
{
	stack<Node*> curr;
	stack<Node*> next;
	bool leftToright=true;
	curr.push(root);
	while(!curr.empty())
	{
		Node *tmp=curr.top();
		curr.pop();
		if(tmp)
		{
			cout<<tmp->data<<" ";
			if(leftToright)
			{
				next.push(tmp->left);
				next.push(tmp->right);
			}
			else
			{
				next.push(tmp->right);
				next.push(tmp->left);
			}
		}
		if(curr.empty())
		{
			leftToright=!leftToright;
			swap(curr,next);
		}
	}
}
int main()
{	
	#ifndef ONLINE_JUDGE
		freopen("../input.txt", "r", stdin);
		freopen("../output.txt", "w", stdout);
	#endif
	Node *root=new Node(12);
	root->right=new Node(15);
	root->left=new Node(9);
	root->left->left=new Node(4);
	root->left->right=new Node(10);
	zigzagtrav(root);
	return 0;
}
```
here we are using two stacks
1. `curr` which is to store our current node
2. `next` which is to store the next node 
3. here the `leftToright` is to check that are we are printing the nodes left-to-right or right-to-left if the variable is true then we are printing the nodes left to right else print right-to-left.
4. Here if `leftToright` is true we are pushing the current left and then right node to next stack else push current right and then left node to next stack.
5. and checking if the curr node is empty swap the stack with next stack and toggle the `leftToright` variable.

Do it until both stack is empty.
C# Tips and Tricks - Part 2
Tags: dotnet, csharp, tips
Published: 2021-06-13 12:50:05

In this article we will be covering:

- Top-level statements
- Static directive

You can watch the full video on YouTube
{% youtube xCFUXUlr8Ac %}

You can get the source code on GitHub:
https://github.com/mohamadlawand087/v34-CodeTipsTricks-Ep2

### Top-level statements

they are new language features that got added in C# 9 and one of the goals to make it easier for beginners to jump start developing C# applications.

When writing top level statements i  don't need to add all of the boiler plates code that i usually add when writing code.

```csharp
using System;

Console.WriteLine("Hello world!");
```

All of the boiler plates code will be automatically generated for us and we don't have to worry about creating it ourselfs.

Top-level statement also support async code 

```csharp
using System;
using System.Threading.Tasks;

Console.WriteLine("Wake up world!");
await Task.Delay(2000);
Console.WriteLine("Have breakfast");
```

Now let us introduce methods

```csharp
GetMyName("Mohamad");

private static string GetMyName(string name)
{
	return $"Hello {name}, welcome to C# 9";
}
```

Now lets run the application and see it in action. 

The goal of Top level calls is to simplify this code and we can transform our application to something easy to read and understan

C# will assume this is the entry point to our application

Why use TLC

- simplicity
- quick to create
- very simple to use in a none windows environment
- easily created from within the terminal

### Static directive

the using static directive allows us to use static types inside our applications without needing to referencing the type name everytime.

One common example of this is using Console application will allow us to  read/write to line. but we need to add the Console type everytime we want to use. What if we can imply that we are using console type without having to write console everytime we use console. 

```csharp
using System;
using static System.Console;

WriteLine("Hello Static Directive");
var email = ReadLine();
WriteLine(email);
```

Please comment your questions as well subscribe to my YouTube channel