Skip to content

Instantly share code, notes, and snippets.

View alvarovillafane's full-sized avatar

Alvaro VM alvarovillafane

View GitHub Profile
@alvarovillafane
alvarovillafane / gist:817dcd46066eac4d551a613083e1e353
Created August 4, 2020 02:32 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@alvarovillafane
alvarovillafane / .git-commit-template
Created December 6, 2019 03:21 — forked from zakkak/.git-commit-template
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@alvarovillafane
alvarovillafane / awc-ecs-access-to-aws-efs.md
Created August 29, 2019 06:45 — forked from duluca/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide:

@alvarovillafane
alvarovillafane / solution1.rb
Created March 28, 2019 04:39
How to add or overwrite methods from engine controllers or models in the app that uses the engine.
# This simple solution open-classes the controller/model in the main app
# to add or overwrite methods.
# A drawback of this solution is that you won't be able to access the original
# method by using +super+.
# engine: app/controllers/myengine/my_controller.rb
# This is the controller in our engine with a index method defined.
module MyEngine
class MyController < ApplicationController
def index
@alvarovillafane
alvarovillafane / composer.json
Last active June 4, 2018 01:43
Wordpress Composer Initial Install
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "wp-sync-db/wp-sync-db",
"type": "wordpress-plugin",
@alvarovillafane
alvarovillafane / authsources.php
Last active July 12, 2017 03:29
SimpleSamlPHP authsources.php
<?php
$config = array(
// This is a authentication source which handles admin authentication.
'admin' => array(
// The default is to use core:AdminPassword, but it can be replaced with
// any authentication source.
'core:AdminPassword',
@alvarovillafane
alvarovillafane / config.php
Created July 12, 2017 03:19
SimpleSaml config file
<?php
/*
* The configuration of SimpleSAMLphp
*
*/
$config = array(
/**
* Setup the following parameters to match the directory of your installation.
@alvarovillafane
alvarovillafane / mamp.md
Created June 28, 2017 12:04 — forked from jfloff/mamp.md
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you:

@alvarovillafane
alvarovillafane / gist:2cca195dd50e501fe2341d1ad310aeb1
Created November 18, 2016 04:49 — forked from alotaiba/gist:913313
Using rsync to sync files to an Amazon EC2 instance using SSH key
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder
@alvarovillafane
alvarovillafane / Widget Example+Specific Plugin
Created May 3, 2014 00:58
Wordpress Widget Example + Site-Specific Plugin
<?php
/*
Plugin Name: AVM Plugin
Description: Site specific code changes for AVM plugin
*/
// Additing Action hook widgets_init
add_action( 'widgets_init', 'avm_widget');
function avm_widget() {