Skip to content

Instantly share code, notes, and snippets.

@oholiab
oholiab / gist:2987501
Created June 25, 2012 09:01
reqid stat
def req(body, agent=nil, options=false, waitfor=0)
if body.is_a?(Message)
agent = body.agent
options = body.options
waitfor = body.discovered_hosts.size || 0
end
stat = {:starttime => Time.now.to_f, :discoverytime => 0, :blocktime => 0, :totaltime => 0}
options = @options unless options
@oholiab
oholiab / mcollective.log
Created July 3, 2012 11:16
Debug for non-replying mcollective node to mco-ping
D, [2012-07-03T12:11:05.376324 #24022] DEBUG -- : runnerstats.rb:42:in `received' Incrementing total stat
D, [2012-07-03T12:11:05.376573 #24022] DEBUG -- : runnerstats.rb:31:in `validated' Incrementing validated stat
D, [2012-07-03T12:11:05.376725 #24022] DEBUG -- : base.rb:117:in `validate_filter?' Message failed the filter checks
D, [2012-07-03T12:11:05.376822 #24022] DEBUG -- : runnerstats.rb:25:in `filtered' Incrementing filtered stat
D, [2012-07-03T12:11:05.376944 #24022] DEBUG -- : runner.rb:88:in `run' Message does not pass filters, ignoring
D, [2012-07-03T12:11:05.377052 #24022] DEBUG -- : stomp.rb:134:in `receive' Waiting for a message from Stomp
@oholiab
oholiab / Animate.java
Created July 4, 2012 14:53
Pixelate your animated sprites with Slick 2D
image = sheet.getSprite(frame, 0);
image.setFilter(Image.FILTER_NEAREST);
animate.addFrame(image.getScaledCopy(3), length);
@oholiab
oholiab / gist:5502380
Created May 2, 2013 14:00
memcached package version pinning that is not working
bundle agent memcached_package{
packages:
"memcached"
package_policy => "addupdate",
package_select => "==",
package_version => "1.4.14",
package_method => apt,
package_architectures => { "x86_64" };
}
@oholiab
oholiab / gist:5553646
Created May 10, 2013 10:36
Gosu window
// All of Gosu.
#include <Gosu/Gosu.hpp>
// To safely include std::tr1::shared_ptr
#include <Gosu/TR1.hpp>
// Makes life easier for Windows users compiling this.
#include <Gosu/AutoLink.hpp>
class GameWindow : public Gosu::Window
{
public:
@oholiab
oholiab / gist:5831947
Created June 21, 2013 15:23
Links fo' stuff
http://www.7digital.com
http://www.7digital.com/artist/pallbearer/release/sorrow-and-extinction/?src=live-search
http://i2.ytimg.com/vi/iJwFzZVuVUU/maxresdefault.jpg
http://www.7digital.com/artist/limp-bizkit/release/significant-other-3/?src=live-search
http://www.7digital.com/artist/immortal/release/diabolical-fullmoon-mysticism
https://www.youtube.com/watch?v=H2rJrB2pHtY
@oholiab
oholiab / gist:5967334
Created July 10, 2013 15:35
Fumblings to do svd plots of dtm information from RSS feeds
install.packages(c("RTextTools","topicmodels","twitterR"))
library("XML")
doc <- xmlTreeParse("http://feeds.bbci.co.uk/news/rss.xml")
doc
xpathApply(xmlRoot(doc), "description")
xpathApply(xmlRoot(doc), "//description")
src <- xpathApply(xmlRoot(doc), "//description")
src
src[1]
xmlSApply(src[1], xmlValue)
@oholiab
oholiab / gist:6064008
Created July 23, 2013 16:48
Recursively adding the digits of a multiple of 3 until there is only one digit left and it is one of 3, 6 or 9 shows that it is a multiple of 3 as shown in this script that compares it to the modulo method
#!/usr/bin/ruby
i=0
while(i<300)
puts "mod: #{i}" if i % 3 == 0
string = i.to_s
while string.length > 1
total = 0
string.split('').each {|x| total += x.to_i}
string = total.to_s
end

Keybase proof

I hereby claim:

  • I am oholiab on github.
  • I am oholiab (https://keybase.io/oholiab) on keybase.
  • I have a public key whose fingerprint is 489C C8F8 01DB 9682 0D43 4625 4B39 BFAF 2F67 1FE2

To claim this, I am signing this object:

zmodload zsh/curses
buttond=()
function waspressed {
button=$1
mouse_event=$2
}