Skip to content

Instantly share code, notes, and snippets.

View fernandoaleman's full-sized avatar

Fernando Aleman fernandoaleman

View GitHub Profile
@fernandoaleman
fernandoaleman / how-to-resize-amazon-ebs-drive
Created June 27, 2014 17:32
How to resize Amazon EBS drive
# Check the name of the volume
fdisk -l
# Should look like this:
# Disk /dev/xvde: 214.7 GB, 214748364800 bytes
# Resize the volume
resize2fs /dev/xvde
@fernandoaleman
fernandoaleman / getversion
Created October 16, 2011 04:23
Show Mac OS Version
#!/usr/bin/ruby
module Tty extend self
def blue; bold 34; end
def white; bold 39; end
def red; underline 31; end
def reset; escape 0; end
def bold n; escape "1;#{n}" end
def underline n; escape "4;#{n}" end
def escape n; "\033[#{n}m" if STDOUT.tty? end
@fernandoaleman
fernandoaleman / Gemfile
Created May 8, 2012 16:22 — forked from simi/Gemfile
Refinery + Twitter Bootstrap WIP
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@fernandoaleman
fernandoaleman / gist:4551494
Created January 16, 2013 22:21
How to recursively delete Amazon S3 zero byte files from buckets
s3cmd ls --recursive s3://BUCKET_NAME | ruby -rdate -ne 'date, time, size, uri = $_.split; puts uri if size == "0"' | xargs s3cmd del

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

# Command to replace php memory limit in php.ini with env var
sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php5/php.ini
@fernandoaleman
fernandoaleman / rbenv-openssl.patch
Created June 17, 2014 15:47
Patch to solve error when installing ruby 1.8.7 or 1.9.2 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 / homebrew-elasticsearch-1.0.2.rb
Created July 21, 2017 15:43
Homebrew Elasticsearch 1.0.2 Formula
require 'formula'
class Elasticsearch < Formula
homepage 'http://www.elasticsearch.org'
url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.2.tar.gz'
sha256 '2fc2cd05e5f301ba972c9bf90232b70592568990f526f2634b3a768c4615ad70'
head do
url 'https://github.com/elasticsearch/elasticsearch.git'
depends_on 'maven'
@fernandoaleman
fernandoaleman / rabbitmq-cluster.sh
Created February 27, 2018 16:30
Create RabbitMQ cluster
#!/bin/bash
set -e
function getHostname()
{
local HOST=''
while test -z "$HOST"
do
read -p "$1 : " HOST
@fernandoaleman
fernandoaleman / converting-mysql-database-contents-to-utf8
Created August 14, 2014 20:08
Converting MySQL Database Contents to UTF-8
# First create a dump of your MySQL database
mysqldump -u [user] -p database_name > database_name.sql
# Convert the data
iconv -f iso-8859-15 -t utf8 database_name.sql > database_name_iconv.sql
# Import the database
mysql -u [user] -p database_name < database_name_iconv.sql
# If you still have some specific characters that do not display