Skip to content

Instantly share code, notes, and snippets.

View cessationoftime's full-sized avatar

Chris Van Vranken cessationoftime

  • Akron, OH
View GitHub Profile
@cessationoftime
cessationoftime / RoboFactoryModuleBuilder.java
Created September 11, 2011 23:32
Guice FactoryProviders for RoboGuice 1.2
/**
* Copyright (C) 2009 Google Inc.
*
* 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
@cessationoftime
cessationoftime / AkkaSpecification.scala
Created February 8, 2012 02:12
AkkaSpecification - Specs2 specification trait for using the Akka testkit
package org.specs2
package mutable
import org.specs2.execute.StandardResults
import org.specs2.main.ArgumentsShortcuts
import org.specs2.matcher.MustThrownMatchers
import org.specs2.specification.AutoExamples
import org.specs2.specification.FormattingFragments
import org.specs2.matcher.ShouldThrownMatchers
import org.specs2.specification.SpecificationStructure
@cessationoftime
cessationoftime / MethodReaderProxy.scala
Created February 9, 2012 17:10
Javassist: create dynamic proxy to override methods of a class and record the method names as they are called
package edu.urmc.lis.datawarehousequery.schema.fieldbuilder.javassist
import javassist.util.proxy.ProxyFactory
import javassist.util.proxy.MethodHandler
import java.lang.reflect.Method
class MethodReaderProxy[T: Manifest] {
private var lastMethod: Option[Method] = None
private var methodManifest: Option[Manifest[_]] = None
private val clazz = manifest[T].erasure
package com.random
import com.jme3.animation.AnimChannel
import com.jme3.animation.AnimControl
import com.jme3.animation.AnimEventListener
import com.jme3.animation.LoopMode
import com.jme3.app.SimpleApplication
import com.jme3.input.KeyInput
import com.jme3.input.controls.ActionListener
import com.jme3.input.controls.KeyTrigger
@cessationoftime
cessationoftime / XampleSpec.scala
Created April 28, 2012 16:04
Akka MultiJVM testing example with barriers
package sample
import org.scalatest.WordSpec
import org.scalatest.matchers.MustMatchers
import org.scalatest.BeforeAndAfterAll
import akka.remote.AbstractRemoteActorMultiJvmSpec
import akka.remote.AkkaRemoteSpec
object XampleMultiJvmSpec extends AbstractRemoteActorMultiJvmSpec {
override def NrOfNodes = 2
@cessationoftime
cessationoftime / portforward
Created June 16, 2012 22:44
Akka port forwarding error. RouterInternetIP = 74.74.74.74
[DEBUG] [2012-06-16 18:20:43,514] [node-akka.actor.default-dispatcher-9] (akka.actor.ActorSystemImpl) : RemoteServerClientConnected@akka://[email protected]:2552: Client[akka://[email protected]:2552]
[ERROR] [2012-06-16 18:20:43,528] [node-akka.actor.default-dispatcher-9] (NettyRemoteTransport(akka://[email protected]:2552)) : dropping message TextMessage(Magnan,test) for non-local recipient akka://[email protected]:2559/user/chatDisplayBox arriving at akka://[email protected]:2552 inbound address is akka://[email protected]:2552
[ERROR] [2012-06-16 18:21:01,448] [node-akka.actor.default-dispatcher-18] (NettyRemoteTransport(akka://[email protected]:2552)) : dropping message TextMessage
(Magnan,huh) for non-local recipient akka://[email protected]:2559/user/chatDisplayBox arriving at akka://[email protected]:2552 inbound address is akka://[email protected]:2552
[DEBUG] [2012-06-16 18:23:14,663] [node-akka.actor.default-dispatcher-18] (RemoteClient(akka://node)) : Starting remote client connection
@cessationoftime
cessationoftime / prjNodeproguardCfg.sbt
Created November 7, 2012 02:31
Merge reference.conf for proguard
//xsbt-proguard-plugin
seq(ProguardPlugin.proguardSettings :_*)
//filter resource files from JARs
makeJarFilter <<= (makeJarFilter) {
(makeFilter) =>
val (makeInJarFilter,makeOutJarFilter) = makeFilter;
val akkas = List("akka-remote","akka-actor", "akka-agent", "akka-camel", "akka-amqp")
val InFilter =
(file:String) => file match {
@cessationoftime
cessationoftime / Communication.scala
Created November 8, 2012 03:07
akka-remote connection forcing wont shutdown immediately, must wait for execution-pool-keepalive
case "bind" =>
val newRemoteActorsMap = routerConnectionOption match {
//avoid trying to connect to self.
case Some(localAkkaConnection) if localAkkaConnection != remoteAkkaConnection ?
//create a new actor for the remote node to send to
val localVoiceRecipient = context.actorOf(Props[VoiceRecipient], remoteAkkaConnection.actorNameString)
//get a reference to the textChat/voicechat actor on the remote node that the we should send to.
val remoteChatDisplayBox = context.actorFor(remoteAkkaConnection.uriString + """/user/chatDisplayBox""")
//akka://node/user/mq-connection/$a/21EC20203AEA1069A2DD08002B30309D/747411172553]
@cessationoftime
cessationoftime / FirewallMain.scala
Created November 21, 2012 02:24
Attempt to use Bridj to retrieve information about the firewall
package firewall
import org.bridj.Pointer
import org.bridj.BridJ
import org.bridj.Pointer
import org.bridj.cpp.com.COMRuntime
object FirewallMain extends App {
val x: INetFwMgr = COMRuntime.newInstance(classOf[INetFwMgr]);
val point = Pointer.allocatePointer(classOf[INetFwPolicy]);
VERSION=1.6.1
ARCH=`uname -m`
ARCH_SYS=`uname -s | tr "[A-Z]" "[a-z]"`
if [[ "$ARCH" = "i386" ]]
then
ARCH = "i686"
fi
WORK_DIR=`pwd`