Skip to content

Instantly share code, notes, and snippets.

Working from home

Adriano Rosa adrianorsouza

Working from home
Block or report user

Report or block adrianorsouza

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
adrianorsouza /
Last active Jan 12, 2020
Fix PHP 7.4 + MySQL 8 errors with server has gone away

Fix PHP 7.4 + MySQL 8 errors with server has gone away

PHP 7.4 is now released, and it comes with support for MySQL 8's new password authentication plugin: caching_sha2_password.

1. Connect to the database as root

Depending on your root username, you will be prompted to enter the password, a hostname, etc. By default, typing mysql in your server terminal should work. If you have trouble logging in, try mysql -p -u root, and entering the root password when asked.

2. Check existing authentication plugin:

Replace USERNAME and YOUR_PASSWORD with your application database username and the password.


MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

adrianorsouza / indeterminate.js
Last active Nov 13, 2019
react checkbox indeterminate
View indeterminate.js
// To add the indeterminate property to the checkbox, I needed to take advantage of the ref attribute:
const { value, checked, indeterminate } = this.props
return render(
adrianorsouza / ico-gen.php
Created Nov 8, 2019
PHP Icon Favicon.ico Generator
View ico-gen.php
Copyright 2011-2013 Chris Jean & iThemes
Licensed under GPLv2 or above
Version 1.0.2
class PHP_ICO {
* Images in the BMP format.
View favicon.html
<!-- -->
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01//EN"
<html lang="en-US">
<head profile="">
<link rel="icon"
adrianorsouza / webpack.config.js
Created Aug 28, 2019
Full Webpack configuration for Laravel, ReactJS and Bootstrap + LiveServer.
View webpack.config.js
const fs = require('fs');
const os = require('os');
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const postcssNormalize = require('postcss-normalize');
adrianorsouza / connect.js
Created Jul 23, 2019 — forked from gaearon/connect.js
connect.js explained
View connect.js
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
adrianorsouza / nginx.conf
Created Aug 2, 2018 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
View nginx.conf
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate:
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
adrianorsouza /
Created Mar 4, 2017
Generate icns from iconset
mkdir icon.iconset
sips -z 16 16 icon1024.png --out icon.iconset/icon_16x16.png
sips -z 32 32 icon1024.png --out icon.iconset/icon_16x16@2x.png
sips -z 32 32 icon1024.png --out icon.iconset/icon_32x32.png
sips -z 64 64 icon1024.png --out icon.iconset/icon_32x32@2x.png
sips -z 128 128 icon1024.png --out icon.iconset/icon_128x128.png
sips -z 256 256 icon1024.png --out icon.iconset/icon_128x128@2x.png
sips -z 256 256 icon1024.png --out icon.iconset/icon_256x256.png
sips -z 512 512 icon1024.png --out icon.iconset/icon_256x256@2x.png
sips -z 512 512 icon1024.png --out icon.iconset/icon_512x512.png
adrianorsouza /
Created Feb 26, 2017
Generate new CSR (Certificate Signed Request) to get a new certificate issued from a CA.

Issue CSR

$ openssl req -new -newkey rsa:2048 -nodes -keyout twixar.key -out twixar.csr


$ openssl x509 -noout -modulus -in domain.crt | openssl md5
$ openssl rsa -noout -modulus -in domain.key | openssl md5
$ openssl req -noout -modulus -in domain.csr | openssl md5
You can’t perform that action at this time.