This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo netstat -n --udp --listen | egrep ':(4[2-9]|[45][0-9])[0-9]{3}|6[0-3][0-9]{3}|49999' // Port 40000-49999 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deploy-staging: | |
| stage: deploy | |
| only: | |
| - staging # (development/staging/production) | |
| tags: | |
| - staging # (development/staging/production) | |
| script: | |
| # Install docker-compose | |
| - sudo apt-get install python3-pip -y && sudo -H pip3 install docker-compose | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Staging environment (Sample) | |
| # Node | |
| NODE_ENV=production | |
| NODE_PORT=3000 | |
| # Postgres | |
| POSTGRES_PORT=5432 | |
| POSTGRES_USERNAME=postgres | |
| POSTGRES_PASSWORD=<CHANGE_ME> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Staging environment | |
| # Node | |
| NODE_ENV=production | |
| NODE_PORT=3000 | |
| # Postgres | |
| POSTGRES_PORT=5432 | |
| POSTGRES_USERNAME=postgres | |
| POSTGRES_PASSWORD=mysecretpassword |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .env* | |
| !.env.sample* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ENV=$1 | |
| SAMPLE_FILE=".env.sample.$ENV" | |
| FILE=".env.$ENV" | |
| printf "\033[1;32m Generating environment file... \033[0m\n" | |
| printf "\033[1;35m Reading variables from sample file ($SAMPLE_FILE): \033[0m\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deploy-staging: | |
| stage: deploy | |
| only: | |
| - staging # (development/staging/production) | |
| tags: | |
| - staging # (development/staging/production) | |
| script: | |
| # Install docker-compose | |
| - sudo apt-get install python3-pip -y && sudo -H pip3 install docker-compose | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3.1' | |
| services: | |
| nodejs: | |
| build: . | |
| restart: always | |
| depends_on: | |
| - postgres | |
| links: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isPrime = n => { | |
| const divisors = []; | |
| for (let i = 1; i <= n; i++) { | |
| let mod = n % i; | |
| console.log(`${n}%${i}=${mod}`); | |
| if (mod === 0) divisors.push(i); | |
| } | |
| return divisors.length === 2; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function factorize(n) { | |
| const x = n; | |
| const factors = []; | |
| for (let i = 2; i <= n; i++) { | |
| let mod = n % i; | |
| console.log(`${n}%${i}=${mod}`); | |
| if (mod === 0) { | |
| factors.push(i); | |
| n = n / i; | |
| } |
NewerOlder