This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler | |
in the pipeline did not handle the exception. | |
java.nio.channels.ClosedChannelException | |
at io.netty.channel.AbstractChannel$AbstractUnsafe.flushNow(AbstractChannel.java:683) | |
at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:654) | |
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:644) | |
at io.netty.channel.DefaultChannelPipeline$HeadHandler.write(DefaultChannelPipeline.java:1040) | |
at io.netty.channel.DefaultChannelHandlerContext.invokeWrite0(DefaultChannelHandlerContext.java:716) | |
at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:700) | |
at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:692) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>org.elasticsearch</groupId> | |
<artifactId>elasticsearch</artifactId> | |
<version>${elasticsearch.version}</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>net.java.dev.jna</groupId> | |
<artifactId>jna</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import scala.util.Try | |
import scalaz._ | |
import scalaz.std.option._ | |
import scalaz.std.list._ | |
sealed trait CoPConst { | |
type Point[A] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def grepFromFile(filename, string): | |
content = run('cat' + filename, capture=True) | |
return grep(content, string) | |
def grepFromString(haystack, needle, caseSensitive): | |
result = None | |
if(caseSensitive): | |
needle = needle.lower() | |
s = StringIO.StringIO(haystack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mpme.netty; | |
import io.netty.buffer.ByteBuf; | |
import io.netty.buffer.Unpooled; | |
import io.netty.channel.ChannelHandlerContext; | |
import io.netty.channel.ChannelInboundHandlerAdapter; | |
import io.netty.util.CharsetUtil; | |
public class PingResponder extends ChannelInboundHandlerAdapter { | |
final static private ByteBuf PING = Unpooled.copiedBuffer("PING", CharsetUtil.UTF_8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.netty.buffer.ByteBuf; | |
import io.netty.buffer.Unpooled; | |
import io.netty.channel.ChannelHandlerContext; | |
import io.netty.handler.codec.ByteToMessageDecoder; | |
import io.netty.util.CharsetUtil; | |
import java.util.List; | |
import redgate.protocol.RedisCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Proposed code | |
override def receive: Receive = { | |
// ... snip ... | |
for { | |
indexed <- Future.sequence(batch.map { | |
case (_, f) => | |
if (!f.exists()) Future.successful(f -> Nil) | |
else searchService.extractSymbolsFromClassOrJar(f).map(f ->) | |
}) | |
.recoverWith { case t: Throwable => log.error(s"failed to index batch of ${batch.size} files", t); Future.failed(t)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.data.{Validated, Xor} | |
import cats.syntax.apply._ // For |@| syntax | |
import cats.std.list._ // For semigroup (append) on List | |
object ValidatedExample { | |
import Xor.{left, right} | |
import Validated.{invalid, valid} | |
// We are going to compare the behaviour of Xor and Validated. First we | |
// define some instances. Then we combine them using flatMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#------------------------------------------------------------------------------ | |
# Name: sbtmkdirs | |
# Purpose: Create an SBT project directory structure with a few simple options. | |
# Author: Alvin Alexander, http://alvinalexander.com | |
# Info: http://alvinalexander.com/sbtmkdirs | |
# License: Creative Commons Attribution-ShareAlike 2.5 Generic | |
# http://creativecommons.org/licenses/by-sa/2.5/ | |
#------------------------------------------------------------------------------ |