Skip to content

Instantly share code, notes, and snippets.

HTTPDPlat_IP=10.69.9.10
OAM_MASK=28
HCLBRG_IP=10.69.9.18
CP_MASK=29
TW_IP=10.56.127.245
CP_GW_IP=10.69.9.17
#fsclish -c "add networking address dedicated /HTTPDPlat iface eth4 ip-address $HTTPDPlat_IP/$OAM_MASK"
fsclish -c "add networking address dedicated /MGW_HCLBRG-0 iface eth2 ip-address $HCLBRG_IP/$CP_MASK"
fsclish -c "set routing node CLA-0 static-route $TW_IP/32 nexthop gateway address $CP_GW_IP on"
class RubyWarrior::Space
def <=>(other)
if self.ticking? && !other.ticking?
return -1
elsif !self.ticking? && other.ticking?
return 1
else
return self.to_s <=> other.to_s
end
end
TW_IP=10.56.127.245
OAM_MASK=28
CP_MASK=29
UP_MASK=29
HTTPDPlat_IP=10.69.9.10
HCLBRG_IP=10.69.9.18
MGW_IPNIURG0=10.69.9.28
CP_GW_IP=10.69.9.17
UP_GW_IP=10.69.9.25
START = 30
SIZE = 50
WHITE_PIECE = 1
BLACK_PIECE = 2
DEAD_TEST = 3
COUNTED = 4
WHITE_DEAD = 6
BLACK_DEAD = 7 #these are what will go on the board for "temporarily" dead groups
@athom
athom / acm_bot.rb
Created July 7, 2011 07:05 — forked from JulesWang/acm_bot.rb
A acm bot do some boring work
# Ruby 1.9.2
# Home: https://gist.github.com/856219
# My CPP template: template_cpp.rb
# OJ Support:
# Online Judge of Zhejiang University
# Author: w.jq0722@gmail.com
require 'uri'
require 'net/http'
#require 'hpricot'
@athom
athom / player.rb
Created July 11, 2011 09:50
rubywarrior-step-by-step
require "readline"
class Player
def play_turn(w)
# add your code here
buf = Readline.readline("> ", true )
action=buf[0]
direction=buf[1]
abilities = {'w' => 'w.walk!', 'a' => 'w.attack!', 'r' => 'w.rest!', 'c' => 'w.rescue!', 's' => 'w.shoot!', 'b' => 'w.bind!', 'd' => 'w.detonate!'}
directions = {'l' => ':forward', 'h' => ':backward', 'j' => ':right', 'k' => ':left'}
class Proxy
def initialize(target_object)
@object = target_object
# ADD MORE CODE HERE
@call_count = {}
end
attr_accessor :channel
def proxy_call(m, *args)
@athom
athom / simple_fiber_concurrency.rb
Created March 14, 2012 08:49 — forked from aprescott/simple_fiber_concurrency.rb
Simple example of concurrency in Ruby with Fiber.
require "fiber"
f1 = Fiber.new { |f2| f2.resume Fiber.current;loop{puts "A"; f2.transfer} }
f2 = Fiber.new { |f1| f1.transfer; loop{puts "B"; f1.transfer} }
f1.resume f2
@athom
athom / pat_example.go
Created July 27, 2012 05:12
an example of pat usage
package main
import (
"github.com/bmizerany/pat"
"io"
"log"
"net/http"
)
// hello world, the web server
@athom
athom / onLocalSearchResult.js
Created September 6, 2012 05:18
tokeninput callback example
onLocalSearchResult: function(items, q){
var newItems = new Array();
$.each(items, function(index, item){
names = item.Name.split(" ");
$.each(names, function(i, name){
if(name.toLowerCase().slice(0,q.length) == q){
newItems.push(item);
return false
}
})