Skip to content

Instantly share code, notes, and snippets.

View hectoregm's full-sized avatar

Hector E. Gomez Morales hectoregm

View GitHub Profile
@hectoregm
hectoregm / gist:5833865
Created June 21, 2013 19:54
Add an user to Ubuntu Server with sudo privileges
sudo useradd -m -U -s /bin/bash -G admin hectoregm
@hectoregm
hectoregm / gist:4132472
Created November 22, 2012 18:24 — forked from cluePrints/gist:2521535
Installing Rails @ Amazon Linux

Steps

  • Build tools:

      sudo yum groupinstall "Development Tools"
    
  • Dependencies:

      yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel \
    

libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel

@hectoregm
hectoregm / 01. Gemfile
Created November 7, 2012 13:30 — forked from schleg/01. Gemfile
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@hectoregm
hectoregm / gist:3881407
Created October 12, 2012 20:47 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@hectoregm
hectoregm / ruby_gc.sh
Created September 9, 2012 03:20 — forked from mikhailov/ruby_gc.sh
Ruby’s GC Configuration
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@hectoregm
hectoregm / nginx.conf
Created September 8, 2012 20:01 — forked from thewebfellas/nginx.conf
sample nginx.conf for thin
user nginx;
worker_processes 5;
error_log /var/log/nginx.error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@hectoregm
hectoregm / ruby_gc.sh
Created September 5, 2012 05:25 — forked from mikhailov/ruby_gc.sh
Ruby’s GC Configuration
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
@hectoregm
hectoregm / 1-view-events.js
Created February 25, 2012 01:09 — forked from mxriverlynn/1-view-events.js
zombies! run!
MyView = Backbone.View.extend({
events: {
"click #someButton": "doThat",
"change #someInput": "changeIt"
},
doThat: function(){ ... },
changeIt: function(){ ... }
});
@hectoregm
hectoregm / ruby_debug_pow.markdown
Created February 9, 2012 04:48 — forked from alexagui/ruby_debug_pow.markdown
How to Ruby Debug with Pow

How to Ruby Debug with Pow

Below are steps I followed to get ruby debugger ruby-debug running with Pow. Based on info from this thread basecamp/pow#43 and this blog post http://flochip.com/2011/04/13/running-pow-with-rdebug/

1) Update your Gemfile

Assuming you're writing your app in Ruby 1.9 and using Bundler, just add the dependency to your development gems:

@hectoregm
hectoregm / gist:1401897
Created November 28, 2011 20:30
Regexp, Ruby and You

Regular Expressions: The Good Parts (Ruby Edition)

Introduction

So what are regular expressions?, Wikipedia has a nice [definition][1]:

Regular expressions provides a concise and flexible means for "matching" (specifying and recognizing) strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp".