Skip to content

Instantly share code, notes, and snippets.

View paulbellamy's full-sized avatar

Paul Bellamy paulbellamy

View GitHub Profile
@paulbellamy
paulbellamy / bucket.rb
Created May 2, 2012 16:23 — forked from bjpirt/bucket.rb
Quick bucketing of PG logs
#!/usr/bin/env ruby
module Enumerable
# sum of an array of numbers
def sum
return self.inject(0){|acc,i|acc +i}
end
# average of an array of numbers
def average
@paulbellamy
paulbellamy / gist:2788108
Created May 25, 2012 13:18
cassandra 1.1.0 failure
Running official cassandra 1.1.0 binary
=======================================
at org.apache.cassandra.db.columniterator.SSTableSliceIterator.<init>(SSTableSliceIterator.java:58)
at org.apache.cassandra.db.filter.SliceQueryFilter.getSSTableColumnIterator(SliceQueryFilter.java:66)
at org.apache.cassandra.db.filter.QueryFilter.getSSTableColumnIterator(QueryFilter.java:78)
at org.apache.cassandra.db.CollationController.collectAllData(CollationController.java:233)
at org.apache.cassandra.db.CollationController.getTopLevelColumns(CollationController.java:61)
at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(ColumnFamilyStore.java:1273)
at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1155)
@paulbellamy
paulbellamy / gist:2819990
Created May 28, 2012 16:30
cassandra transport exception
/opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/transport/socket.rb:109:in `read': CassandraThrift::Cassandra::Client::TransportException
from /opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/transport/base_transport.rb:87:in `read_all'
from /opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/transport/framed_transport.rb:104:in `read_frame'
from /opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/transport/framed_transport.rb:69:in `read_into_buffer'
from /opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/protocol/binary_protocol.rb:190:in `read_i32'
from /opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/protocol/binary_protocol.rb:116:in `read_message_begin'
from /opt/ruby/ruby-1.9.2-p290/lib/ruby/gems/1.9.1/gems/thrift-0.8.0/lib/thrift/client.rb:45:in `receive_message'
from /home/paul/.bundler/ruby/1.9.1/c
@paulbellamy
paulbellamy / 'lein deps' output
Created August 16, 2012 11:34
Problem installing guava-collections
Retrieving com/google/guava/guava-collections/r03/guava-collections-r03.pom (1k)
from http://repo1.maven.org/maven2/
Checksum validation failed, expected eaa856fdfbf53342d48d9e48e09bb7056151beb5 but is 4542f475c395917cb2b572549e0804f23695a648
Retrieving com/google/guava/guava-collections/r03/guava-collections-r03.pom (1k)
from http://repo1.maven.org/maven2/
Could not transfer artifact com.google.guava:guava-collections:pom:r03 from/to central (http://repo1.maven.org/maven2): Checksum validation failed, expected eaa856fdfbf53342d48d9e48e09bb7056151beb5 but is 4542f475c395917cb2b572549e0804f23695a648
Could not find artifact com.google.guava:guava-collections:pom:r03 in clojars (https://clojars.org/repo/)
@paulbellamy
paulbellamy / gist:3496235
Created August 28, 2012 08:39
Ruby LolWut!?
irb(main):001:0> nil.foobar
NoMethodError: undefined method `foobar' for nil:NilClass
from (irb):1:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
If nodetool repair has not been run often enough to the point that GCGraceSeconds has passed, you
risk forgotten deletes (see DistributedDeletes). In addition to data popping up that has been deleted,
you may see inconsistencies in data return from different nodes that will not self-heal by read-repair
or further nodetool repair. Some further details on this latter effect is documented in CASSANDRA-1316.
@paulbellamy
paulbellamy / gist:4257437
Created December 11, 2012 09:59
git-sync
#!/bin/bash
current_branch=`git rev-parse --abbrev-ref HEAD`
if [ "$1" != "" ] && [ "$current_branch" != "$1" ]; then
# not syncing current branch
git fetch upstream && git push `whoami` upstream/$1:$1
else
@paulbellamy
paulbellamy / output
Created December 13, 2012 10:29
A static typing system for ruby in ruby
$ ruby types_usage.rb
Fermenting the cheese for 5 days!
Fermenting the cheddar for 0.5 days!
./types.rb:7:in `types': Expected #<Walrus:0x7f7e71bb4328> to be a Cheese, but was a Walrus (ArgumentError)
from types_usage.rb:1:in `each'
from types_usage.rb:1:in `each_slice'
from ./types.rb:5:in `each'
from ./types.rb:5:in `each_slice'
from ./types.rb:5:in `each'
from ./types.rb:5:in `types'
#!/usr/bin/ruby
current_dir = File.expand_path(File.dirname(__FILE__))
files_dir = File.join(current_dir, "files")
files = Dir[File.join(files_dir, "*")] + Dir[File.join(files_dir, ".[^\.]*")]
files.each do |file|
command = "ln -sfF #{file} $HOME/."
puts command
`#{command}`
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 2.
{
"title":"foo",
"version":"1.0.0",
"tags":[
"Tag1",
"Tag2"
],
"location":{
"disposition":"fixed",
"ele":"23.0",