teleren/devto huggingface dataset:
How attacks on Ukraine showed us how fragile the "deontology" of the Tech World is
Tags: deontology, ethics
Published: 2022-02-28 16:40:03

In a [previous post](https://dev.to/voltra/stop-mixing-science-and-politics-5cmh), I go on a bit of a tangent about mixing politics and science and how it's always a bad idea.

The conflict involving Russia invading Ukraine has showed us how fragile the deontology of the Tech World is (if there were any to begin with). We're not talking boycott here, we're talking about preventing ***anyone*** from Russia to have access to some websites.

This may not please anyone out there, but I'm extremely against preventing anyone access to anything based on facts that are not up to them to control.

This shows how truly immature and how god-complex-striken the current Tech World is. People were afraid that "Big Tech" would have too much power and could do basically what they want. We laughed at them, but they were right. It's just been demonstrated: they cut-off Russia from the Society for Worldwide Interbank Financial Telecommunication.

People have been posting on reddit asking about how to block anyone from Russia to access their website and so on.

I was gonna put on a grey hat if the opportunity to do anything meaningful ever came up. But this? This just got rid of my desire to help altogether.

I can't believe that the world is run by a bunch of man-child playing around with people's lives as if they held no meaning nor value.

You don't help anyone by doing this. Hell you don't even inconvenience the ones you want to inconvenience. All you do is become a thorn in the back of honest people who never asked for any of this.

Your 2-cents "activism", that is basically "do whatever with no consequences, don't care about collateral damage", disgusts me. We're scientists for fuck's sake! Not warriors, not soldiers, not judges, not dictators: Scientists!

Maybe we need some sort of oath like the Hippocratic Oath so that adults with the mentality of children don't have anything to do with tech until they grow up and stop acting erratically or impulsively without any form of constructed thought.

You'd think STEM requiring a somewhat "high" level of education would make us more educated, but no. We act as though we're savages.

What I'm asking you all, is to stop being idiotic and to stop punishing people who did nothing wrong and never asked for any of this. Hell, you shouldn't have the power to punish them in the first place. Deontology, it's a thing, get some.

With great power, must also come great responsibility.

All my love to those in Ukraine, all my hate to those who act as children in the name of "the greater good". In hopes this conflict gets resolved quickly and with minimal casualties.
The PureScript 2022 Survey is LIVE - Go fill it out!
Published: 2022-02-28 16:35:54

---
title: The PureScript 2022 Survey is LIVE - Go fill it out!
published: true
description: We want to hear from you, no matter who you are or what programming languages you use.
tags: 
//cover_image: https://direct_url_to_image.jpg
---

I’m excited to announce the first annual PureScript Survey!

As the PureScript ecosystem grows, it’s important for our community to understand how the language is being used, in what contexts it is being adopted, and what we could do to improve both the language and our community’s governance.

The survey opens today, February 28th, and stays open for one week. It closes on March 7th.

I very much hope that you’ll take a moment to fill out the survey. Even if you’re not using PureScript, we want to hear from you. [Here is a link to the survey](https://surveyhero.com/c/wzajwjpd). In addition to filling it out, please feel free to share it. Thanks!
View list of GitHub commits within the specified date range
Tags: beginners, git, javascript, webdev
Published: 2022-02-28 16:18:03

### Hello Folks 👋
What's up friends, this is **SnowBit** here. I am a young passionate and self-taught frontend web developer and have an intention to become a successful developer.

Have you ever needed to get the previous commits of your project within a specific amount of time?

Today, I will show you a very important `git` command that prints a list of GitHub commits within the specified date range.

---
### Let's dive into the terminal
Let's print all commits in the specified date range.

- Using the following command to log all the commits between `<date-from>` and `<date-to>`.
```bash
git log [--since=<date-from>] [--until=<date-to>]
```

**Let's run the command  ✌️**
- Go to your project library (make sure the repository is git initialized).
- Open terminal 😎
- Run the following command:
```bash
git log --since='Feb 10 2022' --until='Feb 28  2022'
```

Here's the output of this command
![commits command output](https://cdn.hashnode.com/res/hashnode/image/upload/v1646063822553/ex5XY15km.png)
Isn't this a cool command?

- You can even use the following command
```bash
git log --since='3 weeks ago'
```

- To exit, press `Q`

---
So, this was it for this article. I hope you learnt something new and enjoy reading. Stay tuned for the next article. 

Let's connect on Twitter - [@codewithsnowbit](https://twitter.com/codewithsnowbit)

### 🌏 Let's connect
- [GitHub](https://github.com/codewithsnowbit)
- [Twitter](https://twitter.com/codewithsnowbit)
- [YouTube](https://www.youtube.com/channel/UCNTKqF1vhFYX_v0ERnUa1RQ?view_as=subscriber)

[![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7242fho13cwcxlh8jutn.png)](https://www.buymeacoffee.com/codewithsnowbit)
Some shortcuts you’ll use each day on Windows 
Tags: productivity, shortcuts, windows
Published: 2022-02-28 16:07:50

---
title: Some shortcuts you’ll use each day on Windows 
published: true
description: 
tags: productivity, shortcuts, windows
cover_image: https://images.unsplash.com/photo-1526920929362-5b26677c148c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1176&q=80
---

## Clipboard history

Do you ever dream of a clipboard history ? You want to keep two or three elements in your clipboard and find them again later. You think to get many screenshot at the same time. 

So you should try <kbd>Window</kbd> +<kbd>V</kbd>

This will let you enable the clipboard history. Once it’s activated, each time you you copy something, it’s added to your clipboard history. It can keep a few elements, depending on their size. 

Here you can just copy many things with Ctrl + C and paste many of them with Windows + V. 

You can also pin some to keep them in the end of the history, even if you copy a lot of them over.

## Switch from Virtual Desktop

Do you often use Virtuals Desktops on windows? If not, that’s probably caused it’s too long to switch between two of them. Going in Task View, clicking on the well screen. Too many actions for just one result. So what about only one shortcut to move to the left or right desktop ?

I’ll give you this here : it’s <kbd>Windows</kbd> <kbd>Ctrl</kbd> <kbd>→</kbd> or <kbd>Windows</kbd> <kbd>Ctrl</kbd> <kbd>←</kbd>. That’s as easy as that.
Since I like you, i’ll give you two more shortcuts : 

- <kbd>Windows</kbd> <kbd>Ctrl</kbd> <kbd>D</kbd> creates a new desktop
- <kbd>Windows</kbd> <kbd>Ctrl</kbd> <kbd>F4</kbd> deletes the actual desktop, and move all windows to the previous one

## Open the panel of specials characters

Tired of browsing internet each time you need to use a special character to copy/paste it to your text ? You should just press <kbd>Windows</kbd> <kbd>;</kbd>. It will open a panel where you can find special char, but also a gif search engine, and the list of emojis. You can just select one to add it to your text.

## Conclusion

That’s all for today. I hope those shortcuts would help you to save some time like they do for me. Tell me if it’s useful for you, and which one you already know. You can also leave a comment if you want some more article like that, maybe on another OS or software (why not on VS code, Google Chrome or adobe’s softwares).

Have a good day.
Kisses.

French version of this post just here : 
{% link https://dev.to/jeremymonatte/quelques-raccourcis-claviers-que-vous-allez-adorer-9j8 %}
CSSBattle | #7 Leafy Trail
Tags: css, cssbattle, challenge, leafytrail
Published: 2022-02-28 15:51:07

Welcome to CSSBattle Challenges!

In this short article, I go through my solution for [CSSBattle - #7 Leafy Trail](https://cssbattle.dev/play/7) challenge. Please refer to the code snippet below to get a better insight into my thought processes and the implementation detail.

---

> #### Challenge:

![Leafy Trail Challenge](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqxmack03ad9csgwxqxd.png)

---

> #### Solution:

```html
<div class="container">
  <div class="leaf left"></div>
  <div class="leaf center"></div>
  <div class="leaf right"></div>
</div>

<style>
  * {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }
  .container {
    width: 100%;
    height: 100%;
    background: #0B2429;
    position: relative;
  }
  .leaf {
    width: 150px;
    height: 150px;
    border-top-left-radius: 100px;
    border-bottom-right-radius: 100px;
    position: absolute;
    top: 50%;
    left: 50%;
  }
  .left {
    background: #1A4341;
    transform: translate(calc(-50% + -50px), -50%) 
  }
  .center {
    background: #998235;
    transform: translate(-50%, -50%)
  }
  .right {
    background: #F3AC3C;
    transform: translate(calc(-50% + 50px), -50%);
  }
</style>
```

---

> #### Key Takeaway(s):
- using `top: 50%` and `left: 50%` and `transform: translate(-50%, -50%)` to center absolute positioned elements
- adjusting border radius properties to create a leaf like element

As always, I welcome any feedback or questions regarding the implementation detail of the challenge. Otherwise, I hope this was useful!
NFTs are for amateurs! Get in on the NFC train!
Tags: nft, payments
Published: 2022-02-28 16:00:01

NFTs are so 2021! Get in on the NFC train!

Then hear from Tarric Sookdeo, Developer Relations Engineer @ Dwolla!

{% spotify spotify:episode:58f7cyx4JzCTEC8QP6hgLW %}
Setting up a Samba share in Debian to work in Windows 11
Published: 2022-02-28 15:50:43

---
title: Setting up a Samba share in Debian to work in Windows 11
published: true
description: We look into creating a Samba share on Debian. Then we connect to it from Windows 11 so we can work on our project in Windows and transfer data over Samba and run it in Linux.
tags:
cover_image: https://i.ytimg.com/vi/-rEpQanhUoI/maxresdefault.jpg
---

{% youtube -rEpQanhUoI %}

We look into creating a Samba share on Debian. Then we connect to it from Windows 11 so we can work on our project in Windows and transfer data over Samba and run it in Linux.
git find deleted files
Tags: git
Published: 2022-02-28 15:49:23

---
canonical_url: https://waylonwalker.com/til/git-find-deleted-files/
published: true
tags:
- git
title: git find deleted files
---

Listing all the deleted files in all of git history can be done by combining `git log` with `--diff-filter`.  The log gives you lots of options to show different bits of information about the commit that happened at that point.  It's even possible to get a completely clean list of files that are in your git history but have been deleted.

## git log --diff-filter

These various commands will show all files that were ever deleted on your current branch.

``` bash
# This one includes the date, commit hash, and Author
git log --diff-filter D

# this one could be a git alias, but includes empty lines
git log --diff-filter D --pretty="format:" --name-only

# this one has the empty lines cleaned up
git log --diff-filter D --pretty="format:" --name-only | sed '/^$/d'
```
## git reflog --diff-filter

The reflog can be super powerful in finding lost files here, as it only cares about git operations, not just the current branch.  It will search accross all branches for deleted files and report them.

``` bash
# This one includes the commit hash, branch, tag, and commit message
git reflog --diff-filter D

# You might want to at least add the filename
git reflog --diff-filter D --name-only

# this one could be a git alias, but includes empty lines
git reflog --diff-filter D --pretty="format:" --name-only

# this one has the empty lines cleaned up
git reflog --diff-filter D --pretty="format:" --name-only | sed '/^$/d'
```
Find closest RGB component from a color
Tags: javascript, computerscience, programming
Published: 2022-02-28 15:32:24

Recently I was asked to find the closest RGB component (red or green or blue) from a color. I had no clue at that time. Later I Googleed and found out there is a formula to calculate the distance between two colors.

This is the formula I found on [wiki](https://en.wikipedia.org/wiki/Euclidean_distance)
![distance formula](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ibrsn4lzwmbdbfzxgau.png)

Let's say we have two colors,  `rgb(0,206,102)` and `rgb(118,184,225)`. If we assume `rgb(0,206,102)` to `(x1,y1,z1)` and `rgb(118,184,225)` to `(x2,y2,z2)`. We can draw two points `(0,206,102)` and `(118,184,225)` on a three dimensional co-ordinate graph. 



![Three dimension co-ordinate graph](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcbcxtvb3gm5wwqwmb1a.png)
 
 
We can calculate the distance between two points as follows
```javascript

let distance = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2))
distance = Math.sqrt((0-118)*(0-118)+(206-184)*(206-184)+(102-225)*(102-225))
distance = 171.86331778480246

```

Now, let's solve the current problem. 

Create a function which will find the distance between two colors.

```javascript

const distanceBetweenTwoColors = (color1, color2) => {
        const [r1,g1,b1] = color1;
        const [r2,g2,b2] = color2;
        return (r1-r2) * (r1-r2) + (g1-g2) * (g1-g2) + (b1-b2) * (b1-b2);
    };

```

If you notice the function, we skip `Math.sqrt` because we are required to do comparison between values instead of absolute computation of a value.

Create a list of colors so that we can compare the distance between given color to our list.


```javascript

const colorList = {'black':[0,0,0], 'white':[255,255,255], 'red':[255,0,0], 'green': [0,255,0], 'blue':[0,0,255]};

```

Create a function which will loop through our colorlist and compare distance one by one with the given color and return to the closest one from the list.

```javascript

const getClosestRGBComponentFromColor = (givenColor) => {
    let closestDistance = null;
    let closestColor = [];

    for (let color in colorList) {
        const distance = distanceBetweenTwoColors(colorList[color], givenColor);
        if (closestDistance === null || distance < closestDistance) {
            closestDistance = distance;
            closestColor = [color];
        } else if (closestDistance === distance) {
            closestColor.push(color);
        }
    }
  
  return closestColor;
}


```


Now we can use it as shown below.
```javascript

const color = [0,155,0];

console.log(`Closest to the  color "${getClosestRGBComponentFromColor(color)}"`);

// output: Closest to the color "green"


```


Hope you find this article useful. Thank you for reading till the end.
Hello Dev
Tags: beginners, computerscience, gamedev, wordpress
Published: 2022-02-28 15:27:25

Wow, I feel immense pressure writing this first post. Not unlike the pressure I often when learning to code.

I'm 46. I haven't coded since my TRS-80 computer from RadioShack. Ok, who remembers RadioShack? But I've always had an interest.  

I wish that I had the tools and educational resources I do today back when I got my first real PC.  Back then however you had to hope someone had a bootleg of Visual Basic, even then you had no real way to learn it.  At least not the way you can learn today.

Back in 2020, I found Udemy.  At the time I needed to learn Adobe InDesign and Photoshop.  From there I found an Intro to Coding course.  I enjoyed it so I explored it more. I then took a course in web development and eventually I found myself venturing into the realm of game development.

Since I am a complete noob and I wasn't learning for a current or new job I spent the last year or so exploring different venues.  Today I am beginning to settle in.  My current areas of study are Python, C#, HTML, and CSS.  I'm using Visual Studio 2022 and the WordPress environment which is actually for my current job.

I blog about my journey to become an indie game developer on my website [D24 Indie Games](http://d24indiegames.com/journey/).  The blog has been an essential tool in helping me continue forward.

Happy to be here on DEV and looking forward to taking my coding journey to the next level.
Bash script to initialize an EKS cluster with common components eg autoscaler, container insights etc
Published: 2022-02-28 14:59:24

The script sets up the components below.

1. [VPC CNI prefix mode](https://aws.amazon.com/blogs/containers/amazon-vpc-cni-increases-pods-per-node-limits/)
2. Horizontal Pod Autoscaler
3. A LimitRange
4. Cluster Autoscaler
5. [Prometheus, Loki and Grafana](https://dev.to/leroykayanda/kubernetes-monitoring-using-grafana-3dhc)
6. [AWS Load Balancer controller](https://docs.aws.amazon.com/eks/latest/userguide/aws-load-balancer-controller.html)
7. EKS container insights
8. EFS CSI
9. Create cluster
10. Delete cluster
11. Istio

Github repo is [here](https://github.com/leroykayanda/k8s/tree/master/eks-init).

The following needs to be installed on the machine the script is run on:

1. [eksctl](https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html)
2. [helm v3](https://helm.sh/docs/intro/install/)
3. [kubectl](https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html)
4. aws cli

You select which components you wish to install by adding switches. The ones below are needed as parameters for various parts of the script.

`./eks-init.sh -cluster my_cluster_name -region us-east-1 -aws_account 123456789`

Other flags are as below:

```
-prefix_mode  : Set up VPC CNI prefix mode 
-hpa  : Set up Horizontal Pod Autoscaler
-limit_range : Set up a Limitrange 
-autoscaler  : Install cluster autoscaler 
-grafana  : Set up Grafana
-insights  : Set up EKS container insights
-create : Create a clsuter using eksctl
-nuke : <cluster_name> Delete cluster
-istio : Set up Istio
```

```
-lb_controller : Install the AWS Load Balancer Controller add-on
```
This has the dependencies below.


-iam_oidc : Create an IAM OIDC provider for your cluster 
-ecr_repo <Repo URI> : Amazon container image registry from [here](https://docs.aws.amazon.com/eks/latest/userguide/add-ons-images.html)

So the cmd would be:

`./eks-init.sh -cluster my_cluster_name -region us-east-1 -aws_account 123456789 -iam_oidc -ecr_repo 602401143452.dkr.ecr.us-east-1.amazonaws.com`

```
-efs : Set up EFS CSI for cluster storage
```
This has the dependencies below:

```
-az1_mp <AZ1 Subnet ID for EFS Mount Point> 
-az2_mp <AZ2 Subnet ID for EFS Mount Point>
```
`./eks-init.sh -cluster my_cluster_name -region us-east-1 -aws_account 123456789 -efs -az1_mp subnet-123 -az2_mp subnet-456`

You specify 2 subnets IDs in different AZs to be used for EFS mount points.

To install everything, you would use:

`./eks-init.sh -cluster my_cluster_name -region us-east-1 -aws_account 123456789 -prefix_mode -hpa -limit_range -autoscaler -grafana -insights -lb_controller -iam_oidc -ecr_repo 602401143452.dkr.ecr.us-east-1.amazonaws.com -efs -az1_mp subnet-123 -az2_mp subnet-456 -istio`

It may however be advisable to install one component at a time so that you can test to ensure everything is okay before installing the next component.
Database Driver Scout - Laravel 9
Tags: php, laravel, webdev, programming
Published: 2022-02-28 14:44:32

I heard a lot about Scout when Laravel version 9 was released and about the importance of using it in researching small and medium projects and decided to share it with you after getting this wonderful resource https://www.youtube.com/watch?v=7KbJIBM5VHg that talked about it and also don't forget to go to its docs https://laravel.com/docs/9.x/scout and its minister to go deeper

install Scout via the Composer package manager
```php
composer require laravel/scout
```
you should publish the Scout configuration file
```php
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

```
add the Laravel\Scout\Searchable trait to the model 
It will be searched by fields `` name `` and `` email ``
```php
<?php
 
namespace App\Models;
 
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
 
class User extends Model
{
    use Searchable;

    public function toSearchableArray()
    {
        // $array = $this->toArray(); 
        // return $array;
        return [
          'name' => $this->name,
          'email' => $this->email,
        ];
    }
}
```
`` The database engine currently supports MySQL and PostgreSQL ``
To use the database engine, you may simply set the value of the SCOUT_DRIVER environment variable to database, or specify the database driver directly in your application's scout configuration file
```php
SCOUT_DRIVER=database
```
use it
```php
User::search(request('search'))->paginate();
```
It should be banned that so far the feature does not work with relationships between tables.
I hope you enjoyed the code that it gives you information on your future projects.
Made a TikTakToe AI in Python
Published: 2022-02-28 14:38:26

So this is one of my first self-made projects, I made this AI in Python. It's not perfect but I haven't managed to beat it, if you can feel free to comment, maybe I can improve it.  
  
Works by:
1. Block wins by player if possible
2. Finish own win if possible
3. if middle available, mark it
4. else mark random empty spot

{% embed https://gist.github.com/GalaxyLinus/b5f8eef281fcc472197fc8133df1e082 %}
What is your favourite JavaScript Framework?
Tags: vue, angular, svelte, react
Published: 2022-02-28 14:38:02

### Popular JavaScript Frameworks/Library

## [React](https://reactjs.org)
A JavaScript library for building user interfaces.

## [Vue](https://vuejs.org)
An approachable, performant and versatile framework for building web user interfaces.

## [Angular](https://angular.io) 
A component-based framework for building scalable web applications.

## [Svelte](https://svelte.dev)
### A tool for building fast web applications.
How to easily know when we are at the last element inside a loop
Tags: python, shortpost
Published: 2022-02-28 14:30:30

An easy way to detect if we are at the last element of a python vector

First, we will create a function that will return a generator using the yield keyword.

```
from typing import Union, Set, List, Tuple, Any

Vectors = Union[Tuple, List, Set]

def lookthelast(items: Vectors) -> Tuple[Any, bool]:
    lenght_items = len(items)
    
    for index, value in enumerate(items):
        if index == (lenght_items - 1):
            yield value, True; break
            
        yield value, False
```

you can do this directly in your use case, but if we encapsulate this, we improve readability. it only imports the function and we avoid rewriting this code every loop.

An use case example:

```
numbers = ["one", "two", "three"]

for value, is_the_last in lookthelast(numbers):
    if is_the_last:
        print("this is the last element -> " + value)
        break
        
    print(value)
```

👉 execute this example [here](https://www.mycompiler.io/view/By8kIcoAX9R)