Skip to content

Instantly share code, notes, and snippets.

View rrodrigu3z's full-sized avatar

Ricardo David Rodríguez rrodrigu3z

  • Sunlight
  • Santiago, Chile
View GitHub Profile
# coding:utf-8
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'rubygems'
require 'active_record'
require 'em-mysqlplus'
require 'em-synchrony'
require 'em-activerecord'
db_config = YAML.load_file(File.join(File.dirname(__FILE__), 'config', 'database.yml'))
module ActiveRecord
module ConnectionAdapters
class FiberedMonitor
class Queue
def wait(timeout)
t = timeout || 5
fiber = Fiber.current
x = EM::Timer.new(t) do
@queue.delete(fiber)
fiber.resume(false)
@rrodrigu3z
rrodrigu3z / gist:788033
Created January 20, 2011 15:09
duda - cascade
# En el environment.rb
# Asumo esto basado en que mencionas que no usas pluralización
ActiveRecord::Base.pluralize_table_names = false
# migration para personas
class CreatePersonas < ActiveRecord::Migration
def self.up
create_table :personas, :force => true do |t|
t.string :nombre
t.integer :hogar_id # Plural o singular?
@rrodrigu3z
rrodrigu3z / iptables_redirect_http.sh
Created February 23, 2011 20:04
Hack para enrutar los requests tcp a un Squid Proxy que esta en otro host
#!/bin/bash
iptables -t nat --flush
iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
echo 1 > /proc/sys/net/ipv4/ip_forward
Installing Phusion Passenger Standalone...
[******************************** ] Preparing Nginx... \
checking for OS
+ Linux 2.4.21-20.EL i686
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 3.2.3 20030502 (Red Hat Linux 3.2.3-42)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... not found
checking for C99 variadic macros ... found
Installing Phusion Passenger Standalone...
[******************************** ] Preparing Nginx... \
checking for OS
+ Linux 2.4.21-20.EL i686
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 3.2.3 20030502 (Red Hat Linux 3.2.3-42)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... not found
checking for C99 variadic macros ... found
Installing Phusion Passenger Standalone...
[******************************** ] Preparing Nginx... -
checking for OS
+ Linux 2.4.21-20.EL i686
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 3.2.3 20030502 (Red Hat Linux 3.2.3-42)
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... not found
checking for C99 variadic macros ... found
objs/ngx_modules.o \
-lcrypt -lm /var/lib/passenger-standalone/3.0.5-x86-ruby1.8.7-linux-3.2.3/support/ext/nginx/../common/libpassenger_common.a /var/lib/passenger-standalone/3.0.5-x86-ruby1.8.7-linux-3.2.3/support/ext/nginx/../common/libboost_oxt.a -lstdc++ -lpthread -lcrypto -lz
objs/src/os/unix/ngx_process.o(.text+0xa60): In function `ngx_process_get_status':
: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
objs/src/os/unix/ngx_process.o(.text+0xa54): In function `ngx_process_get_status':
: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
/var/lib/passenger-standalone/3.0.5-x86-ruby1.8.7-linux-3.2.3/support/ext/nginx/../common/libpassenger_common.a(aggregate.o)(.gnu.linkonce.t._ZNSt23_Rb_tree_const_iteratorISt4pairIKSsSsEEppEi+0x1e): In function `std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::operator++(int)':
ext/common/FileD
Could not start Passenger Nginx core:
[alert]: could not open error log file: open()
"/tmp/passenger-standalone.8865/logs/error.log" failed (2: No such file or
directory)
[alert]: Unable to start the Phusion Passenger watchdog because it encountered
the following error during startup: Unable to start the Phusion Passenger helper
agent: it seems to have crashed during startup for an unknown reason, with exit
code 1 (-1: Unknown error 4294967295)
Stopping web server... done
@rrodrigu3z
rrodrigu3z / rake test:cxx
Created March 29, 2011 21:43
Passenger c++ test errors
ApplicationPool_PoolTest: ...........[12=X][13=X][15=X][16=X][17=X][18=X][19=X]......[26=X]..........[37=X]
ApplicationPool_ServerTest: ............
ApplicationPool_Server_PoolTest: ...........[12=X][13=X][15=X][16=X][17=X][18=X][19=X]......[26=X]..........[37=X]
Base64Test: ..
BufferedIOTest: ....................[30=F][31=F]
CachedFileStatTest: ............
EventedClientTest: .....................
FileChangeCheckerTest: ..................
FileDescriptorTest: ...
FilterSupportTest: ..............................