teleren/devto huggingface dataset:
Linux command: gzip
Tags: linux
Published: 2022-04-03 11:20:53

---
title: "Linux command: gzip"
published: true
description: "A tutorial on Linux gzip command"
tags: ["linux"]
canonical_url: https://ashutoshbw.github.io/blog/gzip/
---

`gzip` command is used to reduce the size of given files. This command is so common that you will most likely find it already installed on your Linux distro.


`gzip` only compresses regular files. Directories, symbolic links etc are not it's food. Files compressed with `gzip` are often called *gzipped* files.

`gzip` also comes with the `gunzip`, `zcat` and `zless` commands for uncompressing and viewing gzipped files.

Let's start gzipping!

## Compressing one or more files
To compress one or more files we can simply do like below:

```zsh
gzip file1 file2 file3
```

It will compress each file and replace them with compressed versions of them which have a `gz` suffix:
```
file1.gz file2.gz file3.gz
```

## Compressing standard input
`gzip` can also be used via standard input and output:
```zsh
ls -l /bin | gzip > foo.txt.gz
```

## Uncompressing gzipped files
With the command `gunzip` we can uncompress them like below:
```zsh
gunzip file1.gz file2.gz file3.gz
```

It will replace each compressed file with it's uncompressed version. So you will get the following files:
```
file1 file2 file3
```

## Compress/Uncompress files recursively in a directory
We can use the `-r` option to recursively compress each file in a directory:

```zsh
gzip -r someDir
```

For a directory containing any gzipped files, we can use `gunzip` with `-r` to uncompress all of them recursively with a single command:
```zsh
gunzip -r someDir
```

## Output to standard output
The `-c` option can be used by both `gzip` and `gunzip` to write output to standard output and keep the original files:
```zsh
gzip -c some-file > some-file.gz
gunzip -c some-file.gz > some-file-copy
```

## Viewing the gzipped files
When a text file is compressed, it's sometimes handy to view the text without uncompressing and writing it to disk. 

To view the contents of a compressed file, there are several ways.

We can simply use the `-c` option and pipe the output to `less` to view it:
```zsh
gunzip -c file1.gz | less
```

`zcat` can be used like `cat` on `gzip` compressed files. So we can be little more succinct:
```zsh
zcat file1.gz | less
```

The command `zless` allows us view gzipped files in the most clean way:
```zsh
zless file1.gz
```

That's for this article. Hope you have learned something useful. For digging deeper see the man page `man gzip`. Happy gzipping! 


---

If this article helped you, please buy me a coffee:
<a href="https://www.buymeacoffee.com/ashutoshbiswas" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Sample to connect Mic input stream directly to Deepgram .NET SDK
Tags: hackwithdg
Published: 2022-04-03 11:11:29



### Overview of My Submission
My submission for the category Wacky Wildcards is a console app for the Windows platform. This is an example how to use the newly introduced .NET SDK. 
Most applications that use speech, be it in a Command & Control speech application or a speech recognition app, must use the audio input directly with the smallest possible latency to make the interaction with the user smooth.
The latency of the service is sufficient for these scenarios if the input stream is send directly to the SKD and from there to the service. Saving the input in a file and process this file in the service would not work.


### Submission Category: Wacky Wildcards
I decided to publish this under Wacky Wildcards because it doesn't solve a problem or use case directly but helps to implement solutions that have to send the audio input directly to the DeepGram service. 
 
