Skip to content

Instantly share code, notes, and snippets.

; Copyright 2011 Hubert Iwaniuk
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
@neotyk
neotyk / full thread dump
Created May 9, 2011 12:23
clojure-maven-plugin wait thread dump
2011-05-09 14:19:21
Full thread dump Java HotSpot(TM) 64-Bit Server VM (19.1-b02-334 mixed mode):
"Thread-2" daemon prio=5 tid=10c34a000 nid=0x10bb07000 waiting on condition [10bb06000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.commons.exec.InputStreamPumper.run(InputStreamPumper.java:69)
at java.lang.Thread.run(Thread.java:680)
"Thread-4" daemon prio=5 tid=10c349800 nid=0x10adae000 runnable [10adad000]
@neotyk
neotyk / gist:720069
Created November 29, 2010 15:20
jclouds too many bytes written
java.io.IOException: too many bytes written
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2789)
at com.google.common.io.ByteStreams.copy(ByteStreams.java:171)
at org.jclouds.io.payloads.BasePayload.writeTo(BasePayload.java:68)
at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:221)
at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:76)
at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:153)
at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:132)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
@neotyk
neotyk / twitter-straem.clj
Created October 19, 2010 23:03
(and (first stream) (close))
(ns twitter-stream
(:require [http.async.client :as c]
[org.danlarkin.json :as j]))
(def u ".")
(def p ".")
(defn track [s]
(let [resp (c/stream-seq :post "http://stream.twitter.com/1/statuses/filter.json"
:body {"track" (str s)}
// create custom :external selector
$.expr[':'].external = function(obj){
return obj.hostname && obj.hostname !== location.hostname;
};
$(document).ready(function() {
// apply additional style to external links
$('a:external').addClass('external');
// and behavior
$('a:external').click(function() {
_gaq.push(['_trackEvent', 'Outbound Links', 'Click', $(this).attr('href')]);});});
(ns tmp
(:use clojure.contrib.java-utils))
(def *default* {:a 1})
(def *provided* {:c 2})
(def *mapping*
{:c :b
:a :c
java.lang.AssertionError: Timed out
at org.testng.Assert.fail(Assert.java:84)
at com.ning.http.client.async.ConnectionPoolTest.asyncDoGetKeepAliveHandlerTest_channelClosedDoesNotFail(ConnectionPoolTest.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.Request;
import com.ning.http.client.Response;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
public class Problem {
@neotyk
neotyk / gist:568486
Created September 7, 2010 14:51
Generating multiple fns on a fly
(doseq [[fn-name fn-doc] [testname "sample doc" anothername "detailed documentation"]]
`(defn ~fn-name ~fn-doc [a] a))
2010-05-17 11:26:26
Full thread dump Java HotSpot(TM) 64-Bit Server VM (14.3-b01-101 mixed mode):
"Attach Listener" daemon prio=9 tid=0x0000000102135000 nid=0x114fe6000 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Swank REPL Thread" prio=5 tid=0x00000001024f8000 nid=0x1155bf000 waiting on condition [0x00000001155bd000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000001094a4508> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)