Skip to content

Instantly share code, notes, and snippets.

View lantins's full-sized avatar

Luke Antins lantins

View GitHub Profile
# Configure the database.
#
# @param [Hash] database database section of the config Hash
# @param [String] env environment to run in. *development*, *production* or *test*
# @param [Object, false] logger pass a *logger* to use or *false* if we shouldn't log SQL
def self.configure_database(database, env = 'development', logger = false)
database = database[env] || database[env.to_sym] || database
database.keys.each{|k| database[k.to_sym] = database.delete(k)}
Sequel.datetime_class = Time
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. lns0.sov.uk.goscomb.net 0.0% 42 29.7 30.0 29.4 31.2 0.4
2. ae0-112.rt0.sov.uk.goscomb.net 0.0% 42 29.8 30.6 29.3 46.3 3.3
3. ge-2-1-0.ar5.LON3.gblx.net 0.0% 42 29.1 29.9 29.1 32.0 0.6
4. te1-3-10G.ar4.LON3.gblx.net 0.0% 42 30.3 38.3 29.3 168.4 29.6
5. level3-2.ar2.LON3.gblx.net 0.0% 42 30.8 32.2 29.6 77.6 7.9
6. ae-34-52.ebr2.London1.Level3.net 0.0% 42 30.5 31.1 30.1 41.1 1.8
7. ae-44-44.ebr1.NewYork1.Level3.net 0.0% 42 98.8 99.1 98.6 99.6 0.2
8. ae-91-91.csw4.NewYork1.Level3.net 0.0% 42 107.0 107.0 102.0 114.4 4.3
module IRVM
class Header
class ControlBits < BinData::Record
bit4 :reserved
bit3 :identifier_schema
bit3 :authorisation_schema
bit1 :acknowledge_required
bit1 :response
end
import time
# ascii version of a test message
message = 'DA0400010201000100000000000000004B02AA2B00'
# VVCCCLLLVIVMSSSSIIIIIIIIIIIIIIIITTTTTTTTPPAAAAAAAA
# 01234567890123456789012345678901234567890123456789
# * * * * *
# grab each part of the header
version = message[0:2]
lantins@macpro:~/development/iris/iris-protocol/iris-protocol-auth$ rvm info
system:
uname: "Darwin macpro.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386"
shell: "bash"
version: "3.2.17(1)-release"
ruby:
interpreter: "ruby"
version: "1.9.1p376"
date: "2009-12-07"
require 'lib/openttd'
class MeowClient < OpenTTD::Client
def initialize
super
end
on :tcp_server_chat do
# something
end
def my_method(port, *params)
puts "my port is: #{port}"
params.each_index do |index|
puts "#{index} = #{params[index]}"
end
end
my_method(1234, 9600, 8, 1, 0)
require 'serialport'
require 'hashie'
options = Hashie::Mash.new({
:port => '/dev/tty.usbserial-A9007MuY', # lukes arduino
#:port => 'com1', # windows...
#:port => 0, # should map to com1, tty0, cuaa0
:baud => 9600,
:data_bits => 8,
:stop_bits => 1,
<form action="/web-hooks/queue" method="post">
<table border="0" class="details form">
<tr>
<th width="150px">Serial Number:</th>
<td width="450px" class="input"><input type="text" name="serial_number" value="<%= @serial_number %>"></td>
</tr>
<tr>
<th>API User ID:</th>
<td class="input"><input type="text" name="api_user_id" value="<%= @api_user_id %>"></td>
</tr>
require 'resque'
require 'resque_scheduler'
require 'resque-retry'
class DeliverWebHook
extend Resque::Plugins::Retry
@queue = :testing
@retry_limit = 5