Skip to content

Instantly share code, notes, and snippets.

View fbettag's full-sized avatar

Franz Bettag fbettag

View GitHub Profile
@fbettag
fbettag / gist:5930024
Created July 4, 2013 20:18
#sbt #scala :(
[error] (*:assembly) deduplicate: different file contents found in the following:
[error] /root/.sbt/boot/scala-2.10.2/lib/scala-compiler.jar:rootdoc.txt
[error] /root/.sbt/boot/scala-2.10.2/lib/scala-library.jar:rootdoc.txt
root@cfe /var/cfengine/masterfiles]# cf-agent -KI
/var/cfengine/inputs/libraries/cfengine_stdlib.cf:308:55: error: syntax error
"$(index)=$($(tab)[$(sectionName)][$(index)])",
^
/var/cfengine/inputs/libraries/cfengine_stdlib.cf:308:55: error: Expected attribute, got ','
"$(index)=$($(tab)[$(sectionName)][$(index)])",
^
/var/cfengine/inputs/libraries/cfengine_stdlib.cf:309:29: error: Expected promiser string, got 'select_region'
select_region => INI_section("$(sectionName)"),
^
java.lang.NullPointerException
at io.netty.handler.codec.ByteToMessageDecoder.messageReceived(ByteToMessageDecoder.java:174)
at io.netty.channel.DefaultChannelHandlerContext.invokeMessageReceived(DefaultChannelHandlerContext.java:379)
at io.netty.channel.DefaultChannelHandlerContext.fireMessageReceived(DefaultChannelHandlerContext.java:364)
at io.netty.channel.DefaultChannelHandlerContext.fireMessageReceived(DefaultChannelHandlerContext.java:347)
at io.netty.channel.DefaultChannelPipeline.fireMessageReceived(DefaultChannelPipeline.java:780)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:92)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:489)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:464)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:358)
@fbettag
fbettag / gist:5674339
Created May 29, 2013 22:26
Another example why i am against binary distros..
# apt-get install texlive-xetex pdftk texlive-latex-extra etoolbox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libpkcs11-helper1 liblzo2-2
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
cmap-adobe-japan1 doc-base ed gcj-4.6-base gcj-4.6-jre-lib gettext gettext-base ghostscript gs-cjk-resource gsfonts intltool-debian lacheck latex-beamer
latex-xcolor libcroco3 libcupsimage2 libgcj-common libgcj12 libgettextpo0 libgs9 libgs9-common libijs-0.35 libjbig2dec0 libkpathsea5
@fbettag
fbettag / netty4-liftweb-boot
Last active December 14, 2015 03:59
Liftweb and Netty4 teaser ;)
$ curl -v http://127.0.0.1:8080/someresources/123
* About to connect() to 127.0.0.1 port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /someresources/123 HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: 127.0.0.1:8080
> Accept: */*
>
10:58:22.361 WARN  AuthenticationHandler$ - io.netty.handler.codec.DecoderException: io.netty.handler.codec.UnreplayableOperationException
io.netty.handler.codec.DecoderException: io.netty.handler.codec.UnreplayableOperationException
   at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:462)
   at io.netty.handler.codec.ByteToMessageDecoder.inboundBufferUpdated(ByteToMessageDecoder.java:69)
   at io.netty.channel.ChannelInboundByteHandlerAdapter.inboundBufferUpdated(ChannelInboundByteHandlerAdapter.java:51)
   at io.netty.channel.DefaultChannelHandlerContext.invokeInboundBufferUpdated(DefaultChannelHandlerContext.java:931)
   at io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated0(DefaultChannelHandlerContext.java:909)
   at io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated(DefaultChannelHandlerContext.java:887)
   at io.netty.handler.timeout.IdleStateHandler.inboundBufferUpdated(IdleStateHandler.java:261)
   at io.netty.channel.DefaultC
@fbettag
fbettag / gist:4645338
Last active December 11, 2015 18:58
Netty Channels used comfortable with Scala Implicits
import io.netty.util._
import io.netty.channel._
import io.netty.handler.codec.http._
import io.netty.handler.codec.http.websocketx._
package object netty {
object NettyChannelAttr {
val session = new AttributeKey[String]("Channel.session")
val date = new AttributeKey[java.util.Date]("Channel.date")
val keepAlive = new AttributeKey[Boolean]("Channel.keepAlive")
io.netty.channel.ChannelPipelineException: io.netty.buffer.IllegalBufferAccessException
at io.netty.channel.DefaultChannelPipeline.notifyHandlerException(DefaultChannelPipeline.java:1011)
at io.netty.channel.DefaultChannelHandlerContext.invokeInboundBufferUpdated(DefaultChannelHandlerContext.java:1154)
at io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated0(DefaultChannelHandlerContext.java:1130)
at io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated(DefaultChannelHandlerContext.java:1109)
at io.netty.handler.timeout.IdleStateHandler.inboundBufferUpdated(IdleStateHandler.java:261)
at io.netty.channel.DefaultChannelHandlerContext.invokeInboundBufferUpdated(DefaultChannelHandlerContext.java:1152)
at io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated0(DefaultChannelHandlerContext.java:1130)
at io.netty.channel.DefaultChannelHandlerContext.fireInboundBufferUpdated(DefaultChannelHandlerContext.
def apply(sender: InetSocketAddress, buf: ByteBuf): Try[NetFlowV5Packet] = Try[NetFlowV5Packet] {
val version = buf.getInteger(0, 2).toInt
if (version != 5) return Failure(new InvalidFlowVersionException(version))
val packet = NetFlowV5Packet(sender, buf.readableBytes)
packet.count = buf.getInteger(2, 2).toInt
if (packet.count <= 0 || buf.readableBytes < headerSize + packet.count * flowSize)
return Failure(new CorruptFlowPacketException)
packet.uptime = buf.getInteger(4, 4) / 1000
scala> val ip = java.net.InetAddress.getByName("1.2.176.0")
base: java.net.InetAddress = /1.2.176.0
scala> val prefix = io.wasted.util.InetPrefix(ip, 20)
prefix: io.wasted.util.InetPrefix = /1.2.176.0/20
scala> prefix.contains(base)
res1: Boolean = true
scala> prefix.contains(java.net.InetAddress.getByName("1.2.191.20"))