Skip to content

Instantly share code, notes, and snippets.

View wedtm's full-sized avatar

Miles Smith wedtm

  • Vimae Development, LLC.
  • Tampa, FL
View GitHub Profile
@wedtm
wedtm / mcquery.rb
Created February 29, 2012 11:04
MCQuery - Minecraft Query Implementation in Ruby
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",
@wedtm
wedtm / gist:1906478
Created February 25, 2012 04:35
Ruby based Minecraft Vanilla Query Check
#
# 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"
@wedtm
wedtm / frankie.src.js
Created January 7, 2012 07:21
Frankie - MCSL Checking Drone
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 >>>>',
(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 >>");
@wedtm
wedtm / gist:1442155
Created December 7, 2011 09:28
MCSL Node.JS Checker (Housewife) - 500 Checks Per Second
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
(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');
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]
@wedtm
wedtm / gist:1294768
Created October 18, 2011 06:47
Mathmatic equation to rank players on a server
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
=================
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"
###
Dispatch = {}
Dispatch.STATIC_VERSION = "1.0"
Dispatch.init = (@endpoint) ->
@version = "1.0"
window.Dispatch = Dispatch
###
class Dispatch