Skip to content

Instantly share code, notes, and snippets.

View josevalim's full-sized avatar

José Valim josevalim

View GitHub Profile
## Enable kernel poll and a few async threads
+K true
+A 5
+Q 64000
+P 128000
+sbt db
+sbwt very_long
+swt very_low
+sub true
+Mulmbcs 32767
@nox
nox / prealloc_bin.S
Created April 10, 2013 23:49
Preallocated binaries in Erlang... well, in BEAM.
{module, prealloc_bin}. %% version = 0
{exports, [{module_info,0},{module_info,1},{new,1}]}.
{attributes, []}.
{labels, 7}.
{function, new, 1, 2}.
@raggi
raggi / escape_like.rb
Created September 27, 2011 21:31
YOU WON'T (escape likes)
module EscapeLike
# Escape SQL LIKE arguments. N.B. This should be combined with use of the
# ESCAPE parameter also. See:
# http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html
#
# pattern = escape_like(params[:pattern]) << '%'
# query = where(["name LIKE ? ESCAPE ?", pattern, '\\'])
#
# By default this method uses MySQLs default escape, backslash.
# Unfortunately, this can get exceedingly confusing in output. As soon as