teleren/devto huggingface dataset:
GPG Card
Tags: gpgpgp
Published: 2023-01-06 01:20:05

---
title: GPG Card
published: true
date: 2020-06-05 21:39:51 UTC
tags: GPGPGP
canonical_url: https://brandonrozek.com/blog/gpgcard/
---

I have a Yubikey hardware token and one of my favorite use cases is the GPG support. This gives you the use cases of signing, encrypting, and authenticating all in one module. This post will describe quickly setting it up.

```
gpg --card--edit

```

To edit the keys we need to be in admin mode.

```
gpg/card> admin
Admin commands are allowed

```

First thing that’ll be good to configure is the name of the cardholder.

```
gpg/card> name
Cardholder's surname: Rozek
Cardholder's given name: Brandon

```

You can also set the language preferences.

```
gpg/card> lang
Language preferences: en

```

Now to configure the three different keys, we need to decide on an algorithm. There is a great [blog post by Cloudflare](https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/) describing RSA and ECC in detail. Including their pros and cons.

```
gpg/card> key-attr
Changing card key attribute for: Signature key
Please select what kind of key you want:
   (1) RSA
   (2) ECC
Your selection? 1
What keysize do you want? (2048) 4096
The card will now be re-configured to generate a key of 4096 bits
Changing card key attribute for: Encryption key
Please select what kind of key you want:
   (1) RSA
   (2) ECC
Your selection? 1
What keysize do you want? (2048) 4096
The card will now be re-configured to generate a key of 4096 bits
Changing card key attribute for: Authentication key
Please select what kind of key you want:
   (1) RSA
   (2) ECC
Your selection? 1
What keysize do you want? (2048) 4096
The card will now be re-configured to generate a key of 4096 bits

```

Once configured, we finally generate the keys. I usually recommend a shelf live of a year for keys. I think of security as a conscious effort, and this forces us to reconsider this again in the future.

```
gpg/card> generate
Make off-card backup of encryption key? (Y/n) n

Please specify how long the key should be valid.
         0 = key does not expire
      <n> = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 1y
Key expires at Fri 26 June 2021 11:20:37 PM EDT
Is this correct? (y/N) y

```

Finally, add some metadata about the key.

```
GnuPG needs to construct a user ID to identify your key.

Real name: Brandon Rozek
Email address: brandon@therozek.com
Comment: 
You selected this USER-ID:
    "Brandon Rozek <brandon@therozek.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

```

And we’re done! Now you have three keys on your smartcard for signing, encrypting, and authenticating.

```
gpg/card> quit

```
SMS/Call Bombing using TBomb for linux distribution and Termux
Tags: linux, ubuntu, python, github
Published: 2020-06-05 21:36:29

<h1>TBomb</h1>

This is a SMS Bomber for Debian Based Linux And Termux.

This Script is strictly only for Educational Purposes. Do not Use This To Harm anyone. I am nowhere responsible for the misuse of this Script.

This simple method can be implemented without sim balance.

The Script requires a working internet connection and termux. No sim card or internet Balance will be debited for using this approach inorder to send an SMS/make a call using python script.



<h2>Features :</h2>

<ul>
<li>Lots of integrated SMS/call APIs.</li>
<li>Unlimited (Limited against abusing) and super-fast bombing.</li>
<li>International bombing available.</li>
<li>Call bombing.</li>
<li>Frequent updates.</li>
<li>Automatic updating mechanism.</li>
<li>Easy to use and embed in code.</li>
</ul>

