teleren/devto huggingface dataset:
If you want to be an above average Web Security Researcher, ask questions 
Tags: websecurity, securityresearcher, questions, cybersecurity
Published: 2018-11-23 06:16:53

---
title: If you want to be an above average Web Security Researcher, ask questions 
published: True
description: Questioning is pivotal to success in web security and you need to ask the WHY question almost every time
tags: web security, security researcher, questions, cybersecurity
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0ht4uxkyji91gzr52347.jpg
canonical_url: https://sinxloud.com/why-questioning-is-pivotal-to-successful-career-in-web-security?
---

As you start practicing security, you have to make a difficult adjustment in your learning process by asking questions.

* **What is this Bug?**
* **How does this bug work?**
* **Why does this bug work?**

Questioning is pivotal to success in web security and you need to ask the WHY question almost every time (why did this work and why did this not work) and answer them yourself.

**If you find a bug;** How did I find this bug? Why does this bug exist?

**If you don’t find a bug;** Why didn’t I find this bug? What am I doing wrong?

You have to know why you couldn’t find that bug. Maybe you were able to find that bug in your practice on the VM but you are not able to find the bug in the actual website. 

**You have to know Why**. Possibly the website you are testing has implemented a good security mechanism. So you have to learn what they doing right. Once you know more about doing things right, you will automatically know how to do things wrong. And next time when you go to test another website you will know what these guys are missing.

The common problem in bug bounty hunters is that once you find a bug, you get over excited. You want to get paid for it quickly, your focus redirects to money and you stop logical thinking at $200 bounty. And as a result, sometimes your bug will have much more impact. Only if you think more and questions, you can make it to $2000 or even $20000 bounty.
 
Remember, as a web security researcher, you take regular everyday things and think of malicious ways of using those things. So, asking questions will keep you from looking at the website from a bird’s eye view and find low hanging fruit i.e, security vulnerabilities without any serious impact. 

You need to know everything that's happening in the web development world. 

If you want to be an above average web security researcher, you have to take a closer and deeper look at how the different technologies used by the website come together. 

**So Asking questions will help you do so**

