Skip to content

Instantly share code, notes, and snippets.

View igoralves1's full-sized avatar

Igor Alves igoralves1

View GitHub Profile
@igoralves1
igoralves1 / loadbalancer.conf
Last active August 8, 2020 08:47
Using NGINX as HTTP load balancer, Load Balancing
upstream web_backend{
server 192.168.1.11:3000;
server 192.168.1.12:3000;
}
server {
listen 3000;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@igoralves1
igoralves1 / gist:6d680f61f6873d8fcbf3a5afbfbac8b5
Created April 19, 2019 18:26
Win CRON JOB - DATABASE BACKUP ROUTINE
@ECHO off
REM - DATABASE BACKUP ROUTINE
ECHO.
ECHO 1 - dbTest STARTING backup ...
mysqldump -u root -pMYPASSWD --routines --add-drop-database --databases dbNameInMySql> C:/Users/backup/dbNameDumped.sql
ECHO dbTest - BACKUP DONE...
ECHO.
rar a -ag+YYYY{_}MM{_}DD{_}HHMMSS{_}NN C:/Users/backup/ C:/Users/backup/FinalFolder/
@igoralves1
igoralves1 / installMag23.sh
Created January 26, 2019 00:14
Install et Setup Magento 2.3 on AWS Ubuntu 16.04, EC2 - 4CPU + 32Gb
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
echo ""
echo "0 - Variables"
echo " "
BASE_URL='http://xxx-xx-xxx-xxx-xxx.us-east-2.compute.amazonaws.com/'
DB_USER='xxx'
DB_USER_PASSWORD='xxx'
DB_MAGENTO='db_magento'
@igoralves1
igoralves1 / mag23Init.sh
Last active January 26, 2019 00:03
Install et Setup Magento 2.3 on AWS Ubuntu 16.04, EC2 - 4CPU + 32Gb
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
echo ""
echo "0 - Variables"
echo " "
BASE_URL='http://xxx-xx-xxx-xxx-xx.us-east-2.compute.amazonaws.com/'
DB_USER='xxx'
DB_USER_PASSWORD='xxx'
DB_MAGENTO='db_magento'
@igoralves1
igoralves1 / magInit.sh
Created January 17, 2019 23:36
Install and setup Magento 2.3 into a AWS-EC2 32Gb 4 CPU
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
echo ""
echo "0 - Variables"
echo " "
#Note: after create the instance in the AWS copy the full path into the BASE_URL variable
BASE_URL='http://ec2-xx-xxx-xxx-xx.us-east-2.compute.amazonaws.com/'
DB_USER='xxx'
DB_USER_PASSWORD='xxx'
@igoralves1
igoralves1 / mysite.conf
Created January 9, 2019 13:05
nginx conf example
server {
listen 80;
server_name estudoLaravel5.7;
root /var/www/vhosts/estudoLaravel5.7/public;
index index.html index.htm index.php;
charset utf-8;
location / {
# https://www.youtube.com/watch?v=r40pC9kyoj0&t=211s
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == '__main__':
@igoralves1
igoralves1 / .bashrc
Last active February 9, 2021 22:30
Show your branch name on the Linux prompt, changing .bashrc on Ubuntu 16.04.
Show your branch name on the Linux prompt. Updated
1-Go to ~/ directory, or /home/"username";
2-type sudo subl .bashrc. So this will be the full command ila@ig:~$ sudo subl .bashrc. That will open the .bashrc file
3-After this Introductory sentence of the .bashrc:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
4-Put this function declaration:
# Add git branch if its present to PS1
@igoralves1
igoralves1 / 000-default.conf
Last active April 7, 2022 06:49
Perl example using a form with Bootstrap + jQuery + AJAX.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ScriptAlias /cgi-bin/ /var/cgi-bin/
<Directory "/var/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
Route::get('/sql',function(){
$sql=<<<EOF
-- -----------------------------------------------------
-- Table `migrations`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `migrations` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`migration` VARCHAR(191) COLLATE 'utf8mb4_unicode_ci' NOT NULL,