Skip to content

Instantly share code, notes, and snippets.

View alexander-alegre's full-sized avatar
:shipit:

Alexander Alegre alexander-alegre

:shipit:
View GitHub Profile
const mongoObjectId = () => {
const timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, () => {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@alexander-alegre
alexander-alegre / install.sh
Last active July 17, 2021 04:09
Server Setup Script (WIP)
## Setup firewall
echo "Setting up firewall..."
sudo ufw allow OpenSSH
sudo ufw enable
echo "Updating packages..."
## Update packages and Upgrade system
sudo apt-get update -y
## Install Linux, Nginx, MySQL, PHP
@alexander-alegre
alexander-alegre / gitrewrite.py
Created November 6, 2020 20:23
Script to rewrite a branch's history
#!/usr/bin/env python3
# Rewrite whole history for a branch
import os
import subprocess
from pathlib import Path
class bcolors:
@alexander-alegre
alexander-alegre / .tmux-osx.conf
Created November 6, 2020 19:05
Tmux conf for OSX to open apps from console
# if osx, use reattach-to-user-namesapce
set-option -g default-command "reattach-to-user-namespace -l ${SHELL}"
@alexander-alegre
alexander-alegre / .tmux.conf
Created November 6, 2020 18:56
tmux configuration
#-------------------------------------------------------#
#reattach-to-user-namespace must be installed
#-------------------------------------------------------#
#the following line refers to the file ~/.tmux-osx.conf
if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux-osx.conf'
#-------------------------------------------------------#
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
@alexander-alegre
alexander-alegre / settings.vim
Created September 9, 2020 19:41
settings.vim
" vim-bootstrap b0a75e4
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
@alexander-alegre
alexander-alegre / plugins.vim
Created September 9, 2020 19:40
plugins.vim
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@alexander-alegre
alexander-alegre / .vimrc
Created September 9, 2020 19:33
.vimrc
"----------------VUNDLE-------------------"
set nocompatible " be iMproved, required
" Autogenerated filee from www.vim-bootstrap.com"
so ~/settings.vim
" Plugins
so ~/.vim/plugins.vim
@alexander-alegre
alexander-alegre / deployment_guide.md
Last active July 10, 2021 19:08 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel

Getting Started

  • Create droplet with Ubuntu 18.10
  • ssh root@[DROPLET IP ADDRESS]
  • Get password from your email
  • Change password on first login
  • adduser laravel
  • Enter password and other information
  • usermod -aG sudo laravel
@alexander-alegre
alexander-alegre / node_nginx_ssl.md
Last active May 8, 2020 19:07 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5ac12c45bf84

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user