teleren/devto huggingface dataset:
How to see only the specified number of commands executed so far or the history of commands executed in the Linux terminal?
Tags: resource
Published: 2021-08-10 00:00:00

---
  title: How to see only the specified number of commands executed so far or the history of commands executed in the Linux terminal?
  published: true
  tags: Resource
  date: Tue Aug 10 2021 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/see-only-specified-number-commands-executed-or-history-linux-terminal
  cover_image: https://melvingeorge.me/_next/static/images/main-c1a7e2c0f98657a6893c4336f5e65d94.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/see-only-specified-number-commands-executed-or-history-linux-terminal)
  
To see only the specified number of commands instead of seeing all the commands executed you can use the `history` command followed by the `number` of commands you want to see that were executed in the Linux terminal.

### TL;DR

```bash
# See only the specified count of recent commands
history <COUNT_OF_LAST_COMMANDS_TO_SEE>
```

For example, let's say we want to see only the recent 5 commands executed in the Linux terminal, we can use the history command like this,

```bash
# See the last or recent 5 commands
# executed in the Linux terminal
history 5
```

See the execution of the above command live in [repl.it](https://replit.com/@melvin2016/see-only-the-specified-number-of-commands-executed-in-linux#main.sh)

**NOTE: In some Linux distributions I have found that running the `history` command followed by the number shows all the commands from history. If it's not working try adding a `-` (minus) sign before the number like this,**

```bash
# See the recent 5 commands executed
# for some Linux distributions
history -5
```

That's all 😃!

### Feel free to share if you found this useful 😃.

---
Wide section for Notion
Tags: notion, tesseract, template, dark
Published: 2021-08-09 23:50:52

> 💾 **TL;DR**
> [Duplicate the template **here**](https://grupotesseract.notion.site/Wide-Section-Template-0ce5703481b7465089ee8da0724a5fbc) 

---

Hi, guys. How are you? A long time since my [**last post**][dark-theme]. I hope everyone is well and healthy.

Last Saturday, I had an idea for my company's Notion. This idea made it easier to separate the categories into a larger section. And on top of that, I wanted to come up with a result that was responsive and that worked on both themes. The only downside is that each title and paragraph on the left side is made with images. 🥲

I would like to share some screenshots I took. I hope you all like it 🥰 (click image to enlarge and open in another window).

<a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvibdijapt8ibeub63d2.png">
  <figure>
    <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvibdijapt8ibeub63d2.png" alt="Notion of Tesseract company in dark mode and wide sections" />
    <figcaption>Dark theme on 1920px wide monitor</figcaption>
  </figure>
</a>

<a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67mxb3on48j6rrzm0h45.png">
  <figure>
    <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67mxb3on48j6rrzm0h45.png" alt="Notion of Tesseract company in light mode and wide sections" />
    <figcaption>Light theme on 1920px wide monitor</figcaption>
  </figure>
</a>

<hr/>

<a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dk8dpfxccjvxxgy58rx.png">
  <figure>
    <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dk8dpfxccjvxxgy58rx.png" alt="Notion of Tesseract company in dark mode and laptop wide sections" />
    <figcaption>Dark theme on 1366px laptop monitor</figcaption>
  </figure>
</a>
 
<a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vepipm556tyxqne8xc3.png">
  <figure>
    <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vepipm556tyxqne8xc3.png" alt="Notion of Tesseract company in light mode and laptop wide sections" />
    <figcaption>Light theme on 1366px laptop monitor</figcaption>
  </figure>
</a>

<hr/>

<a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yusy1jjbhmvgn7cn7gxz.png">
  <figure>
    <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yusy1jjbhmvgn7cn7gxz.png" alt="Notion of Tesseract company in dark mode on mobile" />
    <figcaption>Dark theme on mobile screen</figcaption>
  </figure>
</a>

<a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80x5foon7sw5zlbg0hb5.png">
  <figure>
    <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80x5foon7sw5zlbg0hb5.png" alt="Notion of Tesseract company in light mode on mobile" />
    <figcaption>Light theme on mobile screen</figcaption>
  </figure>
</a>

[dark-theme]: https://dev.to/thiagobraga/dark-theme-for-almost-everything-1ace
Loop a minimum number of times
Tags: javascript, vue
Published: 2021-08-09 23:46:44

## Background

In vue, we use the `v-for` directive to loop through an array and display the items in the browser.

Here is an example. We loop through the `items` array and display the item name in a list.

```js
<ul>
  <li v-for="item in items" :key="item.name">
    {{ item.name }}
  </li>
</ul>
```
## In Practice

In practice, the `items` array could come from the api (our backend). It could contain any number of items that we eventually display in the browser. It could contain 10, 5 or zero items in which case we display nothing.

However, what if we want to display a minimum number of items regardless of how many items are in the array.

In our UI, we want to avoid situations when nothing is rendered or too few items are rendered.

## Placeholders

In these situations, we can use placeholders. They could be dummy items or empty `div`s. They might be used to fill the empty space or if the design requires there to be a minimum number of items displayed. They could also indicate to users that there could be more items or they (users) can add more.

If the items array is empty, then we display five placeholders, and if it contains three items, we display two placeholders and so on.

## How the code looks like

Now, let's see how we can go about implementing it in the frontend.

First, I will have the same loop in the top to loop through the items. Then I will have a separate loop to display placeholders if needed.

As for the placeholders, I will use empty `li`s with some styling.

```js
<ul>
  <li v-for="item in items" :key="item.name">
    {{ item.name }}
  </li>
</ul>
<ul v-if="placeholder">
  <li v-for="(n, i) in placeholder" :key="i" class="block">
  </li>
</ul>
```

Here are the styles for block

```css
.block {
  background: grey;
  height: 15px;
  width: 50px;
}
```

`placeholder` would be a computed property. Whereas, `items` could either be a local data or coming form store if using a global state like Vuex.

```js
 placeholder() {
   // a max of 5 slots when no items at all!
   if (this.items && this.items.length < 5) {
     return 5 - this.items.length;
   } else {
    return 0;
   }
 },
```
`this.items` refers to the items array.

Now, placeholders will show if we have five items or less.


_Thanks for reading_
Unforgettable! My First Challenge
Tags: challenge, build4sdg, inventors, firstproject
Published: 2021-08-09 23:23:46

Hi everyone 👋
I got something I could not take my mind off, so I decided to share with you guys.
April this year, I participated in the first ever Build For SDG (#Inventorsbuild4SDG) organized by Inventors, a tech club within Olusegun Agagu University of Science and Technology OAUSTECH.
That was the first time I participated in an hackathon/challenge, doubled to give my first GitHub repo and first official project *(of course I have been working on petty projects)*. So I thought that I'll share my (very little) experience and some tips with you today!

**Making my team**
Getting my team was a hell of work to do, which was very important as some friends turned down the offer with excuses, delaying the project a bit.
My team was composed of 5 members (including myself) and It was really cool to discover developers and designers with different habits of coding! Still not forgetting the fact that some team members might be nonchallant 😴. #MakingATeam

**Learning new things**
I led a team of 5, fast track my path to competence, I discovered a better ways of achieving the same result, standard practices and a lot of new habits of code! I became familiar with the use of GitHub for project management and collaboration. For example, at the time of the challenge I was only good at PHP together with the usual javascript html and css which we used for the project, we all learn a little bit on this new way for us to deal with things, one my team members introduced me to react, using API and more...
We also share a lot of tips and answer each other with the bit of knowledge we had in programming, it was really team play at his best !

**The deal day**
The challenge was for a period of 4 weeks. We were to present what we'd done, due to network issues I couldn't present the project due to network issues as it was a virtual presentation and no team member could bridge the gap🙍‍♂️.
After assessing our code and the live performance, we ended *third place* in the challenge.
We got an overview of all the projects that were submitted and some ideas were really crazy, and made by a diversity of awesome great developers !
I was been really impressed by some of the projects and it gave me a lot of inspiration and motivation for future personal projects.
I'm currently learning new technologies ⚡.
Do check out our project (a confidential reporting platform): 
[Live Demo](https://speakup-app.herokuapp.com)
[GitHub repository](https://github.com/InventorsDev/sdg-004)

**Don't participate to win**
I've seen a lot of people participating for the cash prize and I totally get why people get excited about, but in my opinion, it's really not a reason of why you should participate!
Participate in challenges to fast track your path to competence, market-readiness & technical leadership.
Staying late night, expenses on data subscription, still yet you're happy to spend time with your mates.
I tell you, we really tried and we are happy 😊 for the result, though the project still needs more improvement.

See you for future challenges.
Cheers 🥂
Why are images not opened in a lightbox or modal?
Tags: meta
Published: 2021-08-09 22:30:12

I am sure this probably has been asked before but I could not find anything on this. I was not even able to search for posts by the #meta tag.

Why images linked in Dev.to posts don't open up in a lightbox or modal when clicked? I find it inconvenient that it doesn't do this.

You can click this image to see what I mean.

![](https://www.cropimg.com/fountain.jpg)
25 Youtube Channels That Every Developer Should Follow!
Tags: 100daysofcode, beginners, codenewbie, webdev
Published: 2021-08-09 22:24:26

Hi, I'm [Aya Bouchiha](developer.aya.b@gmail.com), on this amazing day, I decided to share with you these 25 helpful youtube channels.


### Youtube Channel Every Developer should follow

+ [FreeCodeCamp](https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ)
+ [Traversy Media](https://www.youtube.com/user/TechGuyWeb)
+ [Tech With Tim](https://www.youtube.com/channel/UC4JX40jDee_tINbkjycV4Sg)
+ [Dennis Ivy](https://www.youtube.com/channel/UCTZRcDjjkVajGL6wd76UnGg)
+ [Kevin Powell](https://www.youtube.com/channel/UCJZv4d5rbIKd4QHMPkcABCw)
+ [Coding Nepal](https://www.youtube.com/channel/UCk7xIEmd3MeyhIu2StLX5yA)
+ [Web Dev Simplified](https://www.youtube.com/channel/UCFbNIlppjAuEX4znoulh0Cw)
+ [Dev Ed](https://www.youtube.com/channel/UClb90NQQcskPUGDIXsQEz5Q)
+ [CodingEntrepreneurs ](https://www.youtube.com/user/CodingEntrepreneurs)
+ [Coding Addict](https://www.youtube.com/channel/UCMZFwxv5l-XtKi693qMJptA)
+ [The Net Ninja](https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg)
+ [Cs Dojo](https://www.youtube.com/channel/UCxX9wt5FWQUAAz4UrysqK9A)
+ [Clever Programmer](https://www.youtube.com/channel/UCqrILQNl5Ed9Dz6CGMyvMTQ)
+ [Code evolution](https://www.youtube.com/channel/UC80PWRj_ZU8Zu0HSMNVwKWw)
+ [Jenny's lectures CS/IT NET&JRF](https://www.youtube.com/channel/UCM-yUTYGmrNvKOCcAl21g3w)
+ [Coding Tech ](https://www.youtube.com/c/CodingTech/videos)
+ [Programming Hero ](https://www.youtube.com/channel/UCStj-ORBZ7TGK1FwtGAUgbQ)
+ [CodeWithHarry](https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww)
+ [edureka](https://www.youtube.com/user/edurekaIN)
+ [programmingWithMosh](https://www.youtube.com/user/programmingwithmosh)
+ [Online Tutorials](https://www.youtube.com/channel/UCbwXnUipZsLfUckBPsC7Jog)
+ [Coder Coder](https://www.youtube.com/thecodercoder)
+ [Bro Code](https://www.youtube.com/channel/UC4SVo0Ue36XCfOyb5Lh1viQ)
+ [Adrian Twarog](https://www.youtube.com/channel/UCvM5YYWwfLwpcQgbRr68JLQ)
+ [Dipesh Malvia](https://www.youtube.com/channel/UChPxqdfDbulLE9PyUqhijWw)

## Suggested Posts

+ [Youtube Courses, Projects To Master Javascript](https://dev.to/ayabouchiha/youtube-courses-projects-to-master-javascript-3lhc)
+ [Free resources to master algorithms & data structure](https://dev.to/ayabouchiha/free-resources-to-master-algorithms-data-structure-2nfj)
+ [Resources to master 5 popular react libraries](https://dev.to/ayabouchiha/resources-to-master-5-popular-react-libraries-2n81)

To Contact Me:

email: developer.aya.b@gmail.com

telegram: [Aya Bouchiha](https://t.me/AyaBouchiha)

I hope this post helped you :)
Destructuring using 'this' keyword at Typescript
Published: 2021-08-09 22:23:15

---
title: Destructuring using 'this' keyword at Typescript
published: true
description: Destructuring multiple variables and assign them to variables of class using this in one line. 
tags: 
cover_image: https://miro.medium.com/max/960/1*yQ96vfpxdq3d7d1Qye6BHg.png
---

## Object Destructuring

Object Destructuring introduced at ES6 and it's useful for object assignment value-by-value.

## Example
```typescript
const {a1: string, a2: string} = {greeting: 'Hello!', who: 'dev.to Community'};
// a1: 'Hello1',
// a2: 'Dev To Community',
```

## The Problem

```typescript
class DevToClass {
  a1: string;
  a2: string;
  a3: string;

setVal(): void {
  // error: 'this' is not recognized inside the scope. 
  const {this.a1, this.a2, this.a3} = {a1: 'Hello!', a2: 'dev.to', a3: 'community'};
}
}
```

## The Case

Imagine the scenario we have a class, and we want to assign some object's values, that can also be *undefined* to a class's variables.
Typescript will complain that **this** is not recognized. So we have to assign those variables to some constants and then assign them to class's variables.

```typescript
class DevToClass {
  a1: string;
  a2: string;
  a3: string;

setVal(): void {
  const {a1, a2, a3} = {a1: 'Hello!', a2: 'dev.to', a3: 'community'};
  this.a1 = a1;
  this.a2 = a2;
  this.a3 = a3; 
}
}
```

You can see it, right? What if we have more than three variables to assign?

**Aliases** to the rescue!

A *destructured variable* can have a *different* name than the *property value*. If that variable name does not exist, it will automatically be constructed and assigned with the value. If it exists, then JS will just *assign* the *destructured value* to the *existed variable*. In that way *this* can be used referring to any class's variable, like a normal variable.

```typescript
class DevToClass {
  a1: string;
  a2: string;
  a3: string;

setVal(): void {
  ({a1: this.a1, a2: this.a2, a3: this.a3} = {a1: 'Hello!', a2: 'dev.to', a3: 'community'});
// this.a1: 'Hello!', this.a2: 'dev.to', this.a3: 'community'
}
}
```

The redundant code for assignments is gone! Now all assignments will take place in one line.

I hope you found this article useful! 


Check & Contact me on:
* [LinkedIn](https://www.linkedin.com/in/loukaskotas/)
* [Github](https://github.com/loukas-kotas)
* [Loukas Kotas](https://loukaskotas.com)
Dev log for Wonder Wanderer 2: Day 9 #LOWREZJAM 😁
Tags: gamedev, challenge, javascript, devjournal
Published: 2021-08-09 22:06:57

### What did I do today? ###
Unless I come up with new ideas, this game is ready to start. Just polished stuff and controls are improved. Now I will make levels, polish the art and hope to make a alpha version of the game tomorrow.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xn2bknt9fpbe3vpqwpdv.gif)
<figcaption> The progress of today. </figcaption>
Day 426 : Back At It
Tags: hiphop, code, coding, lifelongdev
Published: 2021-08-09 21:58:16

_liner notes_:
- Saturday : Spent pretty much the day preparing for the radio show and the show on Sunday. I even got some work done on a new side project. Had a good time doing the radio show. The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episode image of a photo of my new setup with my laptop on my new stand and the other equipment used to produce the show with the words Aug 7th 2021 Egads](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfzuddnf5srspnzgz18v.jpg)

- Sunday : Had a really good time doing https://untilit.works. I wanted to start putting together the inside of my van, but got caught up trying to figure out how to get some video streaming worked out for my next project. All the code I've written for the site is working great. Now I'm going to start working on another project idea I've had. You can check out all the videos at https://untilit.works/videos

- Professional : Today was a good start to the week. Worked with a member from the engineering team to help work out an issue I was having. I helped out with a community question. Started working on updating some Web Components I made so that they are easier to style.

- Personal : Last night, after the untilit.works cyphers, I continued to try and figure out the video live stream worked out for my next project. Did a quick mockup of how I want some of the pages to look on the project. I want to have the site ready for the world to see in October so I have a deadline. I watched an episode of "Rick and Morty" and went to bed.

![The trunks of trees in an Ardennes, Belgium forest with grass on the ground and setting sunlight coming through the trees](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dvkpz0j77x6amond2nns.png)

Going to continue working on the video streaming issue I've been running into. I think I may have found some links that could be helpful. We'll see. I really want to get it worked out this week if possible. And that way, I can also demo it on the Sunday cyphers. Going to eat dinner, watch anime and get back at it. I may study some Japanese before calling it a night.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube PnfskEpavDE %}
[PHP curtas] Operadores lógicos: Quem vem primeiro?
Tags: php, braziliandevs, portugues, phpcurtas
Published: 2021-08-09 21:53:42

No PHP temos alguns operadores lógicos: or ou ||, and ou &&, xor or ^. Mas, e aí?! Quem tem prioridade?

Suponhamos que estejamos escrevendo um código ultra secreto onde somente uma pessoa terá acesso. Criamos um formulário HTML e enviamos os valores para esse nosso código abaixo. *Imagine que as variáveis na parte de cima venha pela variável global: $_POST ($nome = $_POST['nome']).*

```php
$nome = "Luna";
$sobrenome = "Lovegood";
$casa = "Corvinal";

function checkTemAcesso(tring $nome, string $sobrenome, string $case): bool {
  // poderíamos colocar toda essa linha como retorno,
  // só para ficar mais claro fiz assim :)
  if ($nome === "Luna" && $sobrenome === "Lovegood" or $casa === "Corvinal") {
    return true;
  }
  return false;
}
```

E então?! Qual será o retorno da função: true ou false? True, obviamente! O nome e sobrenome conferem. Mas se eu te disser que ele não entrou pela primeira, mas sim pela segunda condição? Logo, caso alteremos os valores, o código continuará funcionando:

```php
$nome = "Padma";
$sobrenome = "Patil";
$casa = "Corvinal";

function checkTemAcesso(string $nome, string $sobrenome, string $case): bool {
  if ($nome === "Luna" && $sobrenome === "Lovegood" or $casa === "Corvinal") {
    return true;
  }
  return false;
}
```

Daí vem a pergunta: Quem vem primeiro? Ou: quem tem prioridade?

Nesse caso dos operadores lógicos, os operadores: or, and e xor, tem preferência! Caso em uma condição haja algum desses, eles serão priorizados em relação aos outros: ||, && e ^.

> Importante: O compilador vai priorizar quem estiver mais a direita (veja o exemplo no código abaixo)!

Alguns exemplos:

```php
$nome = "Padma";
$sobrenome = "Patil";
$casa = "Corvinal";

if ($nome === "Luna" && $sobrenome === "Lovegood" or $casa === "Corvinal") {
  // retorna true, pois priorizou o or
}

if ($nome === "Luna" and $sobrenome === "Lovegood" or $casa === "Corvinal") {
  // retorna true, pois o or, por estar mais a direira, foi priorizado
}

if ($nome === "Luna" and $sobrenome === "Lovegood" || $casa === "Corvinal") {
  // retorna false, pois o and foi priorizado
}

if ($nome === "Luna" && $sobrenome === "Lovegood" || $casa === "Corvinal") {
  // retorna true, pois retornou true na segunda condição
}

if (($nome === "Luna" and $sobrenome === "Lovegood") || $casa === "Corvinal") {
  // retorna true, pois isolou a primeira condição entre parenteses,
  // executou primeiro, depois a segunda
}
```

------------------


É isso! Espero que tenha gostado! :)
Testing Web Server
Published: 2021-08-09 21:45:17

I have recently been exploring Flutter for some of my front end projects.  One way that I deploy my apps is on a Raspberry Pi using docker, docker-compose and the Apache2 web server.  I like this approach because I can test my app in the container and throw the container away when I'm done.

When you run:

```
flutter build web
```

you get a nice bundle that you can deploy on a web server with a file structure such as this

![filelist](https://user-images.githubusercontent.com/8879432/128769161-a93fed27-2795-4d72-867e-a581c9847fc3.png)

For any project that exposes an `index.html` file this technique can be used.

Next we need to add a `docker-compose.yaml` and a `Dockerfile` to our project folder like such

![filelist2](https://user-images.githubusercontent.com/8879432/128770388-73634d47-be26-4270-8a52-0cba0a20e1ed.png)

In our `Dockerfile` we will need to add this code

![dockerfile](https://user-images.githubusercontent.com/8879432/128771246-8f51e7b7-24ba-4eab-9f01-ce0fcf02ef96.png)

The above will copy all you files to the `/usr/local/apache2/htdocs/` folder so Apache2 can serve them up.

At this point you could build the image and use it but you would have to manually setup our volumes.  I'm lazy and I like using docker-compose so I let compose set everything up for me.  Add this to `docker-compose.yaml`

![docker-compose](https://user-images.githubusercontent.com/8879432/128772332-883a294e-5eac-4607-8414-929c183b794e.png)

Now inside the mytestserver folder run 
``` docker-compose up -d --build ```
and let docker do it's thing.  When docker is finished point your browser to 

` http://192.168.xxx.xxx:7777/ `

and your new project should appear.

###Conclusion

There are a myriad of other ways to deploy your project for testing but I like using a little Raspberry Pi.  It's a way of getting a project up on real hardware to see how it behaves.

I started using the Apache web server when the LAMP stack first came out, so me and Apache have a long history together.  It's a battle hardened, tough as nails web server that just runs and runs and runs and runs.  

2 files, 12 lines of code, 1 command, deployed for testing

Happy Coding