Skip to content

Instantly share code, notes, and snippets.

I hereby claim:

  • I am clizzin on github.
  • I am clizzin (https://keybase.io/clizzin) on keybase.
  • I have a public key ASB7ch-Q9IO4iJJVee84yMzG8SatrJveTbWKVDhecws03Qo

To claim this, I am signing this object:

{
@clizzin
clizzin / README.md
Created April 12, 2012 04:30 — forked from reissbaker/grove-ui.js
Grove UI improvements

Make the Grove web client look like this

Sweet UI

  • Only show the user name and avatar for the first message in a group of messages by that user.
  • Indent the messages so they all start at the same spot.
  • Use Shift-Up and Shift-Down to switch between channels.
  • Focus the message input field whenever you click anywhere in the window.
  • Eliminate the annoying image flash between when it's inserted and when it's resized.
@clizzin
clizzin / gist:1667186
Created January 24, 2012 01:36
moment function for cascalog.math
;; As predicate macro. Doesn't work because requires two-step aggregation (first step to get the mean, second step to get the moment).
(def moment
(<- [!val !k :> !moment]
(c/avg !val :> !mean)
(- !val !mean :> !dev)
(expt !dev !k :> !pow-dev)
(c/sum !pow-dev :> !pow-dev-sum)
(c/count !count)
(div !pow-dev-sum !count :> !moment)))
@clizzin
clizzin / gist:1096153
Created July 20, 2011 23:09
Git pre-commit hook
#!/usr/bin/env ruby
# Put the contents of this gist into .git/hooks/pre-commit
# Make sure to chmod a+x .git/hooks/pre-commit
flag = false
modified_files = `git diff-index --name-status --cached HEAD`.
map {|line| line.split}.
select {|(status, name)| status != 'D'}. # ignore deleted files
@clizzin
clizzin / gist:1041588
Created June 23, 2011 00:00
Flume exception log output
2011-06-22 12:22:36,215 INFO com.cloudera.flume.core.connector.DirectDriver: Connector logicalNode xxx.ec2.internal-E2E-30 exited with error: Blocked append interrupted by rotation event
java.lang.InterruptedException: Blocked append interrupted by rotation event
at com.cloudera.flume.handlers.rolling.RollSink.append(RollSink.java:204)
at com.cloudera.flume.agent.durability.NaiveFileWALDeco.append(NaiveFileWALDeco.java:132)
at com.cloudera.flume.core.CompositeSink.append(CompositeSink.java:61)
at com.cloudera.flume.agent.AgentFailChainSink.append(AgentFailChainSink.java:103)
at com.cloudera.flume.core.connector.DirectDriver$PumperThread.run(DirectDriver.java:110)
2011-06-22 12:22:37,265 INFO com.cloudera.flume.handlers.thrift.ThriftEventSource: Closed server on port 35090...
2011-06-22 12:22:37,265 INFO com.cloudera.flume.handlers.thrift.ThriftEventSource: Queue still has 1 elements ...
@clizzin
clizzin / gist:1019595
Created June 10, 2011 19:33
Flume Master deadlock stacks output
Process Thread Dump:
137 active threads
Thread 388 (pool-1-thread-182):
State: RUNNABLE
Blocked count: 0
Waited count: 0
Stack:
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
@clizzin
clizzin / gist:1018157
Created June 10, 2011 02:47
Flume agent deadlock stacks output
Process Thread Dump:
95 active threads
Thread 20183 (SpawningLogicalNode foobar):
State: BLOCKED
Blocked count: 1
Waited count: 0
Blocked on com.cloudera.flume.agent.LogicalNode@5a3391c0
Blocked by 20028 (SpawningLogicalNode foobar)
Stack:
com.cloudera.flume.agent.LogicalNode.openLoadNode(LogicalNode.java:166)
# Change the cluster name here
whirr.cluster-name=hadoop
# Change the number of machines in the cluster here
whirr.instance-templates=1 nn+jt,5 dn+tt
# Uncomment out these lines to run CDH
whirr.hadoop-install-runurl=cloudera/cdh/install
whirr.hadoop-configure-runurl=cloudera/cdh/post-configure
> db.foo.insert({a: {john: true, george: true}})
> db.foo.insert({a: {paul: true, ringo: true}})
> db.foo.find()
{ "_id" : ObjectId("4d43912ceb913a1024b1410f"), "a" : { "john" : true, "george" : true } }
{ "_id" : ObjectId("4d43914beb913a1024b14110"), "a" : { "paul" : true, "ringo" : true } }
> db.foo.find({'a.john': {$exists: true}})
{ "_id" : ObjectId("4d43912ceb913a1024b1410f"), "a" : { "john" : true, "george" : true } }
> db.foo.find({'a.paul': {$exists: true}})