This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
require 'timeout' | |
class MCQuery | |
MAGIC_PREFIX = "\xFE\xFD" | |
PACKET_TYPE_CHALLENGE = "\x09" | |
PACKET_TYPE_QUERY = "\x00" | |
ID = "\x00\x00\x00\x00" | |
DEFAULTS = { | |
host: "localhost", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Tested on 1.9.2-p290, Written by Miles Smith (WedTM) | |
# | |
require 'socket' | |
class MCQuery | |
MAGIC_PREFIX = "\xFE\xFD" | |
PACKET_TYPE_CHALLENGE = "\x09" | |
PACKET_TYPE_QUERY = "\x00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Checks, Pusher, Servers, executeCheck, mongo, net, processCheck, pusher, r, redis, start, util, remaining, completed, failed, timedout, succeeded; | |
net = require('net'); | |
redis = require('redis'); | |
util = require('util'); | |
r = redis.createClient(6379, "<<<< REDACTED >>>>"); | |
mongo = require('mongoskin'); | |
Pusher = require('node-pusher'); | |
require('tamejs').register(); | |
pusher = new Pusher({ | |
appId: '<<<< REDACTED >>>>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var Servers, calculateRank, executeCheck, mongo, net, processCheck, r, redis, remaining, start, startTimer, start_time, util; | |
net = require('net'); | |
redis = require('redis'); | |
util = require('util'); | |
r = redis.createClient(6379, "<< REDIS CONNECTION STRING >>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net = require 'net' | |
redis = require 'redis' | |
r = redis.createClient 6379, "<< REDIS CONNECTION HOST >>" | |
mongo = require 'mongoskin' | |
remaining = 0 | |
r.on "error", (err) -> console.log "Redis Error: #{err}" | |
executeCheck = (server) -> | |
conn = net.createConnection server.port, server.ip | |
conn.setTimeout = 1500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var Servers, executeCheck, mongo, net, processCheck, r, redis; | |
net = require('net'); | |
redis = require('redis'); | |
r = redis.createClient(6379, "redis server here"); | |
mongo = require('mongoskin'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_info | |
s = TCPSocket.open(self.ip, self.port) | |
s.write("\xFE") | |
data = s.read() | |
data = data.gsub("\x00".force_encoding("ASCII-8BIT"), "").gsub("\x1A".force_encoding("ASCII-8BIT"), "").gsub("\xFF".force_encoding("ASCII-8BIT"), "") | |
results = data.split("\xA7".force_encoding("ASCII-8BIT")) | |
info = {} | |
info[:motd] = results[0] | |
info[:players] = results[1] | |
info[:max] = results[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Okay, so here's the deal. I'm planning on implementing a new feature for MCServerlist that modifies the ranking based on what I call the "appeal factor". The main factor of this is the players online to maximum players ratio. | |
Let's say that a server has a maximum player cap of 100. | |
I want the scale to make 75% full the perfect result. That means that if this server has 75 players on X should equal 1. I will then multiply X by the number of ranking points I determine (at a later date). | |
I'm including the points that I want, and I need a mathmatical equation t that will fill in the gaps. | |
Ratio | X Value | |
================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p290 :007 > blah = "text" | |
=> "text" | |
ruby-1.9.2-p290 :008 > more_text = "blah blah blah" | |
=> "blah blah blah" | |
ruby-1.9.2-p290 :009 > blah << more_text | |
=> "textblah blah blah" | |
ruby-1.9.2-p290 :010 > blah << "footer" | |
=> "textblah blah blahfooter" | |
ruby-1.9.2-p290 :011 > blah | |
=> "textblah blah blahfooter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
Dispatch = {} | |
Dispatch.STATIC_VERSION = "1.0" | |
Dispatch.init = (@endpoint) -> | |
@version = "1.0" | |
window.Dispatch = Dispatch | |
### | |
class Dispatch |