Skip to content

Instantly share code, notes, and snippets.

View gilbertoalbino's full-sized avatar

Gilberto Albino gilbertoalbino

View GitHub Profile
@gilbertoalbino
gilbertoalbino / default
Created December 5, 2023 23:10 — forked from badsyntax/default
My basic nginx config files for proxying to a node.js application
server {
listen YOUR_IP_ADDRESS:80 default_server;
root /var/www/nginx;
index index.html index.htm;
# This is just an invalid value which will never trigger on a real hostname.
server_name _;
server_name_in_redirect off;
@gilbertoalbino
gilbertoalbino / nginx-tuning.md
Created December 5, 2023 20:50 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@gilbertoalbino
gilbertoalbino / powershell-python-clear-control-L.py
Last active November 19, 2023 10:46
Python Control+L clear() function PowerShell
// Just copy and paste, and press ENTER 2 times!
def clear():
import os;
os.system("tput reset")
os.system("cls" if os.name == "nt" else "echo -e \\\\033c")
// Use it:
clear()
@gilbertoalbino
gilbertoalbino / centos8-9.sh
Created July 13, 2022 20:24 — forked from yodermk/centos8-9.sh
Commands to live-upgrade CentOS Streams 8 -> 9
# The general procedure here is adapted from the 7->8 guide here. https://www.tecmint.com/upgrade-centos-7-to-centos-8/
#
# It is a curated list of my bash history. I entered other commands so hopefully I got the right ones here.
yum upgrade
reboot
dnf install epel-release
dnf install rpmconf
dnf install yum-utils
rpmconf -a # answer "n" to both things
@gilbertoalbino
gilbertoalbino / required.js
Created April 29, 2022 22:46
Arquivo que importa módulo Javascript no Node.JS
require('wrapper.js')
@gilbertoalbino
gilbertoalbino / wrapper.js
Created April 29, 2022 22:41
Arquivo Node.JS é uma função
// function (exports, module, require, __filename, __dirname) {
let nome = 'Gilberto Albino'
console.log(arguments)
// return module.exports
//}(module.exports)
@gilbertoalbino
gilbertoalbino / models.java
Created June 1, 2021 00:48 — forked from leefsmp/models.java
Basic RESTful API from a Java servlet
package com.autodesk.adn.viewanddata;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.HashMap;
import java.util.UUID;
import javax.servlet.ServletException;
@gilbertoalbino
gilbertoalbino / xdebug-mac.md
Created May 1, 2021 00:24 — forked from ankurk91/xdebug-mac.md
php xDebug v3 on Ubuntu/Mac and phpStorm

🪲 Install and Configure xDebug v3 on MacOS for PhpStorm 🐘

  • Assuming that you have already installed php and apache via Homebrew v1.6+

  • Install xDebug php extension

pecl channel-update pecl.php.net
pecl clear-cache

pecl install xdebug
@gilbertoalbino
gilbertoalbino / migration.php
Last active December 29, 2021 17:33
Grammar not working postgres
<?php
// ...
public function up()
{
Grammar::macro('typeFoo', function () {
return 'foo';
});
DB::unprepared('CREATE TYPE foo AS ENUM ('a', 'b', 'c');');
@gilbertoalbino
gilbertoalbino / repo-reset.md
Last active January 12, 2021 19:35 — forked from heiswayi/repo-reset.md
GitHub - Comandos para excluir histórico de commits

Faça estes procedimentos por sua conta e risco

Primeiro Método

Excluir a pasta .git pode causar problemas ao repositório Git. Se a intenção é excluir todo o histórico de commits, mas manter o código e sua estrutura atual, tente isso:

# Faça Checkout em um branch temporario:
git checkout --orphan TEMP_BRANCH