Skip to content

Instantly share code, notes, and snippets.

View florianmaxim's full-sized avatar
🐘
Waiting for the Others

Florian Maxim florianmaxim

🐘
Waiting for the Others
View GitHub Profile
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
@florianmaxim
florianmaxim / gitlab-ci.yml
Created October 23, 2020 11:58
gitlab-ci.yml
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
@florianmaxim
florianmaxim / .env.sample.staging
Created October 23, 2020 11:01
.env.sample.staging
# Staging environment (Sample)
# Node
NODE_ENV=production
NODE_PORT=3000
# Postgres
POSTGRES_PORT=5432
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=<CHANGE_ME>
@florianmaxim
florianmaxim / .env.staging
Last active October 23, 2020 11:05
.env.staging
# Staging environment
# Node
NODE_ENV=production
NODE_PORT=3000
# Postgres
POSTGRES_PORT=5432
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=mysecretpassword
@florianmaxim
florianmaxim / .gitignore
Created October 14, 2020 14:34
.gitignore
.env*
!.env.sample*
@florianmaxim
florianmaxim / generate.env.sh
Last active October 23, 2020 11:55
generate.env.sh
#!/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"
@florianmaxim
florianmaxim / gitlab-ci.yml
Last active October 23, 2020 11:59
gitlab-ci.yml
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
@florianmaxim
florianmaxim / docker-compose.staging.yml
Created October 14, 2020 13:43
docker-compose.staging.yml
version: '3.1'
services:
nodejs:
build: .
restart: always
depends_on:
- postgres
links:
@florianmaxim
florianmaxim / primeFactorize.js
Last active February 22, 2020 20:22
Prime factorisation
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;
};
@florianmaxim
florianmaxim / factorise.js
Last active February 22, 2020 20:06
Factorize a number
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;
}