Skip to content

Instantly share code, notes, and snippets.

@jasonmay
jasonmay / -
Created December 22, 2014 21:02
foo
object Universe extends App {
val proc = new RequestProcessor()
val service_proc = new thrift.LocRequestService.Processor(proc)
val serverTransport: TServerTransport = new TServerSocket(MY_PORT);
val server: TServer = new TSimpleServer(new TServer.Args(serverTransport).processor(service_proc));
// ...
server.serve();
package org.jarsonmar.neptune.universe
import akka.actor._
import akka.util._
import org.apache.thrift.TException
import org.apache.thrift.server._
import org.apache.thrift.transport._
import org.apache.thrift.protocol._
import collection.mutable
@jasonmay
jasonmay / trace.rb
Created February 27, 2012 23:25
Load rails stacktraces into quickfix
#!/usr/bin/env ruby
require 'tempfile'
file = Tempfile.new('rails-trace');
ARGF.each do |line|
fields = line.chomp.strip.split(/\s+/, 3)
next unless fields.size >= 3
if fields[1] =~ /\(.+\)/
#!/usr/bin/env perl
use strict;
use warnings;
sub return_eval {
return eval { die } or do { die "does not get to here" };
}
return_eval();
@jasonmay
jasonmay / mud-client.pl
Created January 24, 2012 05:29
My (very hacky) 'modal' 'MUD' client
#!/usr/bin/env perl
use strict;
use warnings;
use Term::ReadLine;
use IO::Socket::INET;
# ABSTRACT: A hacky modal 'telnet' client
#
# This is written to replace 'rlwrap telnet foo'
# so I can have my own custom keybindings. At the time
use Foo::Baz;
class Foo {
method hello() { Foo::Baz.new.bop() }
}
sub attr_unpack {
shift if ref($_[0]); # called in object context, ditch the object
my $data = shift;
my ($num, $fg, $bg, $bo, $fa, $st, $ul, $bl, $rv);
$num = unpack ('S', $data);
($fg, $bg, $bo, $fa, $st, $ul, $bl, $rv) = (
$num & 7,
($num >> 4) & 7,
#!/bin/bash
BREWBIN=/Users/jasonmay/.brew/bin
GROWLHOST=$1
(
/usr/bin/ssh "$GROWLHOST" "cat .growl-alerts 2>/dev/null; rm -f .growl-alerts" && echo
) | while read msg
do
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = "0.01";
%IRSSI = (
authors => "Jason May",
contact => 'jason.a.may@gmail.com',
name => 'alertsfile',
description => 'Send all hilight messages to a file for external apps to process',
license => "Public Domain",
url => "http://irssi.org/",