This post was originally published [here](https://sinxloud.com/why-questioning-is-pivotal-to-successful-career-in-web-security/).
Structuring Node.js Project
Tags: node, expressjs, boilerplate, bestpractice
Published: 2018-11-22 05:07:14

---
title: Structuring Node.js Project

published: true
description: Quick start template for your new NodeJS project
tags: nodejs, expressjs, boilerplate, best-practice
---

If you are looking for the NodeJS project structure based on the best practices to build the RESTful API. It might be helpful for you guys. 


Some of the good practices followed in this repository:

- Code Style Practices via [Node Best Practices](https://github.com/i0natan/nodebestpractices)
- ES6 Support.
- Morgan Logger.
- Error Handling.
- Open API Specification implemented through [apidocjs](http://apidocjs.com/).
- JWT Authentication.
- Joi & Express Validation.
- Environment variables via `.env` file.
- Linting with Prettier.
- Security (Helmet, CORS, Express Brute).
- Husky as git hook for linting & running unit test before commit.
- Unit & E2E Testing with Jest.
- [Backpack](https://github.com/jaredpalmer/backpack) build system


## Prerequisite
1. NodeJS
2. Node Package Management (`yarn` or `npm`)
3. Docker

## Installation

1. Clone the project `git clone git@github.com:vukhanhtruong/nodejs-api-boilerplate.git`.
2. Install dependencies `yarn install` or `npm i`
3. Copy `.env.example` to `.env` file.



## Running Docker

`docker-compose up -d`.



## Raven Log

Create account at [Sentry](https://sentry.io/), then put your url to `.env` file at variable `SENTRY_DSN`.



## Api Doc

Api doc his hosted on [surge](https://surge.sh/). For change the url and have your own docs just modify your link in the `.env` file. Running the following command to publish your documentation.

```sh
# Generate document
yarn doc
# Deploy document to surge.sh
yarn doc:deploy

# or
npm run doc
npm run doc:deploy
```


## Pre-Commit Hook

Using `husky` for linting your code before commit & running unit test before push.



## Scripts

### DEV

```sh
yarn dev

# or

npm run dev
```

### DEBUG

Debug with VSCode. See [VSCode Auto-Attach](https://code.visualstudio.com/updates/v1_22#_node-debugging)

```sh
yarn debug

# or

npm run debug
```

### TEST

```sh
yarn test

# or

npm run test
```

**NOTE:** If you have the issue with ENOSPC, run the below command to avoid:

```sh
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
```

#### Test Watch

```sh
yarn test:watch
```

### COVERAGE

```sh
# run jest coverage
yarn test:cover

# show html report
yarn test:cover:open

# or

npm run test:cover

npm run test:cover:open
```

### JSDOC

```sh
# generate documentation
yarn doc

# Publish documentation to surge.sh
yarn doc:deploy

#or

npm run doc

npm run doc:deploy
```
 

Find out [more here](https://github.com/vukhanhtruong/nodejs-api-boilerplate)

Happy Coding!
GCE VM Firewall Cofiguration
Tags: gce, network, firewall
Published: 2018-11-23 03:01:09

---
title: GCE VM Firewall Cofiguration
published: true
description: GCE enables us to use just two numbers as server port by default, 80 as http and 443 as https. It's enough to build simple web servers, but not to build more. I had to build a ftp server instantly. Therefore, I tried custom configuration of GCP firewall.
tags: gce, network, firewall
---

# Introduction

Google provides GCE, Google Compute Cloud, as IaaS product of GCP, Google Cloud Platform.

GCE enables us to use just two numbers as server ports by default, 80 as http and 443 as https.
It's enough to build simple web servers, but not to build more.

I had to build a ftp server instantly.
Therefore, I tried custom configuration of GCP firewall.

# Summary

There are just two steps to carry it out:

- Step 1: Setting Up VPC Network
- Step 2: Configuring VM Instances Of GCE

<center>✿ ✿ ✿</center>

# Procedure

### Step 1: Setting Up VPC Network

Choose [VPC network] - [Firewall rules]:

![](https://thepracticaldev.s3.amazonaws.com/i/f1rp2es6nqx0f0wsjvrv.png)

Click "CREATE FIREWALL RULES":

![](https://thepracticaldev.s3.amazonaws.com/i/1nsbt3vcso554faj2ef0.png)

---

*In my case, tcp 21 was set as ftp port.*

#### Naming

Rule name:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/1nqkq7mgtjg4z5wa4od8.png)

Tag name:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/ncqb5stp923851wsur8v.png)

This "Tag name" will be used at setting up GCE VM instances.

#### Network rules

Ingress or Egress:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/iaqcf1coxo58wt9jixwa.png)

Ingress is enough to achieve my purpose.

IP ranges:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/3o2av9f52jpqj013fzve.png)

Protocols and ports:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/1d7lhg12jfclk4q03ch0.png)

---

Execute "Create":

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/b4u55c4alxsa8kz9x964.png)

Result:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/33vczkqzrft9w1rwgf8m.png)

The first row is added.

### Step 2: Configuring VM Instances Of GCE

#### Case 2-1: Editing Existing VM

Start editing:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/8wory9hdjvk7krszkpi1.png)

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/q8dq6cue27x5dcbikeqb.png)

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/y4ekb17rp5yi9fqj59vi.png)

Add "Network tags" using "Tag name":

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/0owbwfbbntgwj2gi078c.png)

Save:

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/ik0ju00z5umlo3xj41hb.png)

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/ppk1dirvja4nn50jj62f.png)

Finished ☺

#### Case 2-2: Configuring At Creating VM

Add "Network tags" using "Tag name":

