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
[user] | |
name = Pavan Kumar Sunkara | |
email = pavan.sss1991@gmail.com | |
username = pksunkara | |
[init] | |
defaultBranch = master | |
[core] | |
editor = nvim | |
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
pager = delta |
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
import socket | |
import struct | |
import json | |
def unpack_varint(s): | |
d = 0 | |
for i in range(5): | |
b = ord(s.recv(1)) | |
d |= (b & 0x7F) << 7*i | |
if not b & 0x80: |
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
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list | |
# A list of available STUN server. | |
stun.l.google.com:19302 | |
stun1.l.google.com:19302 | |
stun2.l.google.com:19302 | |
stun3.l.google.com:19302 | |
stun4.l.google.com:19302 | |
stun01.sipphone.com | |
stun.ekiga.net |
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 crypto = require('crypto'); | |
var assert = require('assert'); | |
function mcHexDigest(str) { | |
var hash = new Buffer(crypto.createHash('sha1').update(str).digest(), 'binary'); | |
// check for negative hashes | |
var negative = hash.readInt8(0) < 0; | |
if (negative) performTwosCompliment(hash); | |
var digest = hash.toString('hex'); | |
// trim leading zeroes |
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
package no.jckf.slplib; | |
import java.io.*; | |
import java.net.InetSocketAddress; | |
import java.net.Socket; | |
import java.net.SocketException; | |
import java.nio.charset.Charset; | |
public final class MinecraftServer { | |
private String address = "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
// You can test this online at: https://play.golang.org/p/hhayRT1VWgj | |
package main | |
import ( | |
"crypto/sha1" | |
"encoding/hex" | |
"fmt" | |
"io" | |
"strings" | |
) |
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
<?php | |
function pingMCServer($server,$port=25565,$timeout=2){ | |
$socket=socket_create(AF_INET,SOCK_STREAM,getprotobyname('tcp')); // set up socket holder | |
socket_connect($socket,$server,$port); // connect to minecraft server on port 25565 | |
socket_send($socket,chr(254).chr(1),2,null); // send 0xFE 01 -- tells the server we want pinglist info | |
socket_recv($socket,$buf,3,null); // first 3 bytes indicate the len of the reply. not necessary but i'm not one for hacky socket read loops | |
$buf=substr($buf,1,2); // always pads it with 0xFF to indicate an EOF message | |
$len=unpack('n',$buf); // gives us 1/2 the length of the reply | |
socket_recv($socket,$buf,$len[1]*2,null); // read $len*2 bytes and hang u[ | |
$data=explode(chr(0).chr(0),$buf); // explode on nul-dubs |
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
/* | |
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
server, but for some reason omit a client connecting to it. I added an | |
example at the bottom. | |
Save the following server in example.js: | |
*/ | |
var net = require('net'); |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
namespace eMZi.Gaming.Minecraft | |
{ |
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' | |
## | |
# Pings a minecraft server and returns motd and playercount. | |
# Works with ruby >=1.9.3/2.0.0 | |
# | |
# More information and sample code here: | |
# http://wiki.vg/Server_List_Ping | |
## | |
class MinecraftPing |
OlderNewer