### Link to Code on GitHub
The code for this sample app is shared in this Git repository. Here you can also find more technical details.
{%embed https://github.com/FrankPohl/DeepGram.NETSample %}


###License
The code is licensed under the Apache-2 permissive license. Please find the [license file in the repository](https://github.com/FrankPohl/DeepGram.NETSample/blob/main/LICENSE).


### Additional Resources / Info
This sample targets the Windows platform but on Android or iOS you will have the same problems. 
The .NET SDK from DeepGram can be used in MAUI apps on this platform too.
Day 3
Tags: node, html, css, express
Published: 2022-04-03 11:08:29

---
title: Day 3
published: true
description: Starting Nodejs and express
tags: NodeJS, html, CSS, express
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2id2ackfdvgtnvgc1bmh.png
---

### Requirements
- NodeJS installed

## To do

Inside Workspace folder create folder day 3

`mkdir day3`

Enter day3 folder

`cd day3`

### Running Express

Run commands inside terminal to install express 

> 1. `npm init -y`

> 2. `npm i express`

> 3. `touch app.js`

> 4. copy and paste [Hello World Example](https://expressjs.com/en/starter/hello-world.html) 
inside app.js file
 ```
const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
```

Inside your terminal type

`node app.js`

In browser go localhost:3000

### Static Files e.g. html, CSS and JavaScript

Inside day3 folder - create new folder - public

`mkdir public`

Inside public paste project files from day 2.

Files 
> - index.html 
> - style.css 
> - script.js

Inside app.js remove

```
app.get('/', (req, res) => {
  res.send('Hello World!')
})
```

and add

```
const path = require('path')
app.use('/', express.static(path.join(__dirname, 'public')))

```

Learn more about [express.static](https://expressjs.com/en/starter/static-files.html)

The code should look more like this

 ```
const express = require('express')
const path = require('path')

const app = express()
const port = 3000

app.use('/', express.static(path.join(__dirname, 'public')))

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
```

Check again localhost:3000
Mantis React - Open-Source MUI Template
Tags: react, opensource, mui, webdev
Published: 2022-04-03 10:41:23

---
title: Mantis React - Open-Source MUI Template
published: true
description: Open-Source React Dashboard Template crafted on top of M-UI Library (sources available on Github)
tags: react, opensource, mui, webdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/789xvf2dee978d7r0t2x.jpg
canonical_url: https://www.admin-dashboards.com/mantis-react-open-source-mui-design/
---
Hello Coders!

This article presents an [Open-Source MUI Template](https://www.admin-dashboards.com/react-mui-template-open-source/) crafted and released for free by `CodedThemes`. **Mantis React** can be downloaded from Github (MIT License) and used for commercial products or eLearning activities. For newcomers, **React** is a leading JS library used to code interactive user interfaces actively supported and versioned by Facebook.

> Links:

- 👉 [React Mantis Dashboard](https://mantisdashboard.io/free/) - LIVE demo
- 👉 [React Mantis Dashboard](https://github.com/codedthemes/mantis-free-react-admin-template) - source code (MIT License) 

![Mantis React (Open-Source) - Charts Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/skukbpoiv4zct4tlia30.png)

---

Mantis is a free and open-source React Redux dashboard template made using the MUI React component library with aim of flexibility and better customizability.

Mantis Logo inspired from the Insect name -' Mantises' as They have Triangular heads with Flexible Necks. Also, the Name is derived from two popular UI frameworks, Material-UI and Ant Design (M-Ant-is).

---

## ✨ Product Features

- 👉 Professional User Interface.
- 👉 MUI (Material-UI) React components.
- 👉 Fully Responsive, all modern browsers support.
- 👉 Easy to use code structure
- 👉 Flexible & High-Performance code
- 👉 Easy Documentation Guide

---

**Sample Pages** - If you want to get inspiration or just show something directly to your clients, you can jump-start your development with our pre-built example pages.

![Mantis React (Open-Source) - Icons page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/olnpavkty88tkk2gg1tj.png)

---

![Mantis React (Open-Source) - Widgets Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oi2zi7oyce26c2457cs1.png)

---

![Mantis React (Open-Source) - UI Colors Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmtpa812sh0qynkq0erj.png)

---

> `Thanks for reading!` For more resources, feel free to access:

- ✨ More [Free Dashboards](https://appseed.us/admin-dashboards/open-source) crafted in Django, Flask, and [React](https://appseed.us/apps/react)
- ✨ More [Admin Dashboards](https://www.admin-dashboards.com/) - a huge index with products
A monad is a thing you put things in so you can do things with them.
Tags: programming, types, simpleexplainations, functional
Published: 2022-04-03 10:15:08

You can skip reading this post now, if you like - it's all there in the title. But if you want to hear a little more, okay, I won't deprive you. 

Think of a time when you've needed to process some inconsistent data. You won't have to think very far before you realise that you've had to do this any time you've had an optional/nullable value somewhere - something in JS that may or may not be `truthy`, something in Java that may or may not be `null`, something in Haskell that is a `Maybe something`.

Let's say in JavaScript, I have an array of values (*things*) which I know may include `undefined` values. 

```
const myJsArray = 
  [value1, value2, value3]

```

Now I want iterate over (*do something with*) this array. 

```
const double = x => x * 2

const myNewArray = myJsArray.map(double)
```

You probably don't want to end up with an array that contains a series of `NaN` values; you already know that that's the first step on many paths that can lead to confusion for your users. 

## You've got your *things*, and you want to *do something with* those *things* 

So what do you need? A *thing you put those things in, so you can do something with them*. You need a monad!

Earlier I mentioned Haskell's [Maybe](https://hackage.haskell.org/package/base-4.16.1.0/docs/Data-Maybe.html) type. This type can store one of two variants: `Just something`, or `Nothing`. This means that even if you can't be sure whether something contains a value or not, you can still perform consistent operations anyway - the operation that you're trying to perform is required to handle what to do in either scenario, and then you can't end up with unexpected junk data somewhere else in your application. Or to put it another way - you know you can _do the thing_ you wanted to on your _thing_ because it was _in a thing_!

## Why did I write this?

I've heard lots of different explanations of monads over the years. People tend to like using fancy words in their explanations, and I've seen lots of people shy away from Functional Programming altogether as soon as someone has mentioned monads to them. In fact, the Elm community _doesn't even like to say the word monad_ (opting for `Custom Types` instead, which I agree is a simpler term), because it is so commonly linked with unnecessary confusion. 

Google ["What is a monad?"](https://www.google.com/search?q=what+is+a+monad&rlz=1C5CHFA_enGB998GB998&oq=what+is+a+monad) and you'll probably see the same thing explained in lots of ways, but I bet none are quite as simple as the explanation you read before even reading this post. Although if you happen to get this post in your results...you're now also one step away from understanding [recursion](https://www.google.com/search?q=recursion).
Automatically update your GitHub profile with your latest dev.to post
Tags: javascript, github, automation, node
Published: 2022-04-03 09:51:47

# Introduction

Your GitHub profile page is the face of your GitHub presence and recently there have been a lot of interesting ways to make your profile stand out.

One way you can make your GitHub profile unique is by automatically updating it with a summary of your most recent DEV.to blog post, and that's what I'll be showing you how to do in this post using [blog-box](https://github.com/Aveek-Saha/blog-box).

The whole process requires no code, and minimal setup so you should have it up and running in no time!

{% github Aveek-Saha/blog-box %}

# Prep work
1. Create a new public GitHub Gist (https://gist.github.com/)
1. Create a personal access token with the gist scope and copy it. (https://github.com/settings/tokens/new)
1. Get your Dev.to user name (https://dev.to/settings)

# Repo setup
1. Fork the `blog-box` repo (https://github.com/Aveek-Saha/blog-box)
1. Go to the repo **Settings > Secrets**
1. Add the three following environment variables:
  - **GH_TOKEN:** The GitHub access token generated from the previous section.
  - **GIST_ID:** The ID portion from your gist url, eg: https://gist.github.com/Aveek-Saha/ **8335e85451541072dd25fda601129f7d**.
  - **DEV_USERNAME:** Your Dev.to account username.


# Show off your blog posts

Once you've finished with these steps, you can go to `Actions > Update gist with latest post` and manually trigger the workflow to update the gist with your latest DEV blog post.

Once the gist is updated you can pin it to your GitHub profile, so that it looks something like this:

![blog-box-screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y1cfr38jm7r3x4cbvua.png)
 
When users click on this pinned gist, there will be a comment with the link to the post like this:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ormtic5d5bctrcaaa8f.png)
Zero configuration: what does it mean?
Tags: discuss, webdev
Published: 2022-04-03 09:48:05

---
title: Zero configuration: what does it mean?
published: true
description: 
tags: discuss, webdev
//cover_image: https://direct_url_to_image.jpg
---

There's a poll attached to this tweet:

{% embed https://twitter.com/mindplaydk/status/1510515106999898115 %}

Please vote or comment, and share for reach. Thanks! 🙂
Top Javascript Cheat sheet
Tags: javascript, webdev, beginners, tutorial
Published: 2022-04-03 09:47:15

1.String Methods
string.includes('subtring')
checks whether a substring exists inside of a string
[check the character case]

string.indexOf(searchValue)
returns the index of the first occurrence of the
specified value, starting the search at fromIndex.
Returns -1 if the value is not found.

string.lastIndexOf(searchValue)
returns the index of the last occurrence of the
specified value, searching backwards from
fromIndex. Returns -1 if the value is not found.

string.slice(beginIndex, endIndex)
extracts a section of a string and returns it as a new
string, without modifying the original string.

2. Array Methods

 array[index]
returns a certain value from an array

push(value)
adds the value to the end of the array

pop()
removes the value from the end of the array

shift()
removes the value from the start of the array

unshift(value)
adds the value to the start of the array

splice(fromIndex, no_of_elements)
removes the number_of_elements, starting from
fromIndex from the array

slice(fromIndex, toIndex)
copies a certain part of the array

concat()
Join several arrays into one

join('')
returns a string of array values

array.length
returns the number of elements in the array

reverse()
reverse the order of the elements in an array

toString()
returns a string representing the specified array
and its elements.

3.Date Objects
getUTCMinutes()
Same as getMinutes(), but returns the UTC minutes

getUTCSeconds()
Same as getSeconds(), but returns the UTC seconds

getUTCMilliseconds()
Same as getMilliseconds(), but returns the UTC
milliseconds

4. Window Object Properties
sessionStorage
Allows to save key/value pairs in a web browser.

Stores the data for one session
scrollX
An alias of pageXOffset

scrollY
An alias of pageYOffset

status
Sets or returns the text in the statusbar of a window

top
Returns the topmost browser window
JavaScript to Java Conversion Limitation in vRO
Tags: article, api, minipost, vro
Published: 2022-04-13 13:13:30

---
title: JavaScript to Java Conversion Limitation in vRO
published: true
date: 2022-04-03 09:15:42 UTC
tags: ARTICLE,API,minipost,vRO
canonical_url: https://cloudblogger.co.in/2022/04/03/javascript-to-java-conversion-limitation-in-vro/
---

When vRealize Orchestrator runs scripts, the vCenter Server plug-in converts **JavaScript arrays** to **Java arrays of a fixed size**. As a result, you cannot add new values to vCenter Server data objects that take arrays as property values. You can create an object that takes an array as a property if you instantiate that object by passing it a pre-filled array. However, after you instantiate the object, you cannot add values to the array.

For example, the following code does not work:

```
var spec = new VcVirtualMachineConfigSpec();
spec.deviceChange = [];
spec.deviceChange[0] = new VcVirtualDeviceConfigSpec();
System.log(spec.deviceChange[0]); //Output undefined
```

In the above code, vRealize Orchestrator converts the empty  **spec.deviceChange**  JavaScript array into the fixed-size Java array **VirtualDeviceConfigSpec[]** before it calls **setDeviceChange()**. When calling **spec.deviceChange[0] = new VcVirtualDeviceConfigSpec()**, vRealize Orchestrator calls **getDeviceChange()** and the array remains a fixed, empty Java array.

**Workaround** : Declare the array as a local variable:

```
var spec = new VcVirtualMachineConfigSpec();
var deviceSpec = [];
deviceSpec[0] = new VcVirtualDeviceConfigSpec();
spec.deviceChange = deviceSpec;
System.log(spec.deviceChange[0]);
/* Output
DynamicWrapper (Instance) : [VcVirtualDeviceConfigSpec]-[class com.vmware.o11n.plugin.vsphere_gen.VirtualDeviceSpec_Wrapper] -- VALUE : (vim.vm.device.VirtualDeviceSpec) {
   dynamicType = null,
   dynamicProperty = null,
   operation = null,
   fileOperation = null,
   device = null,
   profile = null,
   backing = null
}
*/
```

* * *
<amp-fit-text layout="fixed-height" min-font-size="6" max-font-size="72" height="80"><p><strong><mark style="background-color:rgba(0, 0, 0, 0);">Disclaimer</mark></strong> This article is drawn from Release Notes of vRealize Orchestrator 8.x and is added here just for educational purposes.</p></amp-fit-text>
* * *
🤹‍♀️ SELECT ORDER [SQL]
Tags: sql, mysql, database, beginners
Published: 2022-04-03 09:42:41

- Why can't use SUM() in WHERE?
- Why can't use AS in WHERE or GROUP BY?

😎 You will get the reason why it is like that

## 💎 Select order
When you see this SQL, what do you think about order?
```sql
SELECT * FROM clients 
WHERE    age >= 30
GROUP BY usa
HAVING   salary > 1000
ORDER BY id desc
LIMIT    100
```
Seems like sql executes from SELECT ?
actually it's not true

```sql
-- SQL executes in this order
FROM
|
WHERE
|
GROUP BY 
|
HAVING
|
SELECT
|
ORDER BY
|
LIMIT
```

## 💎 Question 1
### Why SUM() function can't use in WHERE?
```sql
FROM
|
WHERE 👈 👈
|
GROUP BY 👈 👈
|
HAVING
|
SELECT
|
ORDER BY
|
LIMIT
```

Before WHERE executes, GROUP BY has not executed yet, so we can't use COUNT() SUM() in WHERE.

In other word, it's possible to use these functions in HAVING.

## 💎 Question 2
### Why can't use AS in WHERE or GROUP BY? Even though in ORDER BY can use it, unfair!!
```sql
FROM
|
WHERE 👈 👈
|
GROUP BY 👈 👈
|
HAVING
|
SELECT 👈 👈
|
ORDER BY 👀 👀 
|
LIMIT
```
take it easy, man. Because ORDER BY executes after SELECT.
You can't read name which is created by "AS" before define it.

Thank you for reading 🤗
I did an inventory of .gitconfig
Tags: git
Published: 2022-04-03 09:19:31

## Introduction

I've been using _.gitconfig_ settings as they were given to me by a senior colleague, and I decided it was time to understand them, so I conducted an inventory.

## Result

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

## What's left

After the inventory the size of the config became very small and now I know what I set up 🙌✨

### user

It's mandatory.

### core
`quotepath  = false`

I am Japanese and this setting is to prevent garbled file names containing Japanese characters.

https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath

### fetch
`prune = true`

This is convenient to have.
When you `git fetch`, it will reflect a branch deleted in a remote repository in the local repository.

https://git-scm.com/docs/git-config#Documentation/git-config.txt-fetchprune

### pull
`ff = only`

This is the safest option.
Merge only if fast-forward, otherwise merge is not performed and an error occurs.

https://git-scm.com/docs/git-config#Documentation/git-config.txt-pullff

### push
`default = current`

For me, the remote branches always have the same name.
So this setting is handy that it push the current branch to the remote with the same name and even if upstream is not set, it will be pushed.

https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault

## What's removed

### alias

I had so many alias that I never used.
As I was deleting unnecessary aliases, I started thinking that I didn't need aliases in the first place and deleted them all. I guess I am a clean-freak.

### default settings

There were a few settings that were already defaulted by git, so I excluded those as well.
A short hack to deploy reveal.js presentation on Read the Docs
Tags: python, sphinx, readthedoc, revealjs
Published: 2022-04-03 09:11:51

This is an introduction to serve reveal.js slide to [Read the docs](https://readthedocs.org).

## Abstract

Edit your `conf.py` to override target builder.

```python
def override_builder(app, config):
    # Change for your RTD settings. Please set it in your RTD prject
    app.registry.builders["singlehtml"] = app.registry.builders["revealjs"]

def setup(app):
    app.connect("config-inited", override_builder)
```

You can see contents and sources.

- https://github.com/attakei-sandbox/sphinx-rtd-revealjs
- https://sphinx-rtd-revealjs.readthedocs.io/en/latest/

## Approaching

### Problems for regular usage to server sphinx-revealjs

**Read the docs** are documentation platform supporting Sphinx.
You can serve HTML files from Sphinx documentation as same as run `make html` on local.

**sphinx-revealjs** is Sphinx extension to provide builder that generate Reveal.js style HTML. (ex: call `make revealjs`)

RTD supports only `html`, `dirhtml` and `singlehtml` for HTML buildings.
So, it is difficult to server reveal.js presentation of sphinx-revealjs.

### Sphinx can override builder object

Sphinx provides Application API to inject procedures on some events.
`config-inited` event is called on after loading all configuration before creating target-builder object.

We can modify builder-class in the handler for this event, and can use any builder in RTD.
(please see abstract for example)

## Caution

### Cannot serve regular name builds

This hack switches the builder, and you cannot use regular builder.
You should be careful what builder you want to call.

### RTD widget is not working

RTD provides widget for versioning and i18n.
But reveal.js content does not render wighet.
You can serve single version presentation only!

### This hack is NOT clean

This is dirty hack.
RTD may not accept this hack in backend.