<h4>GITHUB Link - </h4> 
Clone with HTTPS 
Use Git or checkout with SVN using the web URL. : (https://github.com/TheSpeedX/TBomb.git)

<h2>Tbomb</h2>
<img src="https://hackerworld.site/wp-content/uploads/2020/04/image-59-1024x530.png" alt="by google">



More details about this : (https://abhiprayachavan.wixsite.com/tech-avit/post/sms-call-bombing-using-tbomb-for-linux-distribution-and-termux)
Free realtime crud in laravel & vue
Published: 2020-06-05 21:31:04

Everyone loves to do his app fast and also realtime
and we all face problems with costing when make our laravel app realtime/
So I use mix of some technologies to make realtime crud in laravel using vue
why vue?
vue produce a lost of features, actually i found that when use vue to make crud,it 's easy to do operations on your list 
So let's go and code our simple application

the code uploaded on github
[realtime-crud-laravel-vue repo](https://github.com/devhammam95/free-realtime-crud-laravel-vue)
You can check vedio demo 
[demo](https://www.youtube.com/watch?v=DFIDAAsVREM)
#Notes:
Make the configuration for laravel-echo and redis
change .env variable MAIL_TO_ADDRESS_ON_ADDED_PRODUCTS in .env.example to receive mails when adding new products
run cp .env.example .env
#commands should be run in terminal in every tab:
php artisan serve
npm install
npm run dev
laravel-echo-server start
php artisan queue:work
How to process heavy workloads AND animate at 60fps in Vanilla JS, any Framework or React Native:
Tags: javascript, webdev, react, reactnative
Published: 2020-06-05 21:26:11

TL;DR

* You can stop glitches in your animations when you are running Javascript code, without waiting for your animation to end
* I've written a library that lets you easily run processes in the spare time between _each frame_ of your animations
* It works on the Browser and now tested working in React Native
* You can stringify, parse, compress, sort, filter, reduce and transform to your hearts content and animations remain smooth
* You can use it with async functions or dive into using *generator functions* if you need to break up your own complex calculations
* It's available on MIT license from my [GitHub](https://github.com/miketalbot/js-coroutines) and as `npm -i js-coroutines`
* There's a detailed article on how it works internally available here {% link https://dev.to/miketalbot/60fps-javascript-while-stringfying-and-parsing-100mbs-of-json-84l %}

# How to use js-coroutines to keep your animations smooth:

If you are just sorting, compressing or using array operations you can get away with importing the xxxxAsync methods and using them inside a normal Javascript `async` function:

```js
import {sortAsync, parseAsync, filterAsync} from 'js-coroutines'

...

async doMyProcess(input) {
    const records = await parseAsync(input)
    const filtered = await filterAsync(records, r=>r.age < 30)
    return await sortAsync(filtered, item=>item.surname)
}

```

If you have your own complicated process you can use generator functions and `run`:

```js
import {run, parseAsync} from 'js-coroutines'


async doMyProcess(input) {
  const records = await parseAsync(input)
  return await run(function*() { return yield * myComplicatedProcess(records) })
  
  function * myComplicatedProcess(data) {
     let total = 0
     for(let i = 0; i < data.items.length - 1; i++) {
       if(i % 100 === 0) yield // Check how much time is available
       if(typeof data.items[i] === 'number') {
          total += (data.items[i+1] - data.items[i]) ** 2
       } else if (typeof data.items[i] === 'object') {
          total += Math.sqrt(yield * myComplicatedProcess(data.items[i]))
       }
     }
     return total
   }
}

```

## Demo

{% codesandbox etyft %}

## Animations Too!

js-coroutines also allows you to write imperative code for animations

{% codesandbox zeq33 %}

More on that here:

{% link https://dev.to/miketalbot/write-cool-stateful-animations-with-js-coroutines-2o0k %}
Get the closest point on a polygon
Tags: gamedev, math
Published: 2020-06-05 21:19:33

For the technical challenge of an interview, I had to write a function to get the closest point of a polygon from a given point.

I wrote this https://codesandbox.io/s/elated-liskov-3v65c

My solution will handle four cases:
 - Case I the target is inside the polygon ( the result is the point itself)
 - Case II the target is ON the polygon edge/vetext (the result is the point itself)
 - Case III - A the target is outside the polygon and faces an edge
 - Case III - B the target is outside the polygon and does not face an edge
 
Limitations:
 - Does not support hole or multi shapes
 - Return always one point (in case of equidistant points)

## Case I
Use the winding Number algorithm to determin if the point is inside
If so, return the given point.

## Case II
Check if the point P is on a edge AB of the polygon by comparing distances
`AP + PB === AB`

## Case III
The point is outside the polygon.
### A - The point projection is on a edge:
  1- For each segment I will check if the perpendicular projection of the point is on the segment. (by using a vector projection)
  2- I will take the segment which has the shortest projection distance.
The result will be the projection coordinates. (the resulting of the vector operation)
 
### B - The point projection is not on a edge:
I will select the vertex which has the shortest distance with the point. (by getting the euclidian distance)
How To Use CSS Modules With create-react-app
Tags: javascript, react, webdev, tutorial
Published: 2020-06-05 20:43:08

In order to use [CSS Modules](https://github.com/css-modules/css-modules) in your Javascript project you usually need to do some configuring. Luckily this is not the case when you are using [create-react-app](https://github.com/facebook/create-react-app). CSS Modules are supported with create-react-app out of the box. There is however a catch that you need to know in order to get your CSS Modules working in your create-react-app project.

_Read also [6 Things Every Beginner React Developer Should Know](https://codepulse.blog/6-things-every-beginner-react-developer-should-know/)_

{% youtube Udf951dyTdU %}

[Watch through tutorial on YouTube](https://www.youtube.com/watch?v=Udf951dyTdU).

If you want create-react-app to treat a CSS file as CSS Module file, you need to use a specific naming convention when naming your CSS file. You need to name your CSS files with `.module.css` extension. This way create-react-app knows that the file should be treated as CSS Module. After this you can import the CSS file normally and use the class names from it to style your components.

This post is a short one because I just wanted to write a quick post about this since I was fighting with this a while back. It took me way too long to find the solution for this and hopefully this post helped you to solve the problem with CSS Modules and CRA faster than it took me.

If you would like a more through explanation, I made a video about this to my [YouTube channel](https://www.youtube.com/channel/UC34UXFLKqdW3cpk5CBu2Siw), so be sure to check that out.

-----------
_Originally published at [codepulse.blog](https://codepulse.blog/how-to-use-css-modules-with-create-react-app/?utm_source=devto) on October 23, 2019._
#40daysofHybridCloud (Day-2)
Tags: aws, cloud, openstack, azure
Published: 2020-06-05 20:39:53

##*#Day2*

Previously we have learned about very basics of cloud computing , now going further i would like to discuss more about this ...

On Day 2nd ,I have gone through various ways to connect or communicate with the AWS some of them are :- 
- GUI (AWS Management Console)
- CLI (Command Line Interface)
- Programming Language (SDK)

As per now we will focus on two of them that are *GUI* and *CLI*.
we also know that GUI is manual and both CLI and Programming is Automation.

lets discuss the user part here as By-default AWS have Root user which have indefinite power over all , so in order to interact with AWS on regular basis we have to create one more user which have limited access and can perform useful operation which are needed .

*what is the use of another user account for AWS ?*
> As we all know that in today's world every thing is not done single handedly , therefore team are formed with various members , different person are performing different roles so if we share the root access with all of them then members can perform operation that can be done by Admin , in-order to avoid this situation we have user account.

*In AWS we called this service as IAM (Identity Access Management)
same kind of service in Open-stack is called Keystone* 

While in WEB UI in order to do LOGIN we need two things that are 
- username
- password 

Same in CLI mode in order to log in we need *Access key and Security key*

The user which is created is having all the power accept few like:-
- cannot create new user
- can not see billing info  
        
Now in order to login through CLI we need four things that are :- 
1. AWS access key : 
2. AWS secret Access key :
3. Default region name :
4. Default output type :

###Login to the CLI mode we can perform various commands of AWS 
like for creating the instance following data is required . 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kx6rzb5v1tg3o1l94x06.JPG)

###After you logged-in successfully the screen looks like : 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/do657o0il14kr5ppn10f.JPG)

###using command like:- *"aws ec2 help"* we can find various cmd's 
some of them are shown below :- 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3s3rngzupcww2lw4r62b.JPG)

###and at last the result will look like in our CLI is :- 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ekbluytw26x0b6kv0wds.JPG)

hope you all find it usefull ...

**Happy Learning :) **
SSH Connection Sharing
Tags: ssh
Published: 2023-01-06 01:20:21

---
title: SSH Connection Sharing
published: true
date: 2020-06-05 20:39:24 UTC
tags: SSH
canonical_url: https://brandonrozek.com/blog/sshconnectionsharing/
---

If you’re like me, you open a lot of different terminal sessions throughout your day. When it comes to SSH, I want these different sessions to share a connection rather than creating a new one each time.

To accomplish this, I have the following in my `~/.ssh/config` file.

```
ControlMaster auto
ControlPersist no
ControlPath ~/.ssh/sockets/socket-%r@%h:%p

```

| Option | Description |
| --- | --- |
| `ControlMaster` | Allows connection sharing |
| `ControlPersist` | `yes` to keep connection up even when no clients are connected.<!-- raw HTML omitted -->`2s` (or custom timeout) to keep the connection up for 2 seconds after no clients are connected.<!-- raw HTML omitted -->`no` to disconnect immediately |
| `ControlPath` | Where to store connection information. This should not be writable by other users. |

You’ll also need to create the `sockets` folder if you don’t have it already setup.

```
mkdir ~/.ssh/sockets
chmod go-w ~/.ssh/sockets

```
How debugging GitHub Actions with SSH?
Tags: githunt, github, ssh, debug
Published: 2020-06-05 20:29:56

---
title: How debugging GitHub Actions with SSH?
published: true
description: A simple way to interact with the host system on which the actual scripts (GitHub Actions) will run.
tags: githunt, github, ssh, debug
cover_image: https://cdn.dribbble.com/users/578335/screenshots/7111951/media/816867916ce3fe521925674bfb5ed8e9.png
---


---

**UPDATE: 27.10.2020**

Thanks [Luchi](https://dev.to/luchihoratiu), who create a GitHub Action [debug-via-ssh](https://github.com/marketplace/actions/debug-via-ssh) now it easier to connect into an instance.

---

Often the best way to troubleshoot problems is to SSH into a job and inspect things like log files, running processes, and directory paths.

I really like a CircleCi ability to [debugging with SSH](https://circleci.com/docs/2.0/ssh-access-jobs/), but seems Github Actions don't have this opportunity?

Actually no, let me show a workaround 🤪

---

## Setup

The first step you need to create an account on the  [ngrok.com](https://ngrok.com/) website

Then in the created `.yml` file will add a two steps:

```yml
# .github/workflows/my-build.yml
name: Debugging with SSH
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
     - uses: actions/checkout@v1

     - name: Try Build
       run: ./not-exist-file.sh it bloke build

     - name: Start SSH via Ngrok
       if: ${{ failure() }}
       run: curl -sL https://gist.githubusercontent.com/retyui/7115bb6acf151351a143ec8f96a7c561/raw/7099b9db76729dc5761da72aa8525f632d8875c9/debug-github-actions.sh | bash
       env:
        # After sign up on the https://ngrok.com/
        # You can find this token here: https://dashboard.ngrok.com/get-started/setup
        # NGROK_TOKEN: ${{ secrets.NGROK_TOKEN }}
        NGROK_TOKEN: 1cu2nQXxljrX4mNGxz4z9N1QSfm_3JDS7Ek4Rti6oTwov43Sx

        # This password you will use when authorizing via SSH 
        # USER_PASS: ${{ secrets.USER_PASS }}
        USER_PASS: murAmur

     - name: Don't kill instace
       if: ${{ failure() }}
       run: sleep 1h # Prevent to killing instance after failure
```

- The script that [start a ssh session](https://gist.github.com/retyui/7115bb6acf151351a143ec8f96a7c561)

> **NOTE:** Don't paste tokens directly to `.yml` file 
> **USE:** [Secrets variables](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)


---

## Result

So when the build failed will be runner SSH session and you will the next message in the console:

![login command](https://dev-to-uploads.s3.amazonaws.com/i/bpt9z4t8gnt0fiofmll7.png)


Let login using `USER_PASS: murAmur` :

![login via ssh](https://dev-to-uploads.s3.amazonaws.com/i/q124euuw86bkwy24kesq.png)
![lscpu result](https://dev-to-uploads.s3.amazonaws.com/i/imkf8ql87918n135julo.png)


---

if you have any question I am glad to discuss them in the comments!

(c) MurAmur
What language for a corporate transition? 
Tags: javascript, go, csharp, rust
Published: 2020-06-05 20:21:31

I join a new company, it has api in C# ASP.NET and hosts it on Windows server! 
He would like to switch to another cross platform solution and convert their monolithic api into a microservices api.
I am the only developer in the company (200/500 employees)

What technology do you recommend and why? (I've heard about asp.net core but I find it quite complex compared to AdonisJS, Laravel, Rails)
100 Days of SwiftUI — Day 15
Tags: 100daysofswiftui
Published: 2020-06-05 20:14:18

---
title: 100 Days of SwiftUI — Day 15
published: true
date: 2020-06-05 20:13:52 UTC
tags: 100daysofswiftui
canonical_url: https://zeitschlag.net/100-days-of-swiftui-day-15/
---

Ha! I was right yesterday: The review of closures was [part of the 15th day](https://www.hackingwithswift.com/100/swiftui/15)!

I liked on this day, that Paul went a bit more into the details of [access control](https://www.hackingwithswift.com/read/0/19/access-control) and [typecasting](https://www.hackingwithswift.com/read/0/20/polymorphism-and-typecasting).

Also, I changed some legacy code yesterday to use `Void` instead of `()` as return-type of a closure. I saw that in Paul's code and it reminded me, that at my job, we should follow a code styleguide. Those `()` always confused me, but it's nice to be aware of a better alternative.

Hopefully I will write some SwiftUI-code tomorrow. I'm getting exited! 🤓🤓🤓🤓

<!--kg-card-end: markdown-->
Accessing MongoDB Atlas From Netlify Functions
Tags: mongodb, netlify, serverless
Published: 2020-06-05 20:13:39

---
title: Accessing MongoDB Atlas From Netlify Functions
published: true
tags: mongodb, netlify, serverless
---

I recently tried to use a MongoDB Atlas instance with Netlify Functions and couldn't seem to connect to the database (I could locally). Here's why, and how I fixed it

## Cause of the problem

When setting up a MongoDB Atlas Cluster you must provide a list of allowed IPs - with a one-click button to enable your own machine. 

During local development everything will work file, but when you push your functions to Netlify the IP address will no longer match the one in the allowed list. 

Unfortunately, Netlify don't provide the IP range for the machines that run serverless functions (as is the very nature of serverless), so this led me down a rabbit hole.

## It is a single button

After spending a couple of hours to find the solution, I discovered it was just a single button click. In 'Network Access' in your cluster settings click 'Add IP Address'. 

Then click 'Allow Access From Anywhere' and confirm your changes. 

Hopefully this short post can save you debugging time.
What did you learn this week on Dev.to?
Tags: discuss, beginners, watercooler, learning
Published: 2020-06-05 20:02:51

---
title: What did you learn this week on Dev.to? 

published: true
description: Tell me one thing you learned this week! It could be advice, programming, or anything you’ve been proud of. 
tags: discuss, beginner, watercooler, learning
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/gxyqrcu69ylos82b6oiw.jpeg
---
Tell me one thing you learned this week! It could be advice, programming, or anything you’ve been proud of.
React MERN Stack - Building a CRUD App
Tags: react, node, mongodb, atlashackathon
Published: 2020-06-05 19:56:13

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/me3nxdmslvhtffb2nn4c.gif)

###REST API Technology 
JSON Based Web Services 
Express 
Mongoose 
 
###Front End Technology 
ReactJS 
     Fetch API 
     React router dom 
Bootstrap CSS 
HTML 
Nodejs 
 
###Database 
MongoDB Atlas 

Connection url: 
*mongodb+srv://root:bunny@cluster0alh36.gcp.mongodb.net/OnlineFashionStore?retryWrites=true&w=majority*

###Main Functionalities
1)The admin can logs into the online store system using the admin email and password.

*Admin email – admin@gmail.com*  
*Admin password – 123*  

2)The system checks whether the login credentials are valid✅ or not❎. If the login credentials are not valid, the system re-directs to the login page. Else if the login credentials are valid, the system enters the admin into the admin dashboard. 

3)In the admin page, the admin can insert new categories by entering category id and category name to the system database.🛍

4)Also, the admin can update or delete existing categories from the system database. These modifications will be updated and saved in the system database.

5)In addition to that, the admin is responsible for creating login for the store manager.👩🏻‍💼

6)Once the login is created for the store manager, the store manager will be notified via e-mail. System sends an e-mail to the store manager with the login details.📧

7)Also, the admin can update and delete existing store managers from the system database. These modifications will be updated and saved in the system database.

8)Only admin can view all the added Store Manager details. The store managers’ list is displayed in this following page.

9)User can view all the categories of the system that has been added by admin.

###Configuration

####step 1
Open terminal in VS Code in Backend Directory

####step 2
Run npm install

####step 3
Run node app to start backend server.

####step 4
Now open terminal in VS Code in Frontend Directory.

####step 5
Run npm install

####step 6
Run npm start to run the app in development mode.

####step 7
Open http://localhost:3000 to view it in the browser.

###GitHub Repo📌
{% github Sewvandiii/fashion-dujour %}