![screenshot](https://thepracticaldev.s3.amazonaws.com/i/xabvhon0uavyk2h1qget.png)

Finished ☺

<center>✿ ✿ ✿</center>

Happy serving 🕊
StormScript: What's New and What's Better
Tags: linux, cpp
Published: 2018-11-22 05:03:10

---
title: StormScript: What's New and What's Better
published: true
description: StormScript v0.2.0 banana changes many things that people pointed out in my first post.
tags: #linux, #cpp
---

# Intro

On Sunday I made a post explaining what StormScript was and why I believed it was important. Reception was mostly positive with people pointing out things they didn't like with the syntax. I changed two of them. I also changed the [Repository](https://github.com/stormprograms/StormScript) so that it is easier to figure out where everything is. Additionally, I added class methods.

# Syntax Changes

## `end;`

Both people who commented on my post talked about how they didn't like the `end;` at the end of each code block. I agreed and had actually been thinking about changing this for a while.

Before:
```
do {
    int x: 3;
    int y: 4:

    if x is y {
         printl x, " is equal to ", y;
    }else{
        printl x, " is not equal to ", y;
    }end;
}end;
```

After:
```
do {
    int x: 3;
    int y: 4:

    if x is y {
         printl x, " is equal to ", y;
    }else{
        printl x, " is not equal to ", y;
    }
}
```

## Function Arguments

The way function arguments were declared was a nightmare. Originally I thought it was ok, but now I realize that it takes up *too much* unnecessary space.

Before:
```
@args: int x;
func foo {
    printl x;
}

do{
    foo => x: 3;
}
```

After:
```
func foo => int x {
    printl x;
}

do{
    foo => x: 3;
}
```

# Class Methods

Class methods are declared the same as normal functions, but inside of a `type` scope.

```
type person {
    int age;
    str name;

    func birthday {
        age+: 1;
    }
}

do {
    person p;
    p|age: 22;
    p|name: "Joe";

    printl p|name, " is ", p|age, " years old!";

    p|birthday;

    printl "It's ", p|name, "'s birthday. ", p|name, " is ", p|age, " years old!";
}
```


I think that the feedback I received is valuable and will make StormScript better. Please keep sending me suggestions.

Of course check out the [repository](https://github.com/stormprograms/stormscript) and be sure to contribute or open a feature request if you would like to see anything added.
Indexing Databases – A Postgres Example
Tags: programming, benchmarks, database, indexes
Published: 2018-12-28 19:47:16

---
title: Indexing Databases – A Postgres Example
published: true
tags: Programming,benchmarks,databases,indexes
canonical_url: https://www.stephencharlesweiss.com/2018/11/22/indexing-databases-a-postgres-example/
---

A short review of when and how to index a Postgres database. A good complement to my post on [indexing Mongo DB](https://dev.to/stephencweiss/adding-indexes-to-mongo--a-case-study-3kbo) 

# Common Commands
{% gist https://gist.github.com/stephencweiss/153a0d9652bb79d476ab1671952d3047 %}

# Why Index Your Postgres Table

The two most common reasons to index a database are:  
1. A table is large and queries take a long time  
2. A program consistently searches the same attribute

## Speed Benefits – A Practical Example

The easier of the two to see is time to execute a query.

Situation: I have a product descriptions table with 10m+ records. In order to serve my website, I need to find and retrieve descriptions for a specific description quickly.

{% gist https://gist.github.com/stephencweiss/dabe29f6f4439c34585ff4a48c91cc60 %}

Before adding an index, it took `28k+ ms` to find my product. After adding an index, the time to complete the same query fell to `3.579ms`. That’s equivalent to 99.99% reduction! Not bad for a single line of code!

# Types Of Indexes

The default index type for Postgres is the B-tree, which is also the default and well suited for common situations.

There are other types available, however, including:

- Hash
- GiST,
- SP-GiST, and
- GIN

# The Cost Of Indexing

While indexing has benefits, it comes with costs too.  
Specifically, indexing will slow down inserting / updating records on a table.

# When To Avoid Indexes

Indexing is not for every situation. Some scenarios in which you should pause before creating an index include:

- If your table is small
- Tables that have frequent, large updates / insertions of records
- On fields where _null_ is a common value
- Fields are that are commonly updated

# Other Note Worthy Points Regarding Indexes

## Implicit Indexes

Implicit indexes are automatically created by Postgres for fields that have a primary key or unique constraint.

## Partial Indexes

Partial indices are built on a subset of a table based on a conditional statement. Therefore, the index only applies to the rows which satisfies the conditional.

To create a partial index, use the following:  
`CREATE INDEX <index_name> ON <table_name> (<conditional_expression>)`

# Further Reading

[Postgres Docs](https://www.postgresql.org/docs/9.1/sql-createindex.html)  
[Tutorials Point: PostgreSQL Indexes](https://www.tutorialspoint.com/postgresql/postgresql_indexes.htm)
Start, Development and Basic Features of Angular
Tags: angular, webdev, frontend
Published: 2018-11-22 23:25:23

---
title: Start, Development and Basic Features of Angular
published: true
description: This is about the start, development and basic features of Angular without too much details.
tags: angular,webdev,frontend
---

  ![Angular component - like building a city](https://thepracticaldev.s3.amazonaws.com/i/ghglx6ahjubyswr41egi.jpg)

***

This is about the start, development and basic features of Angular without too much details.

***

**2009** - Angular was originally developed by Misko Hevery in 2009.
Somewhere at the end of 2009, a company where he worked, decided to put the code on Git and become opensource.

**2010** - The initial rebase was in 2010 and the most maintained by Google.
AngularJS is JavaScript-based framework, work like Single page application with MVC architectural pattern.

**2013** - In 2013-14 appeared other web frameworks and tools, the most famous is React, developed by Facebook developers.

**2016** - Right at the start, React show good results and better performance. The angular team needed to change something and they decided not to upgrade angularjs.
Instead, they decided to develop a new framework from the start. The just keep first part of name, cut off 'JS', add version 2, and in September 2016 Angular 2 was created. The same team develops AngularJS and Angular 2.

**2018 November** - Current version: Angular 7

  ![Angular relases](https://thepracticaldev.s3.amazonaws.com/i/3vkh9a6a5xlcllojqbk8.png)

***


| AngularJS     | Angular 2     |
| ------------- |:-------------:|
| Javascript    | Typescript(a superset of JavaScript) |
| MVC           | Component-MVC |
| |Tooling support, CLI, IDEs, plugins...|

***

> * Support for AngularJS stopped with the latest version 1.7
> * The rule for Angular 2 is: every 6 months new version.

***

**Angular 2 Basic Features**

* Component-MVC pattern
* Each component class is an independent unit, it is highly reusable.
* Each component required logic, view, and data as one unit. That means component use MVC pater and Angular framework use components -> Components-MVC pattern.
* It's easy adding more components to your existing application. 
* Building an SPA using Angular 2 components is like building a house using lego blocks. Just add more lego blocks to make your building bigger.

***

* Angular 2 framework consists of several libraries, some core and other optional. 
* Many of those libraries are modules (i.e. FormModule, HttpModule, and RouterModule).

***

* Angular CLI stands for Angular Command Line Interface.
* It is recommended to use angular CLI for creating angular apps as you don't need to spend time installing and configuring all the required dependencies and wiring everything together.

***

* Using Typescript we can use data models and type safety.

***

* The Angular team also did a great job in the documentation, have the strong community and backed by Google.

***
Looking for courses and books about Software Architecture
Tags: question, architecture, career, discuss
Published: 2018-11-22 23:24:59

---
title: Looking for courses and books about Software Architecture
published: true
description: Looking for courses and books about Software Architecture
tags: question, softwarearchitecture, career, discuss
---

Today I was studying about Monolithic Applications and Microservices Architecture (specially at Martin Fowler blog) and I know something about it but I really want to go into this. What courses, specializations, books do you recommend?

I was reading some posts like https://dev.to/mikkpr/what-are-good-ways-to-learn-software-architecture-and-systems-design-38b9 that has a lot of good information but I want to find something straight-forward to follow for the next months.

This is very open but was done intentionally so you can guide me because I don't know if have some wrong concepts :D lol thank you!
Clean Code concepts adapted for Ruby
Tags: ruby, cleancode, clean
Published: 2018-11-22 23:20:27

---
title: Clean Code concepts adapted for Ruby
published: true
description: 
tags: ruby, cleancode, clean
---

Today I read this from Ruby Weekly. A good clean code guide for Ruby.

Let's study it together.

## Table of Contents
  1. [Introduction](#introduction)
  2. [Variables](#variables)
  3. [Functions](#functions)
  4. [Objects and Data Structures](#objects-and-data-structures)
  5. [Classes](#classes)
  6. [SOLID](#solid)
  7. [Testing](#testing)
  9. [Error Handling](#error-handling)
  10. [Formatting](#formatting)
  11. [Comments](#comments)
  12. [Translations](#translations)

## Introduction
![Humorous image of software quality estimation as a count of how many expletives
you shout when reading code](http://www.osnews.com/images/comics/wtfm.jpg)

Software engineering principles, from Robert C. Martin's book
[*Clean Code*](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882), adapted for Ruby. This is not a style guide. It's a guide to producing [readable, reusable, and refactorable](https://github.com/ryanmcdermott/3rs-of-software-architecture) software in Ruby.


[link-->](https://github.com/uohzxela/clean-code-ruby#table-of-contents)
Game Off 2018 (8)
Tags: lua, gamedev, gameoff2018, pixelart
Published: 2018-11-22 21:22:04

---
title: Game Off 2018 (8)
published: true
description: Flower unlock system
tags: lua, gamedev, gameoff2018, pixelart
---

Hellow!
New day and new upgrades! I've work on the system to unlock the flower and made the save system!

![World](https://thepracticaldev.s3.amazonaws.com/i/7qj4xp2cpvac0ki44b87.gif)

Before the end of the jam (only 1 week left!), I've to create a game menu and add some sound effect and musics! It's not my favorite part of the game developpement xD

It's all for today! Have a nice day!
Static Class or Interface?
Tags: help
Published: 2018-11-22 20:34:01

---
title: Static Class or Interface?
published: true
tags: help
---
Hello guys, this is my first post and it is a question. I've been learning C# and I didn't understand the difference between Static Class and Interface. In essence they appear to do the same, but as I don't have much experience I was wondering if maybe they were the same but with different performance or something like that.
Help?
Typescript method overloading
Tags: javascript, typescript, programming
Published: 2018-11-22 18:42:31

---
title: Typescript method overloading
published: true
tags: javascript, typescript, programming
cover_image: https://cdn-images-1.medium.com/max/2000/1*MPTh_FBx_Dy_AOqhnxV0jQ.jpeg
---

Method overloading is a familiar concept from traditional programming languages like Java or C#. It basically allows a class to have multiple methods with the same name if their signature is different.

But Typescript only helps us during edit and compile time and not at runtime. Therefore method overloading works different. The executed code is still pure Javascript.

Due to the dynamic nature of JavaScript we can’t use overloading in the same way we do in other languages. [Find out how method overloading works in TypeScript](https://medium.com/@kevinkreuzer/typescript-method-overloading-c256dd63245a)
What're You Thankful For?
Tags: discuss, thanksgiving, thankful, grateful
Published: 2018-11-22 19:28:39

---
title: What're You Thankful For?
published: true
description: What is the community thankful for this year?
tags: discuss, thanksgiving, thankful, grateful
---

It's Thanksgiving here in the US. For many people, it's a day of reflection on our challenges and blessings that signals the coming end of the year. 

I've recently really enjoyed the `#discuss` tag and discussion threads on this site. You could say I am a little thankful for them 🙂. Prompted by Ben, Jess, and Peter's posts expressing gratitude to the community and its sponsors, I am curious to hear the community's response.

What are you thankful for this year?

Feel free to share anything, I don't mean specifically learning, community, or profession-related, I'm just asking in general🙂.
Sharing my first personal website
Tags: showdev, portfolio, webdev, javascript
Published: 2018-11-22 19:08:36

---
title: Sharing my first personal website
published: true
description: Finally, I made my first personal website.
tags: #showdev #portfolio #webdev #javascript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/wuwupifqz0gt2o4h6h5s.png
---

Hi, folks

Finally, I made my first personal website. I'm a full-stack web developer who believes in simplicity and minimalism. In my personal website, I aimed to convey these feelings through a simple geeky design and UX.

well let's not talk too much, here it is :

[Mazen Touati - Old version](https://sunchayn.github.io/old)


I'll incrementally add tweaks to the website due the fact that I made it in a rush somehow. I'll open the source code when I organize and document it.

Third party plugins i used :
[scroll reveal](https://scrollrevealjs.org/)
Throttle from [lodash](https://lodash.com/)


Please let me hear your thoughts and suggestion, thanks.

---
## Notice

I made the first design iteration, so what you seeing now is an updated version, please refer to this post to see what's changed

{% link https://dev.to/mazentouati/a-first-design-iteration-of-my-personal-website-37p6 %}
Playing and Learning Docker Together
Tags: docker, learning, playing, together
Published: 2018-11-22 18:05:17

---
title: Playing and Learning Docker Together
published: true
description: Learning Docker By Examples
tags: docker, learning, playing, together
---

Just started playing with docker today. I created GitHub repository and added two examples i.e. ReactJS and NodeJS.

https://github.com/zilurrane/my-docker-experiments

My plan is learn much about docker I can, add production ready examples for all languages. Above 2 examples are bare minimum, there is much we can do.

Would love to see your review comments on this. Pull Request will be much helpful.

Learning Together.