Skip to content

Instantly share code, notes, and snippets.

View Fluxx's full-sized avatar

Jeff Pollard Fluxx

View GitHub Profile
diff --git a/src/main/java/com/pinterest/secor/common/KafkaClient.java b/src/main/java/com/pinterest/secor/common/KafkaClient.java
index 3fe96a2..d7061dc 100644
--- a/src/main/java/com/pinterest/secor/common/KafkaClient.java
+++ b/src/main/java/com/pinterest/secor/common/KafkaClient.java
@@ -131,8 +131,11 @@ public class KafkaClient {
ByteBuffer payload = messageAndOffset.message().payload();
byte[] payloadBytes = new byte[payload.limit()];
payload.get(payloadBytes);
+ ByteBuffer key = messageAndOffset.message().key();
+ byte[] keyBytes = new byte[key.limit()];
class Foo
attr_accessor :bar
def set
@bar = "set in the set method"
end
def check
p bar
bar = "set locally"
mysql> SET SESSION sql_mode = 'ANSI,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,TRADITIONAL';
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER TABLE `urls` ADD COLUMN `cached_at` DATETIME;
ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00' for column 'updated_at' at row 18
mysql>
#!/usr/bin/env ruby
module Mixin
def self.included(mod)
mod.extend ClassMethods
end
module ClassMethods
@Fluxx
Fluxx / god.log
Created June 22, 2011 15:32
God load issues
* Event conditions are not available for your installation of god.
* You may still use and write custom conditions using the poll system
*
***********************************************************************
I [2011-06-22 08:22:07] INFO: Syslog disabled.
I [2011-06-22 08:22:07] INFO: Using pid file directory: /home/ubuntu/.god/pids
I [2011-06-22 08:22:07] INFO: Socket already in use
I [2011-06-22 08:22:07] INFO: Socket is stale, reopening
I [2011-06-22 08:22:07] INFO: Started on drbunix:///tmp/god.17165.sock
require 'date'
require 'benchmark'
puts "patchlevel: #{RUBY_PATCHLEVEL}, release_date: #{RUBY_RELEASE_DATE}, ruby_version: #{RUBY_VERSION}, ruby_platform: #{RUBY_PLATFORM}"
puts '*'*80
Benchmark.bm(10) do |bm|
bm.report("Date.today") do
500_000.times { Date.today }
97,103,
97,52,
97,55,
97,90,
97,54,
97,100,
97,102,
day = case self.type
when 'fast' then :fast_completion_day
when 'super_fast' then :super_fast_completion_day
when 'ludicrous' then :ludicrous_completion_day
else :budget_completion_day
end
self.value = Increment.first.max_hours * Incrementor.first.send(day)
require "rubygems"
require "eventmachine"
module DumbHttpClient
def post_init
puts "* Sending..."
puts
send_data "GET / HTTP/1.1\r\nHost: _\r\n\r\n"
puts "GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n"
@data = ""
==================================== Nodes ====================================
Node #1: 20.3% riak@m-us-east-1c-silo-production-riak-01.silo
Node #2: 19.9% riak@m-us-east-1c-silo-production-riak-02.silo
Node #3: 19.9% riak@m-us-east-1c-silo-production-riak-03.silo
Node #4: 19.9% riak@m-us-east-1c-silo-production-riak-04.silo
Node #5: 19.9% riak@m-us-east-1c-silo-production-riak-05.silo
==================================== Ring =====================================
[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,
4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,
2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,