Skip to content

Instantly share code, notes, and snippets.

View gustavobcx's full-sized avatar

Gustavo Barbosa Castilho gustavobcx

View GitHub Profile

Latency Comparison Numbers (~2012)

Name
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cachereference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
@gustavobcx
gustavobcx / a-mongodb-replica-set-docker-compose-readme.md
Created March 26, 2022 22:19 — forked from harveyconnor/a-mongodb-replica-set-docker-compose-readme.md
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@gustavobcx
gustavobcx / disable-plugins-when-doing-local-dev.php
Created September 2, 2021 19:18 — forked from ozh/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@gustavobcx
gustavobcx / sampleREADME.md
Created June 10, 2020 19:58 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@gustavobcx
gustavobcx / Error-Handling-Patterns-Express.md
Created December 30, 2019 04:56 — forked from zcaceres/Error-Handling-Patterns-Express.md
error handling patterns in Express

Handling Errors

Express.js makes it a breeze to handle errors in your routes.

Express lets you centralizes your error-handling through middleware.

Let's look at patterns for how to get the most out of your error-handling.

First, our error-handling middleware looks like this:

@gustavobcx
gustavobcx / letsencrypt_2019.md
Created June 8, 2019 16:08 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@gustavobcx
gustavobcx / nginx-tuning.md
Created June 8, 2019 16:08 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

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.

@gustavobcx
gustavobcx / snakeoil.sh
Created June 8, 2019 16:08 — forked from yyuu/snakeoil.sh
Generate snakeoil SSL certificates on Debian
sudo apt-get install ssl-cert
sudo make-ssl-cert generate-default-snakeoil
sudo usermod --append --groups ssl-cert yyuu
ls -l /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key
@gustavobcx
gustavobcx / Install update WordPress puglins directly.md
Created June 8, 2019 16:08 — forked from dianjuar/Install update WordPress puglins directly.md
Install update WordPress plugins without providing ftp access

Install WordPress plugins directly (without FTP)

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example