Skip to content

Instantly share code, notes, and snippets.

View matthewd's full-sized avatar

Matthew Draper matthewd

View GitHub Profile
require 'strscan'
class Keylog
def convert(input)
output = ""
scan(input) {|s| output << s }
output
end
def count_keys(input)
keys = 0
require 'keylog'
keylog = "qqY2pdfrct,Take one down and pass it around\e\x18$Po\ej\x18w\x18q81@qdkcf0Go to the store and buy some more, 99\ekex?s\rxnxZZ"
p keylog
vimmish = Keylog.new.convert(keylog)
p vimmish
tango:src/rbx[daedalus]% ./configure
Configuring LLVM...
Checking for existing LLVM tree: found!
Checking sizeof(long): 8 bytes
Checking platform endianness: little endian
Checking tr1/hash definition: found
Checking for function 'backtrace': found!
Checking for function 'readline': found!
Checking curses library: curses
Failed to match sequence (SP? SOURCE_ELEMENTS SP?) at line 1 char 1.
`- Failed to match sequence (SP? SOURCE_ELEMENTS SP?) at line 1 char 1.
`- Failed to match sequence (SOURCE_ELEMENT (SP? SOURCE_ELEMENT){0, }) at line 1 char 1.
`- Expected one of [FUNCTION_DECLARATION, STATEMENT]. at line 1 char 1.
|- Failed to match sequence ('function' SP IDENT SP? '(' SP? (FORMAL_PARAMETER_LIST SP?)? ')' SP? '{' SP? FUNCTION_BODY SP? '}') at line 1 char 1.
| `- Expected "function", but got "var x = " at line 1 char 1.
`- Expected one of [BLOCK, VARIABLE_STATEMENT, CONST_STATEMENT, EMPTY_STATEMENT, EXPR_STATEMENT, IF_STATEMENT, ITERATION_STATEMENT, CONTINUE_STATEMENT, BREAK_STATEMENT, RETURN_STATEMENT, WITH_STATEMENT, SWITCH_STATEMENT, LABELLED_STATEMENT, THROW_STATEMENT, TRY_STATEMENT]. at line 1 char 1.
|- Failed to match sequence ('{' SP? SOURCE_ELEMENTS SP? '}') at line 1 char 1.
| `- Expected "{", but got "v" at line 1 char 1.
|- Failed to matc
bin/mspec ci --background --agent
rubinius 1.3.0dev (1.8.7 d118774d xxxx-xx-xx JI) [x86_64-unknown-linux-gnu]
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
From e69827d6fbfa919387fbc0dbb15ba5079d2ea947 Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Tue, 25 Jan 2011 10:47:02 +1030
Subject: [PATCH] Search backwards rather than forwards.
Most of the time, we're looking at values around the end of what we've
parsed.
---
lib/parslet/source.rb | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
From a93dc9af9c6ebba6d375aed61ca0ee67f75d14b2 Mon Sep 17 00:00:00 2001
From: Matthew Draper <matthew@trebex.net>
Date: Wed, 26 Jan 2011 15:39:24 +1030
Subject: [PATCH] Remove Success/Fail structs
---
lib/parslet/atoms/alternative.rb | 2 +-
lib/parslet/atoms/base.rb | 30 +++++-------------------------
lib/parslet/atoms/lookahead.rb | 2 +-
lib/parslet/atoms/named.rb | 9 +++++----
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
new file mode 100644
index ce3b77b..be71fbb
*** a/src/backend/executor/functions.c
--- b/src/backend/executor/functions.c
*************** typedef SQLFunctionCache *SQLFunctionCac
*** 116,122 ****
--- 116,124 ----
*/
typedef struct SQLFunctionParseInfo
#!/usr/bin/env ruby
lib_path = File.expand_path("../../lib", __FILE__)
$:.unshift lib_path
require 'uri'
require 'net/http'
require 'optparse'
diff --git a/lib/kpeg/code_generator.rb b/lib/kpeg/code_generator.rb
index 55376d6..bcdddcd 100644
--- a/lib/kpeg/code_generator.rb
+++ b/lib/kpeg/code_generator.rb
@@ -263,7 +263,11 @@ module KPeg
code << indentify("_tmp = _tmp ? nil : true\n", indent)
code << indentify("self.pos = #{ss}\n", indent)
when RuleReference
- code << indentify("_tmp = apply(:#{method_name op.rule_name})\n", indent)
+ if op.arguments