Skip to content

Instantly share code, notes, and snippets.

💭
always paying it forward

Chris Aniszczyk caniszczyk

💭
always paying it forward
Block or report user

Report or block caniszczyk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@caniszczyk
caniszczyk / gist:8920924
Created Feb 10, 2014
Netty3 based Transport in Finagle
View gist:8920924
case class Netty3Transporter[In, Out](
pipelineFactory: ChannelPipelineFactory,
newChannel: ChannelPipeline => Channel =
Netty3Transporter.channelFactory.newChannel(_),
newTransport: Channel => Transport[In, Out] =
new ChannelTransport[In, Out](_),
// various timeout/ssl options
) extends (
(SocketAddress, StatsReceiver) => Future[Transport[In, Out]]
){
@caniszczyk
caniszczyk / gist:8921257
Last active Aug 29, 2015
Composing Services via Finagle
View gist:8921257
val timelineSvc = Thrift.newIface[TimelineService](...) // #1
val tweetSvc = Thrift.newIface[TweetService](...)
val authSvc = Thrift.newIface[AuthService](...)
val authFilter = Filter.mk[Req, AuthReq, Res, Res] { (req, svc) => // #2
authSvc.authenticate(req) flatMap svc(_)
}
val apiService = Service.mk[AuthReq, Res] { req =>
timelineSvc(req.userId) flatMap {tl =>
@caniszczyk
caniszczyk / gist:8920758
Last active Aug 29, 2015
Connect to remote host Finagle / Netty
View gist:8920758
private[netty3] class ChannelConnector[In, Out](
newChannel: () => Channel,
newTransport: Channel => Transport[In, Out]
) extends (SocketAddress => Future[Transport[In, Out]]) {
def apply(addr: SocketAddress): Future[Transport[In, Out]] = {
require(addr != null)
val ch = try newChannel() catch {
case NonFatal(exc) => return Future.exception(exc) #1
}
// Transport is now bound to the channel; this is done prior to
@caniszczyk
caniszczyk / gist:8921026
Created Feb 10, 2014
Netty based Listener
View gist:8921026
case class Netty3Listener[In, Out](
pipelineFactory: ChannelPipelineFactory,
channelFactory: ServerChannelFactory
bootstrapOptions: Map[String, Object], ... // stats/timeouts/ssl config
) extends Listener[In, Out] {
def newServerPipelineFactory(
statsReceiver: StatsReceiver, newBridge: () => ChannelHandler
) = new ChannelPipelineFactory { // #1
def getPipeline() = {
val pipeline = pipelineFactory.getPipeline()
@caniszczyk
caniszczyk / gist:8921074
Created Feb 10, 2014
Bridge Netty and Finagle
View gist:8921074
class ServerBridge[In, Out](
serveTransport: Transport[In, Out] => Unit,
) extends SimpleChannelHandler {
override def channelOpen(
ctx: ChannelHandlerContext,
e: ChannelStateEvent
){
val channel = e.getChannel
val transport = new ChannelTransport[In, Out](channel) // #1
serveTransport(transport)
@caniszczyk
caniszczyk / gist:8920827
Created Feb 10, 2014
Bridging Netty and Finagle
View gist:8920827
object Netty3Transporter {
val channelFactory: ChannelFactory =
new NioClientSocketChannelFactory(
Executor, 1 /*# boss threads*/, WorkerPool, DefaultTimer
){
// no-op; unreleasable
override def releaseExternalResources() = ()
} #1
val defaultChannelOptions: Map[String, Object] = Map(
"tcpNoDelay" -> java.lang.Boolean.TRUE,
@caniszczyk
caniszczyk / gist:9192214
Created Feb 24, 2014
Austin Newish Apartments
View gist:9192214
There's a metro rail in Austin which is awesome but it doesn't go to many areas yet, they plan on extending the service soon: http://www.capmetro.org/metrorail/
To get an idea of apt pricing, here are some that are being built or are built in decent locations that are a bit "fancier"
http://gables.com/parkplaza (used to live there, super fancy though and next to Whole Foods HQ)
http://www.coleapts.com/ (great location near Zilker, walkable to SoLa, Zilker Park and downtown)
http://gibsonflats.com/ (south lamar, close to zilker and new alamo draft house, newly built)
http://www.postproperties.com/community.aspx?community=247600 (fairly newly built)
http://www.amli.com/apartments/austin/downtown/austin/300 (older but cheap for its location)
http://www.elevenaustin.com/ (newly built on the east side)
@caniszczyk
caniszczyk / datagrants.rb
Created Mar 21, 2014
Random Sampling of CSV in Ruby
View datagrants.rb
require 'csv'
csvs = (1..13).map{|i| CSV.open("data#{i}.csv", "w")}
CSV.foreach("datagrants.csv") do |row|
puts row # TODO remove
csvs.sample << row
end
@caniszczyk
caniszczyk / restaurants.md
Last active Aug 29, 2015
Restaurants in Austin @cra likes
View restaurants.md
@caniszczyk
caniszczyk / p2director.sh
Created Jan 25, 2011
A convenience script to launch the org.eclipse.equinox.p2.director application
View p2director.sh
#!/bin/bash
if [ $# -lt "5" ]
then
echo
echo "This script needs 5 arguments!"
echo " 1) installable unit (IU)";
echo " 2) metadata repository";
echo " 3) artifact repository";
echo " 4) eclipse directory (destination)";
echo " 5) bundle pool directory";
You can’t perform that action at this time.