Skip to content

Instantly share code, notes, and snippets.

View adrianorsouza's full-sized avatar
🏠
Working from home

Adriano Rosa adrianorsouza

🏠
Working from home
View GitHub Profile
@adrianorsouza
adrianorsouza / laravel_path_permissions.sh
Last active November 25, 2023 23:53
Laravel storage path permissions. This script makes storage path writable for both users, the admin and PHP Webserver user
#!/bin/bash
#
# DEFINE PROPER WRITABLE PERMISSIONS FOR LARAVEL PROJECT.
# Run this script in a fresh Laravel install.
#
# @author Adriano Rosa (https://adrianorosa.com)
# @created: 2015-02-15 00:59:19
# @updated: 2021-01-28 14:19:16
# @updated: 2023-11-25 20:53:36
#
@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active September 26, 2023 16:26
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@adrianorsouza
adrianorsouza / NGINX-CORS+CSP.conf
Last active September 18, 2023 08:09
Nginx CORS and CSP configuration for wildcard origin domains
server {
...
add_header Content-Security-Policy "default-src 'none'";
add_header X-Content-Security-Policy "default-src 'none'";
add_header X-WebKit-CSP "default-src 'none'";
add_header "Access-Control-Allow-Headers" "X-Requested-With";
if ( $http_origin ~* (https?://(.+\.)?(domain1|domain2|domain3)\.(?:me|co|com)$) ) {
@adrianorsouza
adrianorsouza / mkselfssl.sh
Last active September 1, 2023 10:34
Script to create a new self-signed SSL Certificate for Nginx
#!/bin/bash
# @author Adriano Rosa (http://adrianorosa.com)
# @date: 2014-05-13 09:43
#
# Bash Script to create a new self-signed SSL Certificate
# At the end of creating a new Certificate this script will output a few lines
# to be copied and placed into NGINX site conf
#
# USAGE: this command will ask for the certificate name and number in days it will expire
@adrianorsouza
adrianorsouza / ico-gen.php
Created November 8, 2019 20:49
PHP Icon Favicon.ico Generator
<?php
/*
Copyright 2011-2013 Chris Jean & iThemes
Licensed under GPLv2 or above
Version 1.0.2
*/
class PHP_ICO {
/**
* Images in the BMP format.
*
@adrianorsouza
adrianorsouza / issue-csr.md
Last active June 8, 2022 23:29
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 domain.key -out domain.csr

CHECK CERTIFICATE COMMAND

$ 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

@adrianorsouza
adrianorsouza / docker-help.md
Created March 19, 2021 23:43 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@adrianorsouza
adrianorsouza / gist:5d4a7d210bd659920e8e5b1448b7f343
Created December 2, 2021 23:37 — forked from rmatil/gist:8d21620c11039a442964
Connect MySQL database in Vagrant VM from Host machine

Connecting to Vagrant VM MySQL database from host

This gist shows how to connect to your vagrant MySQL database from the host machine.

Change Address Binding from MySQL

  • Connect to vagrant using vagrant ssh
  • Edit file /etc/mysql/my.cnf:
    • Change parameter bind-address to 0.0.0.0 to allow all incoming connection attempts
@adrianorsouza
adrianorsouza / git.post-update.sample
Last active July 29, 2020 01:29
Laravel production script that run after git post-update hooks
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
echo "--initializing @@SITE_NAME@@ hook--"
git --git-dir @@GIT_DIR@@/.git --work-tree @@GIT_DIR@@ pull @@GIT_REMOTE_NAME@@ @@GIT_BRANCH_NAME@@
@adrianorsouza
adrianorsouza / release.sh
Last active July 24, 2020 22:11
Script that makes it easier to automate the make a release of a project using git and annotated tag
#!/usr/bin/env bash
#
# Script to make a new release of this project.
#
# @author Adriano Rosa <https://adrianorosa.com>
# @date: 2020-07-24 14:47
# @link: https://gist.github.com/adrianorsouza/d970eecefa5c9c5db714d439587d1da6
#
# This bash script is a simple version of the npm package:
# `release-task` https://github.com/adrianorsouza/release-task.