Skip to content

Instantly share code, notes, and snippets.

View vitorfreitas's full-sized avatar
🏠
Working from home

Vitor Freitas vitorfreitas

🏠
Working from home
View GitHub Profile
@vitorfreitas
vitorfreitas / steps.md
Created May 28, 2022 15:14
Publish Node.js app to SSH server

Docker setup

  1. Install docker/docker-compose
  2. Clone the repo
  3. docker-compose up -d inside the app folder

Nginx setup

  1. sudo apt install nginx
  2. sudo unlink /etc/nginx/sites-enabled/default
  3. cd /etc/nginx/sites-available and vim reverse-proxy.conf and paste the code in the first appendix
  4. ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf
@vitorfreitas
vitorfreitas / upgrade_dbeaver.sh
Created March 13, 2022 03:39
upgrade dbeaver with most recent version from the dbeaver website
echo "dbeaver-ce install" | sudo dpkg --set-selections
wget -O dbeaver-ce.deb https://dbeaver.io/files/dbeaver-ce_latest_amd64.deb
sudo dpkg -i dbeaver-ce.deb
rm dbeaver-ce.deb
echo "dbeaver-ce hold" | sudo dpkg --set-selections
@vitorfreitas
vitorfreitas / .zshrc
Created May 1, 2019 19:08
Configurações pessoais do shell zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/vitor/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@vitorfreitas
vitorfreitas / component.js
Created January 18, 2019 14:27
react loading script
componentDidMount () {
const script = document.createElement("script");
script.src = "https://meusite.com/script.js";
script.async = true;
document.body.appendChild(script);
}
@vitorfreitas
vitorfreitas / .hyper.js
Last active May 1, 2019 19:06
Configurações pessoais p/ meu terminal Hyper
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@vitorfreitas
vitorfreitas / format.js
Created December 10, 2018 22:57
Formatar strings que representam dinheiro em React Native
export const formatNumber = (amount, decimalCount = 2, decimal = ",", thousands = ".") => {
try {
decimalCount = Math.abs(decimalCount);
decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
const negativeSign = amount < 0 ? "-" : "";
let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
let j = (i.length > 3) ? i.length % 3 : 0;