Skip to content

Instantly share code, notes, and snippets.

View mlooney's full-sized avatar

McClain Looney mlooney

View GitHub Profile
class Bofh
include Purugin::Plugin, Purugin::Colors
description 'Bofh', 0.1
player_command("zap", "zap player with lightning", "/zap") do |me, *args|
player = me.world.players.select {|x| x.name.downcase == args.first.downcase}.pop
if player
me.world.strikeLightning(player.location)
else
me.msg yellow("couldn't find player #{args.first}")
end
@mlooney
mlooney / gist:1761238
Created February 7, 2012 18:57
Netty Discard server ported to jruby
require 'java'
require 'jar/netty-3.3.1.Final.jar'
import 'java.net.InetSocketAddress'
import 'java.util.concurrent.Executors'
import 'org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory'
import 'org.jboss.netty.bootstrap.ServerBootstrap'
import 'org.jboss.netty.channel.SimpleChannelHandler'
import 'org.jboss.netty.channel.ChannelPipelineFactory'
import 'org.jboss.netty.channel.ChannelFactory'
Build/configure flags
==> ./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.2 --datadir=/usr/local/Cellar/postgresql/9.1.2/share/postgresql --docdir=/usr/local/Cella
r/postgresql/9.1.2/share/doc/postgresql --enable-thread-safety --with-bonjour --with-gssapi --with-krb5 --with-openssl --with-libxml --with-libxslt --with-ossp-uui
d --with-python --with-perl ARCHFLAGS='-arch x86_64'
./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.2 --datadir=/usr/local/Cellar/postgresql/9.1.2/share/postgresql --docdir=/usr/local/Cellar/po
stgresql/9.1.2/share/doc/postgresql --enable-thread-safety --with-bonjour --with-gssapi --with-krb5 --with-openssl --with-libxml --with-libxslt --with-ossp-uuid --
with-python --with-perl ARCHFLAGS='-arch x86_64'
Interesting configure output:

Keybase proof

I hereby claim:

  • I am mlooney on github.
  • I am mml (https://keybase.io/mml) on keybase.
  • I have a public key whose fingerprint is 930B CFB1 0518 29B6 E369 722E 5818 9DD4 443F 16B2

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am mlooney on github.
* I am mml (https://keybase.io/mml) on keybase.
* I have a public key whose fingerprint is B725 151A 0D28 9389 EA9C 64DB 8C06 BB0D 5692 42CB
To claim this, I am signing this object:
filled_rows = :array.foldl(fn _, value, acc ->
case value do
nil -> acc ++ [false]
data -> acc ++ [true]
end
end, [], state.block_data)
import util from 'util'
import xml4js from 'xml4js'
let xml = `<?xml version="1.0"?> <Element xmlns:xsi="x" xsi:noNamespaceSchemaLocation="y"> </Element>`
let result = xml4js.parseString(xml, {}, (err, result) => {
if (err) {
console.log("error: "+util.inspect(err))
} else {
console.log("success: "+ util.inspect(result, false, null))
}
require 'csv'
k = CSV.open('report.csv', :headers=>:skip).map do |r|
z = r.to_hash.values
[z.shift, z.map(&:to_i).select{|x| x!=0}.inject(0){|m,_|m+=1}]
end
puts k.select{|_,v| v == 0}.map{|y,_| y}