Skip to content

Instantly share code, notes, and snippets.

View autre's full-sized avatar

Βασίλης autre

View GitHub Profile
com.acme.app.handlers = java.util.logging.FileHandler
com.acme.app.level = ALL
com.acme.app.useParentHandlers = false
java.util.logging.FileHandler.pattern = app.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format = %4$-5s [%1$tY-%1$tm-%1$tdT%1$tH:%1$TM:%1$TS,%1$TL%1$Tz] %2$10s: %5$s%6$s%n
from monitoring import notification
# a callback to print each notification to stderr
def print_notification(event_list):
for e in event_list:
print >> sys.stderr, e
# a callback to write each event to the db
def write_to_db(event_list):
for e in event_list:
# Report the sum of read bytes from the users
# of tenant ntua every 10 minutes, if the reads
# have come from the object service and the #bytes
# read are larger than 1000.
#
# The aggregation result will be queued under topic 'foo'
rule 'sum-over-ntua'
topic 'foo'
when
e.tenant = 'ntua',
@autre
autre / lib-bar.js
Created December 2, 2011 10:42
rhino relative module resolution bug
// lib/bar.js
var puts;
try {
puts = require('system').puts; // rhino
} catch (e) {
puts = require('util').puts; // node
}
@autre
autre / twitter-no-activity.css
Created November 13, 2011 21:59
turn the stupid twitter activity off
#doc.route-home #page-outer #page-container.page-container.home-container #page-node-home .main-content .page-header.home-header .stream-tabs .stream-tab.stream-tab-activity {
display:none !important;
}
#doc.route-home #page-outer #page-container.page-container.home-container #page-node-home .dashboard .component .dashboard-activity-teaser-inner {
display:none !important;
}
// Clone this object and (optionally) append
// own properties of `other_object` to the newly cloned one.
// This is a convenience method over the Object#create
// Initial code from here: http://howtonode.org/prototypical-inheritance
// Amended with: http://msdn.microsoft.com/en-us/library/ff877835(VS.94).aspx,
// the part about the clone function.
Object.defineProperty(Object.prototype, 'clone', {
get: function() {
var self = this;
;; from here: http://www.learningclojure.com/2010/09/clojure-macro-tutorial-part-i-getting.html
(defmacro forloop
[var-init & body]
(let [myvar (nth var-init 0)
start (nth var-init 1)
end (nth var-init 2)]
(list 'loop [myvar start]
(list 'when (list '<= myvar end)
(cons 'do body)