teleren/devto huggingface dataset:
Manage your aliases with z-alias
Tags: bash, alias, cli, node
Published: 2020-05-03 21:19:43

---
title: Manage your aliases with z-alias
published: true
description: Edit your bash aliases the funny way
tags: bash, alias, cli, nodejs
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/xtaaot5ihtv4tuvqs85w.png
---

*French version [HERE](https://benjamin.caradeuc.info/2020/05/03/g%C3%A9rez-vos-alias-avec-z-alias/)*

---

Haven't you ever wanted to use a your CLI like a pro, but never been able to remember that specific command you need ?

> That happens to me all the time.

Haven't you been bored of writing that very long command in your terminal when you could have made it only 1 character ?

> Everyday...

Don't you want to replace an existing command with one that makes the output finally readable ?

> Hell, yeah!

Aren't you tired of always forgetting how to create new aliases and make them permanent ?

> Guilty 😇️

---

## Here is your solution

{% github benavern/z-alias %}


(pronounced `ði ˈeɪliəs`, like "The alias")

It is a little CLI app that I made in 1 day. It helps me manage my aliases, edit them, delete them, and it also works with [Zsh](https://www.zsh.org/)!

---

## How to

### Install

First, install it globally

```bash
npm i -g z-alias
```

### Usage

Then you can use it. You can find some help by typing

```bash
z-alias -h
```

```
  Usage:
    $ z-alias [options] [arguments]

    Options:
    --list, -l    List all aliases
    --open, -o    Open aliases file in your favorite editor
    --search, -s  Search in aliases
    --add, -a     Add an alias
    --edit, -e    Edit an alias
    --remove, -r  Remove an alias

    --help, -h    Display help
    --version, -v Print z-alias version

  Examples:
    $ z-alias -l
    $ z-alias -o
    $ z-alias -s [<searchTerm> <searchTerm2> ...]
    $ z-alias -a [<aliasName> "<aliasCommand>"]
    $ z-alias -e [<aliasName> "<aliasCommand>"]
    $ z-alias -r [<aliasName> <aliasName2> ...]

  Configuration:  
    * To change the path of the aliases file, paste and adapt this line
      at the end of your .bashrc file.

      export Z_ALIAS_FILE=~/.bash_aliases
  
    * To make your aliases available in all new shells paste this line
      at the end of your .bashrc file (adapt if above line has been added).

      if [ -f ~/.bash_aliases ]; then source ~/.bash_aliases; fi
```

The `search` option can take more than one search term.

The `add`, `edit`, `remove` options take optional parameters, you will be able to change your mind once you've hit ENTER.

### Settings

You can change the path to the file where the aliases are stored by exporting a `Z_ALIAS_FILE` environment variable in your `.bashrc`.

You can make it work with Zsh and other alternative shells by adding these lines to the end of your `.zshrc` for example

```
if [ -f ~/.bash_aliases ]; then
    source ~/.bash_aliases
fi;
```

---

## Contribute

Feel free to contribute to the project. I'll be glad to read your issues and help, to review your merge-requests.

If you find that tool usefull, you can buy me a beer too [here](https://paypal.me/benjamincaradeuc)
What are Stateless Widgets?
Tags: flutter, statelesswidget, widgets, google
Published: 2020-05-03 21:14:36

Hey Guys! Welcome to the post. I am pretty Sure you have been jumping through many sites for the meaning of **Stateless Widgets**. So, Let me help you out with that.

According to me,"Stateless widgets can be said as the Layout Widgets".
In layman terms, they are non-interactive kind of widgets that do not show any actions when pressed on them or when we swipe them, etc.
They can be Best used for setting up a layout based application such as the most basic application in flutter i.e. "Visiting Card App".

The first time I was introduced to stateless and stateful widgets through a popular thesis while preparing for inter-college paper presentation on Flutter and trust me at that time I only knew that A framework called Flutter is into the market for cross platform App Development with 2 main division of widgets i.e. Stateless Widgets and Stateful Widgets.

My learning journey is going on and in between I do share such small topics on community so that it may help someone who gets confused on such topics like I used to get when I started.

Thank you :-)
Is the cloud too complex for developers?
Tags: cloud, programming
Published: 2020-05-03 20:43:44

---
title: Is the cloud too complex for developers?
published: true
description: A question to the community about cloud native development
tags: cloud, programming
---

Hey all

I hope you're all keeping safe through these difficult times.

I had a question for the community. I think of Dev as a place for the 80% of developers. The one's operating on a day to day basis looking to ship products, services, etc. I hope I'm right about that. 

My question. Is the Cloud too complex for developers?

I feel like in the past decade it's just gotten more and more difficult to ship software. It used to be that you could just write something, put it on a server and the hardest problem you had was SSL certs. Today it feels like just getting up and running has become a huge barrier entry. There's some sort of expectation that we have to use AWS, containers and kubernetes just to run the things we were building a decade ago!

What's your thoughts. Interested to hear more from you all.

Cheers
Asim
What are the use cases of using optional for loop statements?
Tags: codequality, codenewbie, computerscience
Published: 2020-05-03 20:33:01

I don't think any of them are good practice. In addition to that they make the code longer.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for

I fail to see the benefit of using optional statements in for-loops. But maybe I'm missing something? Could someone provide examples where the optional for-loop statement is superior to the standard for-loop?
Pixtools- A discord bot for managing Hypixel Queues with your friends!
Tags: mlhsummerleague
Published: 2020-05-03 20:29:01

---
title: Pixtools- A discord bot for managing Hypixel Queues with your friends!
published: true
description: HackAtHome was my first virtual hackathon, and it was a blast!
tags: MLHSummerLeague
cover: cover.png
---

[HackAtHome](https://organize.mlh.io/participants/events/3456-digital-hackathon) was my first virtual hackathon, and it was a blast! In 24 hours, my friends and I create Pixtools, a discord bot for managing 
Hypixel queues with your friends!

Devpost: https://jpk.codes/pixtools
Website: https://pixtools.p2phack.club

{% youtube KqGk8jYgcHM %}
{% github p2phackclub/pixtools %}
{% github p2phackclub/pixtoolswebsite %}
Introduction to Make
Tags: make, c, build, tool
Published: 2020-05-03 20:25:32

Make is a build automation tool which generates executable from source code. It is really powerful, and dramatically simplifies lives of developers who have to work with compiled languages. Make defines a language that describes relationships between source code, intermediate files, and generated executable. This rules are defined in a special file, called Makefile. Although Make can quickly get complicated, you don't need to know everything to use it in your projects! 

First thing you need to know, any Makefile is just a set of rules structured. Each rule consists of the target, its prerequisites, and command to perform. It is structured the following way:

```makefile
target: prereq 1 prereq 2 ... prereq n
        commands
```

Of course, any Makefile can contain more rules than one. The first rule is called a default rule, and it is conventionally the most general one, also known as final build target. Each rules can be invoked separately, by calling `make target`. If a rule is a prerequisite for another rule, it will be build implicitly by invoking the target that depends on it.

Now, let's look at real world example! I have C program that looks the following way:

#### main.c

```c
#include "print.h"

int main() {
  printInt(42);
}
```

#### print.h

```c
void printInt(int x);
```

#### print.c

```c
#include<stdio.h>

void printInt(int x) {
  printf("%d\n", x);
}
```

Of course, we can just run `gcc *.c`, and get done with it! For the purpose of learning Make, let's build it in a way that you would want to build a bigger project, with more dependencies. First let's compile each of the source files into an object files. For the target `print.o`, prerequisites are `print.h` and `print.c`, and command is `gcc -c print.c` The rule would look like so:

```makefile
print.o: print.c print.h 
         gcc -c print.c  
```

Same can be done for the target `main.o`. Our default rule, I will call it `app`, is going to generate `a.out` binary from compiled object files, which are the prerequisites. Command for the linker is `gcc main.o print.o -o a.out`. This is the rule:

```makefile
app: main.o print.o 
     gcc main.o print.o -o a.out 
```

Make language also allows to use variables. A variable can be defined using assignment sign, and later used by wrapping its name in `$()`. One common case is to define compiler as a variable. Another important note, when you build your project, Make only rebuilds targets, if any of the prerequisites has been updated. It saves some time working with bigger projects.  It is useful to have rules for some other build related tasks, such as "cleaning", or testing your project. 

Finally, the complete Makefile for this tutorial:

```makefile
CC = gcc

app: main.o print.o
     $(CC) main.o print.o -o a.out

main.o: main.c
        $(CC) -c main.c

print.o: print.c print.h
         $(CC) -c print.c

clean:
      rm -f a.out *.o
```
One on Cloud
Tags: 100daysofcode, 100daysofcloud, gads, cloud
Published: 2020-05-03 20:19:58

2,1.

I learnt how to create virtual machines (VMs) instances in two different zones and connected to them using ping, ssh, and HTTPI. 

I performed the following tasks today:

Created a Compute Engine virtual machine using the Google Cloud Platform (GCP) Console.

Created a Compute Engine virtual machine using the gcloud command-line interface.

Connected between the two instances.
CVE-2020-10187
Tags: security, ruby
Published: 2020-05-03 20:03:34

About two months ago, I found a CVE in [a Ruby gem called Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper), and today the details were finally made public.

I found a couple of companies that were vulnerable in the wild, so it took some time to contact them and wait for them to patch their websites before the vulnerability was made public. I also worked with the gem maintainer to release a patch.

It's my first ever CVE, so I'm pretty proud of it.

Links:
- https://github.com/doorkeeper-gem/doorkeeper/security/advisories/GHSA-j7vx-8mqj-cqp9
- https://about.gitlab.com/releases/2020/04/30/security-release-12-10-2-released/
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10187
Cypress Test Logging in 20 minutes
Tags: cypress
Published: 2020-05-03 19:50:37

**First Things First**

- If you want to view test run results, you must use the right Cypress command. 

```typescript
// this method doesn't write output to the files
npx cypress open

// this method does write output
npx cypress run
```
- The results are only written when the test fails.

**Mochawesome Test Result**

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

This format is acceptable, let's see how we integrated Mocha Awesome into our Cypress Tests.

- npm install mochawesome --save-dev
- Change cypress.json in root directory
```typescript
{
    // the approot cypress.json file
    "baseUrl" :"https://localhost/home",
    "reporter": "mochawesome", 
    "reporterOptions": {
        "reportDir": "cypress/reports/mochawesome-report",
        "reportFilename": "sample",
        "overwrite": false,
        "html": true,
        "json": true  
     }
}
```
Add this into the Cypress/Support/index.js file.

```typescript
// The Cypress/Support/index.js file
import './commands'
import  'cypress-mochawesome-reporter/register'
```
- Start the test run
```typescript
npx cypress run
```
**Console Output**

As your tests run you will see output going to the console of your IDE terminal. But only failed tests write the reports, screenshots and mp4.

**Test Completion**

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

Total set up time: 20 minutes.

JWP2020
Passing props using the spread operator in React
Tags: javascript, react, tutorial, beginners
Published: 2020-05-03 19:39:19

In React, passing props from parent to children components and using them is pretty straight forward. Let's say we have a parent component called `App` which renders a child component called `ExampleComponentDate`. The child component will display a date we set in the parent component, so to be able to use it, it needs to get it from one level up (in this case) through props. You can see this happening in the example below:

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

But what if we want, for example, to render a second child component and apply certain CSS styles to it? Let's imagine our styles are stored inside multiple variables in the parent and we want to use them inside the second child. Let's call it `ExampleComponentName`. We pass our props like so:

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

And our child component will use them like in the code below. I am using destructuring to get the individual props so we can get rid of the `props.` notation:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2f744cw2muky5ay86w14.PNG)

We can easily see that the more props we want to pass, the messier the code becomes. The firs example that came into my head was the CSS styles example but our variables can virtually contain anything we want. What we could do instead is store all the styles in an object and pass it from parent to child using the `spread operator`. Like so:

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

And our child component will access the properties of that object like this:

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

I sometimes use this method for passing props but I'm not a big fan of it. It's not always obvious what the props we're passing have inside. This means we need to further inspect the code plus it can lead to unnecessary complexity when debugging. **It is, nevertheless, very useful when children components need lots of props but we do not want to pass them one by one.**

*Image source: Christina Morillo/@divinetechygirl on Pexels*
Git commands
Tags: git, beginners, github
Published: 2020-05-03 19:38:39

Here is a list of some useful git commands.


###**Initialize empty Git repository**
```
git init
```

###**Stage a file**
```
git add filepath
```

###**Stage all files**
```
git add .
```

###**Commit file changes**
```
git commit -m "commit message"
```

###**Check for staged and unstaged files**
```
git status
```

###**Push committed changes to master branch**
```
git push
```

###**Push committed changes to a particular branch**
```
git push origin branchname
```

###**Force push committed change**
```
git push -f
```

###**Create a new branch**
```
git checkout -b branchname
```

###**Switch to an existing branch**
```
git checkout branchname
```

###**Delete a branch locally**
(first ensure that you are not on the branch you intend to delete)

*to delete branch only if it has already been pushed and merged with the remote branch*
```
git branch -d localBranchName  
```
*delete the branch only if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet*
```
git branch -D localBranchName 
```


###**Delete a branch remotely**
(first ensure that you are not on the branch you intend to delete)
```
git push origin --delete remoteBranchName
```

###**Update current branch with changes from a remote repository**
```
git pull
```

###**Clone a repository**
```
git clone <url>
```

###**Manage connections to remote repositories**

*show URLs of remote repositories*
```
git remote -v
```
*create a new connection to a remote repository*
```
git remote add <shortname> <url>
```
*disconnect the remote from the local repository*
```
git remote remove <name>
```
*rename a remote connection*
```
git remote rename <old-name> <new-name>
```

###**Fix last commit message**
```
git commit --amend -m "correct commit message"
```
AI is a threat! Really?
Tags: artficialintelligence, machinelearning, python, javascript
Published: 2020-05-03 19:00:33


> The intelligence exhibited by anything other than Living beings which is equal to or more than the intelligence of the Living being.

1. Is AI a threat?
2. Is AI over-hyped?
3. Can AI be learned by all?
4. Does the industry have unrealistic expectations from it?

If you want a one line straight forward answer, then

> AI is not a threat at all, at least for another five decades or more.

And yeah, if you are here trying to use fiction movies to justify your answer then, please don’t.

Just to be on point, let us see the stuff that AI has achieved so far,

1. Due to the availability of good GPU’s, we are able to train the model with huge datasets and hence teach the model to detect suspicious activities. Whether that is in _video surveillance_, _credit card fraud detection_, _military_ and many others.

2. It is also being used to _auto verify the documents_ for bank account creation, loan approvals and others.

3. What about the _chat bots_ that you have come across?

4. _More accurate appropriation of company budgets_ : Whether a company is trying to draw up its marketing budget or understanding how much needs to be spent on customer-specific research, AI helps them get a more accurate estimate of their specific cost involvements and resource allocations. This is crucial to operational efficiency and profitability of fin tech players. Some tasks involve a lot of cognitive intelligence and brain work, which leads to certain customers facing processes like documentations and verification more time consuming and prone to errors. But AI automates this process by first learning from the previous data collected and produces unmatchable results.

5. _Movie scripting and Music generation_ : Yup you heard that right. Didn't expect that, did you? AI could be trained on scripts and stories and then used to generate stories for you. One such famous script is ‘Sun Spring’, check it out. And yeah it could be used to mimic the works of Beethoven too.

6. _Medicine and Bio-technology_ : Yes, AI models are used to simulate the effects due to the combination of various chemicals, which in-turn could be used to cure diseases. The feat which would take humans decades could be predicted within minutes with a trained model.

These are just an abstract of few stuff which AI could perform.

Read the Part 2 here:
{% link https://dev.to/tharunshiv/what-is-ai-upto-13m5 %}

Posted on [https://www.tharunshiv.com/ai-is-a-threat/](https://www.tharunshiv.com/ai-is-a-threat/)
I've started infosec blog
Tags: security, tutorial
Published: 2020-05-03 18:47:33

Hi, everyone. I have decided to start my own [blog](https://durov.cc/inwwwisible) on Telegram. It will higlight such topics as information security, various features and bugs of apps and whatnot.

Content will be available in both Russian and English, so everybody is welcome.

Besides it, I'm planning to collect useful scripts for newbie developers.

Subscribe to channel and wait for interesting content.
Referencing relative images in Vue
Tags: help, vue
Published: 2020-05-03 18:12:16

---
title: Referencing relative images in Vue
published: true
description: 
tags: help,vue
---

I'm building an app with Vue I have a number of images saved my assets folder which I want to reference in a json file and then filter through them however my images fail to load. 

Folder structure:
```
- src
  - assets containing my images
- components
  - mycomponent - 
- views
- coffees.js - an array of objects where I'm attempting to add images
```
I'm trying to add like this: 
```javascript
  {
    name: "black coffee",
    description: "coffee without milk",
    photo: "@/assets/coffee.png"
  }'
```
and then output that image as above in my component.

Should it be `../src/assets/coffee.png` although it didn't see to like that either. Am I just referencing them incorrectly?
Dynamically Importing Vuex Store Modules From Directory Structure
Tags: Vue, Vuex, javascript
Published: 2020-05-03 18:09:06

This is a continuation of my [previous post](https://dev.to/wonder95/dynamically-generating-vue-router-routes-from-directory-structure-1g8), where I went through the details of how to define Vue router route definitions in files throughout the app directory structure, and then import them into the main router `index.js` file. In this post, I'm going to be showing the same process for Vuex store modules. There are a couple small variations from the router import code, but nothing major.

First, here is the structure of a store module:
```
import * as types from '@/store/types';

const state = {
  events: [],
};

// getters
const getters = {
  getEvents: state => state.events,
};

// actions
const actions = {

};

// mutations
const mutations = {
  [types.SET_EVENTS](state, shifts) {
    state.events = shifts;
  }
};

export default {
  namespaced: true,
  name: 'event',
  state,
  getters,
  actions, 
  mutations
}
```
There is one small addition to this file for import purposes, and that is the `name` key in the exported object. This is because during the import process, since stores are separated by namespaces, a `name` property is needed. However, in looking through all of the available information returned from `require.context()`, I didn't see the value of the parent directory name, so I just added that value to the exported object.

With those defined, here is the store index.js file:
```
import Vue from 'vue';
import Vuex from 'vuex';
import Auth from '@/store/modules/auth'

Vue.use(Vuex);

const debug = process.env.NODE_ENV !== 'production';

Vue.config.devtools = true;

// Import all of the resource store files.
function loadStores() {
  const context = require.context('@/resources', true, /store.js$/i);
  return context.keys()
    .map(context)         // import module
    .map(m => m.default)  // get `default` export from each resolved module
}

const resourceModules = {};
loadStores().forEach((resource) => {
  resourceModules[resource.name] = resource;
});

resourceModules.auth = Auth;

export default new Vuex.Store({
  modules: resourceModules,
  strict: debug,
});
```
You can see where I use the exported name property in the call to `loadStores()`. Then, once all of the store modules under the `/resources` directory are adde to the `resourceModules` object, I manually add the store for the `Auth` module (since it's outside of the `/resources` directory), and then pass it all to the `modules` key in the `new Vuex.Store()` constructor. After verifying in the Vue Dev tools that the store exist, I'm off and running.
Creating an Interactive Cartoon using HTML/CSS/JS
Published: 2020-05-03 18:01:05

I've always been amazed by what few people can do with CSS. They are truly artists, and that's what inspired me to make this.

It's extremely simple, honestly noob-level, but I felt if anybody else wanted to get into the CSS artistry zone, this would be a great tutorial pen to see what makes everything work the way it should.

{% codepen https://codepen.io/AmruthPillai/pen/qBOVpqz %}

I had so much fun making this, and maybe I might make a few more. Any suggestions on libraries to use that might make my life easier? Any CSS tricks to drawing perfect detailed faces? I'd love to hear your inputs.