Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Tam Nguyen ntamvl

🏠
Working from home
Block or report user

Report or block ntamvl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ntamvl
ntamvl / remove-all-node_module-folders-recursively.md
Last active Mar 24, 2019
Remove all node_module folders recursively
View remove-all-node_module-folders-recursively.md

Remove all node_module folders recursively

With any type of folder/file

find . -name "node_modules" -exec rm -rf '{}' +

Only folder

find . -type d -name "node_modules" -exec rm -rf '{}' +
View Max-value-decimal-in-PostgreSQL-scale-and-length.md

Max value decimal in PostgreSQL

Calculate from precision, scale, and length

max_value = 10^(precision - scale)
View how-to-avoid-duplicate-api-requests-with-redux-saga.md

How to avoid duplicate API requests with Redux-Saga?

Also it might be a good to decouple your saga from the state shape itself, im alway trying to do this, unless it would provide to copying reducers' logic in your sagas.

You could create a higher order saga for this, which would look something like this:

function* takeOneAndBlock(pattern, worker, ...args) {
  const task = yield fork(function* () {
    while (true) {
      const action = yield take(pattern)
@ntamvl
ntamvl / how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04.md
Last active Oct 30, 2018
How To Secure Nginx with Let's Encrypt on Ubuntu 16.04
View how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04.md

How To Secure Nginx with Let's Encrypt on Ubuntu 16.04

Step 1 — Installing Certbot

First, add the repository.

sudo add-apt-repository ppa:certbot/certbot

You'll need to press ENTER to accept. Then, update the package list to pick up the new repository's package information.

sudo apt-get update
@ntamvl
ntamvl / react-native-vector-icons-error.md
Created Jun 6, 2018
Error: While resolving module `react-native-vector-icons/MaterialIcons`, the Haste package `react-native-vector-icons` was found
View react-native-vector-icons-error.md

Error: While resolving module react-native-vector-icons/MaterialIcons, the Haste package react-native-vector-icons was found

The file it is trying to find does in fact declare that module.

This is why it breaks now: facebook/metro#139 (comment)

Related issue: #379

@ntamvl
ntamvl / parallels_tools_ubuntu_new_kernel_fix.md
Created May 30, 2018 — forked from rudolfratusinski/parallels_tools_ubuntu_new_kernel_fix.md
Parallels Tools fix for Ubuntu 18.04 and other Linux distributions with Kernel version >= 4.15
View parallels_tools_ubuntu_new_kernel_fix.md

Preparation

  • In open Ubuntu 18.04 machine click Parallels Actions -> "Install Parallels Tools"

  • A "Parallels Tools" CD will popup on your Ubuntu desktop.

  • Open it by double mouse click, copy all the content to a new, empty directory on a desktop, name it for e.g. "parallels_fixed"

  • Open terminal, change directory to parallels_fixed (cd ~/Desktop/parallels_fixed)

  • Make command line installer executable (chmod +x install)

  • Change directory to "installer" (cd installer)

  • Make few other scripts executable: chmod +x installer.* *.sh prl_*

@ntamvl
ntamvl / robot_tranh_vat_can_v1.ino
Created May 17, 2018
Arduino - Robot tránh vật cản
View robot_tranh_vat_can_v1.ino
/***
* Description: Just for ...
* Email: ntamvl@gmail.com
***/
#include <AFMotor.h>
#include <Servo.h>
#define TRIG_PIN A4
#define ECHO_PIN A5
@ntamvl
ntamvl / disk-speed-test-read-write-hdd-ssd-perfomance-linux.md
Created May 4, 2018
Disk Speed Test (Read/Write): HDD, SSD Performance in Linux
View disk-speed-test-read-write-hdd-ssd-perfomance-linux.md

Disk Speed Test (Read/Write): HDD, SSD Performance in Linux

From this article you’ll learn how to measure an input/output performance of a file system on such devices as HDD, SSD, USB Flash Drive etc.

I’ll show how to test the read/write speed of a disk from the Linux command line using dd command.

I’ll also show how to install and use hdparm utility for measuring read speed of a disk on Linux Mint, Ubuntu, Debian, CentOS, RHEL.

Take the average result: To get the accurate read/write speed, you should repeat the below tests several times (usually 3-5) and take the average result.

@ntamvl
ntamvl / how-can-i-know-the-absolute-path-of-a-running-process.md
Created Apr 11, 2018
[Linux] How can I know the absolute path of a running process
View how-can-i-know-the-absolute-path-of-a-running-process.md

[Linux] How can I know the absolute path of a running process

ps auxwe

or

ps -ef
@ntamvl
ntamvl / low-disk-watermark-exceeded-on.md
Created Apr 10, 2018
low disk watermark [??%] exceeded on
View low-disk-watermark-exceeded-on.md

low disk watermark [??%] exceeded on

I know it is old post, but my comment can make someone happy. In order to specify watermark in bytes values (gb or mb) you have to add cluster.routing.allocation.disk.watermark.flood_stage to your elasticsearch settings file - elasticsearch.yml. Complete example:

cluster.routing.allocation.disk.threshold_enabled: true 
cluster.routing.allocation.disk.watermark.flood_stage: 200mb
cluster.routing.allocation.disk.watermark.low: 500mb 
cluster.routing.allocation.disk.watermark.high: 300mb   
You can’t perform that action at this time.