Skip to content

Instantly share code, notes, and snippets.

View kungfumike's full-sized avatar

Mike Thompson kungfumike

View GitHub Profile
@kungfumike
kungfumike / FiveYeardiff.rb
Created April 17, 2015 22:32
I was wandering around a class I wrote five years ago...
# 5 years ago.....
if first.nil?
first_non_nil = compact.first
each_with_index{|val, i|
break if val
self[i] = first_non_nil
}
end
# Forwardfill
@kungfumike
kungfumike / gist:7b767142d07817e19045
Created April 17, 2015 22:30
5 years ago vs today
# 5 years ago.....
if first.nil?
first_non_nil = compact.first
each_with_index{|val, i|
break if val
self[i] = first_non_nil
}
end
# Forwardfill
match name {
"Steve" => "Smithers",
"Samurai" => "Jack",
_ +> {}
}
_,met$$$$$gg. mike@mike-m3800
,g$$$$$$$$$$$$$$$P. OS: Debian testing jessie
,g$$P"" """Y$$.". Kernel: x86_64 Linux 3.14-1-amd64
,$$P' `$$$. Uptime: 33m
',$$P ,ggs. `$$b: Packages: 2779
`d$$' ,$P"' . $$$ Shell: bash 4.3.11
$$P d$' , $$P Resolution: 1920x1200
$$: $$. - ,d$$' DE: Gnome 3.12.1
$$\; Y$b._ _,d$P' WM: GNOME Shell
Y$$. `.`"Y$$$$P"' WM Theme: Adwaita
<?xml version='1.0' encoding='UTF-8' ?>
<pref version='1' name='/'>
<pref name='purple'>
<pref name='away'>
<pref name='idle_reporting' type='string' value='system'/>
<pref name='away_when_idle' type='bool' value='1'/>
<pref name='mins_before_away' type='int' value='5'/>
<pref name='auto_reply' type='string' value='awayidle'/>
</pref>
java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ConfigurableEmbeddedServletContainer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getDeclaredMethods(Class.java:1855)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:402)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:332)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:908)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFac
I am currently in the design phase of a high availability RabbitMQ cluster. Our initial deployment is in a cloud computing environment, and, as such, I have been tasked with determining how RabbitMQ will react to network segmentation (should it occur), and how we we should respond to a network segmentation event. Are there any good resources or documentation for this right now?
At the moment I am setting up a low volume, 3 node cluster with 10 queues. All queues are mirrored to exact 2 (All in this case, but we will add nodes later I am sure). All queues, exchanges and messages are durable.
I have access to a load balancer if I would like to use one.
Any suggestion or references would be great. If none exist, I will start asking more specific scenario questions to attempt to generate a general guideline for everyone.
#!/usr/bin/env ruby
require 'celluloid'
find_val = ARGV[0].to_i
selection_vector = ARGV[1].split(',').map(&:to_i).sort
if selection_vector.length == 1
selection_vector = selection_vector[0].times.collect{|i| rand(10)}
end
puts "Searching for sub sets that sum to #{find_val} within #{selection_vector.inspect}"
mike@ehii:~$ /home/mike/.rubies/rbx-head/bin/rbx
irb(main):001:0> begin; require 'rubygems'; rescue LoadError; end
=> false
irb(main):002:0> puts "export RUBY_ENGINE=#{defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'};"
export RUBY_ENGINE=rbx;
=> nil
irb(main):003:0> puts "export RUBY_VERSION=#{RUBY_VERSION};"
export RUBY_VERSION=2.1.0;
=> nil
irb(main):004:0> puts "export GEM_ROOT=#{Gem.default_dir.inspect};" if defined?(Gem)
mike@ehii:~$ chruby system
mike@ehii:~$ /home/mike/.rubies/rbx-head/bin/rbx -v
rubinius 2.0.0n284 (2.1.0 78f8a2d5 2013-10-11 JI) [x86_64-linux-gnu]
mike@ehii:~$ and /home/mike/.rubies/rbx-head/bin/gem env
-bash: and: command not found
mike@ehii:~$ /home/mike/.rubies/rbx-head/bin/gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.1.5
- RUBY VERSION: 2.1.0 (2013-10-11 patchlevel 0) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /home/mike/.rubies/rbx-head/gems