Skip to content

Instantly share code, notes, and snippets.

@lawrencepit
lawrencepit / nginx125_msec.patch
Created December 8, 2012 05:10
nginx variables $start_msec and $msec
From 2598ef9407d47eadbb4aaed329f3206082067fa8 Mon Sep 17 00:00:00 2001
From: Lawrence Pit <[email protected]>
Date: Sat, 1 Dec 2012 17:03:22 +1100
Subject: [PATCH] Feature: $start_msec and $msec http variables, useful for
setting in proxy headers before sending request to backend
servers so processing and queue times can be measured.
---
src/http/ngx_http_variables.c | 55 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
@lawrencepit
lawrencepit / nginx139_start_msec.patch
Created December 8, 2012 05:08
nginx variable $start_msec
From c008c94e9c1018b1caa8e8f17db3087fd24d70df Mon Sep 17 00:00:00 2001
From: Lawrence Pit <[email protected]>
Date: Sat, 8 Dec 2012 15:32:17 +1100
Subject: [PATCH] Variable $start_msec.
---
src/http/ngx_http_variables.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
@lawrencepit
lawrencepit / msec.patch
Created December 2, 2012 00:06
[PATCH] nginx stable-1.2 -- Feature: $msec and $start_msec http variables
---
src/http/ngx_http_variables.c | 60 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index b0949c7..9cb1330 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -108,6 +108,10 @@ static ngx_int_t ngx_http_variable_hostname(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
@lawrencepit
lawrencepit / connection_fix.rb
Created January 15, 2012 22:42 — forked from mauricioszabo/connection_fix.rb
MySQL server has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
initialize: =>
@collection.bind('reset', @addAll)
addAll: =>
@collection.each(@addOne)
addOne: (post) =>
view = new Blog.Views.Posts.PostView(model : post)
@$("tbody").append(view.render().el)
initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render')
@options.posts.bind('reset', @addAll)
addAll: () ->
@options.posts.each(@addOne)
addOne: (post) ->
view = new Blog.Views.Posts.PostView({model : post})
@$("tbody").append(view.render().el)
@lawrencepit
lawrencepit / frogger.rb
Created July 13, 2011 06:19 — forked from dougo-chris/frogger.rb
Frogger for rspec
####################################################
# this file belongs in the ./spec/support directory
####################################################
require 'rspec/core/formatters/base_formatter'
class RSpec::Frogger < RSpec::Core::Formatters::BaseFormatter
COLOR_START = "\e[34m" # blue
COLOR_FAILED = "\e[31m" # red
COLOR_PASSED = "\e[32m" # green
~/project$ sudo port upgrade outdated
[...]
Error: Requested variants "" do not match original selection "+universal".
Please use the same variants again, perform 'port clean sqlite3' or specify the force option (-f).
Error: Unable to upgrade port: 1
To report a bug, see <http://guide.macports.org/#project.tickets>
~/project$ sudo port clean sqlite3
Password:
---> Cleaning sqlite3
version:1
:debug:main epoch: in tree: 0 installed: 0
:debug:main readline 6.1.002_0 exists in the ports tree
:debug:main readline 6.1.000_1 +darwin is the latest installed
:debug:main readline 6.1.000_1 +darwin is active
:debug:main Merging existing variants '+darwin' into variants
:debug:main new fully merged portvariants: darwin +
:debug:main Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/readline
:debug:main OS darwin/10.4.0 (Mac OS X 10.6) arch i386
:debug:main org.macports.load registered provides 'load', a pre-existing procedure. Target override will not be provided
ree@api:~/project(master)$ gem uninstall sqlite3-ruby
Select gem to uninstall:
1. sqlite3-ruby-1.3.0
2. sqlite3-ruby-1.3.1
3. All versions
> 3
Successfully uninstalled sqlite3-ruby-1.3.0
Successfully uninstalled sqlite3-ruby-1.3.1