a new messaging-based log aggregator
a distributed messaging system
horizontally scalable messaging system.
Memory Mapped Files
Kernel Space processing
| require 'set' | |
| class Set | |
| def power_set | |
| make_permutation = proc { |n| self.to_a.permutation(n).to_a.map(&:to_set).to_set} | |
| Set.new([Set.new([]),(1..self.size).map(&make_permutation)]) | |
| end | |
| end | |
| Set.new([1,2,3]).power_set |
| def traverse instance | |
| attributes = instance.attributes | |
| klass = instance.class | |
| associations = klass.reflect_on_all_associations | |
| return attributes unless associations | |
| associations.map(&:name).each do |key| | |
| result = instance.send key |
| import subprocess | |
| import sublime, sublime_plugin | |
| import re | |
| class EvalAsRuby: | |
| # Method to run Ruby from the shell | |
| def ruby(self): | |
| try: | |
| # Example: | |
| # "sno_phort": |
| # YADTTMCG | |
| ## Yet another Donald Trump Tweet Markov Chain Generator | |
| require 'sinatra' | |
| require 'open-uri' | |
| require 'nokogiri' | |
| def next_word ary | |
| ary[rand(ary.length).to_i][1] | |
| end |
| # == YADTQMCG | |
| ## Yet another Donald Trump Quote Markov Chain Generator | |
| # Markov algorithm forked from | |
| # https://gist.github.com/michaelfeathers/2cf9e1599e06d0563f2e | |
| file = ARGF.read.split | |
| pseudo_stems = file.each_cons(4).to_a.shuffle | |
| pseudo_stems << file.each_cons(3).to_a.shuffle | |
| pseudo_stems << file.each_cons(5).to_a.shuffle | |
| pseudo_stems << file.each_cons(6).to_a.shuffle |
| module LISPO | |
| module ArrayCallable | |
| refine Array do | |
| def call | |
| inject &shift | |
| end | |
| end | |
| end | |
| class Parser |
| # Replace Keys K of a Hash H with Keys K' | |
| # Where L is an unordered superset of K with possible duplicates | |
| hash = { 'foo-1' => { data: 102 } , 'bar-1' => { data: 109 } , 'baz-1' => { data: 12 } } | |
| array = ['bar-2', 'foo-2', 'baz-2', 'fab-3', 'gib-2', 'gib-2', 'yup-3'] | |
| compare = -> o { o[0][/\w+/] != o[1][/\w+/] } | |
| key_map = array.zip(hash.keys.cycle).flatten.sort.each_slice(2).to_a.reject(&compare).to_h | |
| apply_new_key = -> k, v { [key_map[k], v] } | |
| hash.map(&apply_new_key).to_h |
| Node = Struct.new(:left, :right) | |
| Tree = Node.new( | |
| Node.new( | |
| Node.new( | |
| 0, | |
| 1 | |
| ), | |
| Node.new( | |
| 2, | |
| 3 |
| [ | |
| { "keys": ["super+shift+c"], "command": "rubo_fix"}, | |
| { "keys": ["super+k", "super+d"], "command": "rubo_fix" } | |
| ] |