Skip to content

Instantly share code, notes, and snippets.

View mikepea's full-sized avatar

Mike Pountney mikepea

View GitHub Profile
@mikepea
mikepea / graphite-calc.rb
Last active August 29, 2015 14:05
Graphite whisper file sizing calculator
#!/usr/bin/env ruby
#
# eg: graphite-calc.rb 10s:10d,5m:400d,24h:20y 20
# to calculate sizing for 20 hosts, 1000 metrics per host, 10s metric update interval
#
graphite_policy = ARGV.shift
num_hosts = ARGV.shift || 1
num_metrics = ARGV.shift || 1000
update_interval = ARGV.shift || 10
@mikepea
mikepea / gist:8491609
Last active January 3, 2016 16:49
Setting up a Raspberry Pi for headless Arduino fun
sudo apt-get install arduino-core arduino-mk
sudo apt-get install screen
sudo apt-get install git
cd /usr/share/arduino/libraries
sudo git clone https://github.com/adafruit/Adafruit_NeoPixel.git
@mikepea
mikepea / gist:637418
Created October 20, 2010 22:01
beginnings of NEC IR code
void send_38khz_pulse(void) {
PORTB ^= irOut;
PORTB ^= redMask;
delay_x_us(26); // 17 works
}
void send_38khz_space(void) {
PORTB ^= bogusMask;
PORTB ^= bogusMask;
delay_x_us(26); // 17 works
diff --git a/lib/mcollective/util.rb b/lib/mcollective/util.rb
index abd5791..6870709 100644
--- a/lib/mcollective/util.rb
+++ b/lib/mcollective/util.rb
@@ -55,10 +55,19 @@ module MCollective
# If the passed value starts with a / it's assumed to be regex
# and will use regex to match
def self.has_fact?(fact, value)
- value = Regexp.new(value.gsub("\/", "")) if value.match("^/")
-