Skip to content

Instantly share code, notes, and snippets.

View fernandoaleman's full-sized avatar

Fernando Aleman fernandoaleman

View GitHub Profile

Keybase proof

I hereby claim:

  • I am fernandoaleman on github.
  • I am fernandoaleman (https://keybase.io/fernandoaleman) on keybase.
  • I have a public key ASAvmS_mMPd7J7hcMXaB0I-OHP_3ZuuAuOcFsRgyJSPQjQo

To claim this, I am signing this object:

@fernandoaleman
fernandoaleman / rbenv-1.8.7-openssl.patch
Created June 5, 2014 20:41
Patch to solve error when installing ruby 1.8.7 with rbenv or ruby_build and openssl 1.0.1x
--- ext/openssl/ossl_pkey_ec.c
+++ ext/openssl/ossl_pkey_ec.c
@@ -757,8 +757,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSl_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
@fernandoaleman
fernandoaleman / chefspec-invalid-data-bag-path-error.md
Last active February 28, 2021 21:22
chefspec invalid data bag path

Problem

Using chef_vault_item in a recipe and testing via ChefSpec returns the following error:

Chef::Exceptions::InvalidDataBagPath:
       Data bag path '/var/folders/5d/46p9wf6976l9xptq3fwsrj9r0000gp/T/d20210228-64571-1lao3dr/data_bags' not found. Please create this directory.

Solution

@fernandoaleman
fernandoaleman / INSTALL.txt
Last active April 14, 2021 09:54
Shell script to sync remote branches from upstream and push them up to forked origin
1. Copy 'git-sync-fork' script code from gist
2. Create a file called 'git-sync-fork' in any 'bin' directory in your $PATH
3. Paste script into this new file 'git-sync-fork' and save
4. Make the file executable `chmod +x git-sync-fork`
5. Run the script inside your locally forked git repo
Example:
git-sync-fork upstream origin

MySQL Master-Slave Replication on CentOS 7

Install and configure MySQL with master-slave replication. The benefits of this include high availability, backups, disaster recovery and reporting.

For tutorial purposes, we will be using one master node and one slave node.

Master Node: 10.0.0.10
Slave Node:  10.0.0.11
@fernandoaleman
fernandoaleman / ssh_keys_authentication.sh
Created October 3, 2011 20:45
How to install SSH Keys for authentication without password
# Create ssh private and public keys on your local machine
ssh-keygen -t rsa
# Set permissions on your private key
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
# Copy the public key to the server
scp ~/.ssh/id_rsa.pub root@yourserver.com:~/.ssh/authorized_keys
@fernandoaleman
fernandoaleman / chef-cookstyle-delivery-error.md
Created February 8, 2022 21:58
Chef cookstyle delivery error

Problem

When running cookstyle locally on a Mac, you get the error:

Offenses:

metadata.rb:1:1: W: Chef/Deprecations/Delivery: Do not include a .delivery directory for the delivery command in your cookbooks. Chef Delivery (Workflow) went EOL Dec 31st 2021 and the delivery command was removed from Chef Workstation Feb 2022. (https://docs.chef.io/workstation/cookstyle/chef_deprecations_delivery)
@fernandoaleman
fernandoaleman / auto-install-ruby-with-rbenv.zsh
Last active February 21, 2022 06:38
Auto install ruby with rbenv
# This snippet checks your current directory for a .ruby-version file
# and if it exists, it then checks to see if that version of ruby is
# installed. If not, it will ask you if you want to install it.
#
# Add this snippet to $HOME/.zshrc
# In zsh, the chpwd will run a command every time you change directories.
function chpwd {
# Check if a .ruby-version file exists
if [[ -f "$PWD/.ruby-version" ]]; then
@fernandoaleman
fernandoaleman / apache-503-proxy.md
Last active April 16, 2022 21:04
Solving Apache 503 “Service temporarily unavailable” proxy timed out

Error

[Tue Jun 03 22:05:51 2014] [error] (110)Connection timed out: proxy: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed
[Tue Jun 03 22:05:51 2014] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Tue Jun 03 22:05:52 2014] [error] proxy: HTTP: disabled connection for (127.0.0.1)
[...]

The problem is that the Apache proxy module, recognising that the service was unavailable, stopped redirecting requests to it for one minute.

@fernandoaleman
fernandoaleman / rpm-from-source.sh
Created November 18, 2011 16:34
How to create an RPM from source with spec file
# How to create an RPM from source with spec file
# This is for Redhat versions of linux. Sometimes when you search for an rpm package,
# it is either outdated or not available. The only thing available is the source code.
# You can create a custom RPM package from source.
#
# For this example, I'll be using the latest version of Git, currently v.1.7.7.3
# Step: 1
# Install rpmbuild