Skip to content

Instantly share code, notes, and snippets.

View TobiX's full-sized avatar

Tobias Gruetzmacher TobiX

View GitHub Profile
diff --git a/bravo/protocols/beta.py b/bravo/protocols/beta.py
index 05f2969..1cef167 100644
--- a/bravo/protocols/beta.py
+++ b/bravo/protocols/beta.py
@@ -259,6 +259,10 @@ class BetaServerProtocol(Protocol):
log.err(payload)
def connectionLost(self, reason):
+ packet = make_packet("chat",
+ message="%s left the game." % self.username)
import StringIO
from construct import *
import def_cstpool as CTPoolLib
import def_member as MemberLib
import re
import os
import copy
import pprint
class ClassDef():
@TobiX
TobiX / simpleauth.sh
Created April 30, 2011 23:19
Minecraft Authentication
#!/bin/sh
user=$1
pass=$2
echo "Login..."
oldIFS="$IFS"
IFS=':'
set -- `curl -d "user=$user&password=$pass&version=9999" https://login.minecraft.net/`
IFS="$oldIFS"
#include <stdio.h>
int main(int argc, char **argv)
{
int use_icmp;
switch (argv[0][0]) {
case 'I':
use_icmp = 1;
break;
}
@TobiX
TobiX / Protocol.pm
Created August 1, 2011 22:21
Minecraft "protocol parser"
package MineCrap::Protocol;
use common::sense;
use Moose;
use Moose::Util::TypeConstraints;
#use namespace::autoclean;
use Data::ParseBinary;
use MineCrap::Protocol::CompressionAdapter;
use MineCrap::Protocol::DoubleAdapter;
use MineCrap::Protocol::UCS2Adapter;
0000000: 0a00 000a 0004 4461 7461 0100 0a74 6875 ......Data...thu
0000010: 6e64 6572 696e 6700 0400 0a4c 6173 7450 ndering....LastP
0000020: 6c61 7965 6400 0001 322b bd4f 630a 0006 layed...2+.Oc...
0000030: 506c 6179 6572 0200 0a53 6c65 6570 5469 Player...SleepTi
0000040: 6d65 7200 0009 0006 4d6f 7469 6f6e 0600 mer.....Motion..
0000050: 0000 033f 646e bd64 e3ad 5bbf b412 05c2 ...?dn.d..[.....
0000060: 8f5c 293f 4edd ba44 523d db01 0008 4f6e .\)?N..DR=....On
0000070: 4772 6f75 6e64 0102 0008 4875 7274 5469 Ground....HurtTi
0000080: 6d65 0000 0200 0648 6561 6c74 6800 1403 me.....Health...
0000090: 0009 4469 6d65 6e73 696f 6e00 0000 0002 ..Dimension.....
@TobiX
TobiX / gist:4131070
Created November 22, 2012 13:00
Bugfix for SynCrtSock (SSL/no Content-Length)
--- SynCrtSock.pas.orig 2012-11-21 08:16:54.000000000 +0100
+++ SynCrtSock.pas 2012-11-22 13:43:38.000000000 +0100
@@ -938,6 +938,8 @@
// corresponding to the file (e.g. by calling GetMimeContentType() function
// from SynCommons supplyings the file name)
HTTP_RESP_STATICFILE = '!STATICFILE';
+ // While reading an HTTP response, read it in blocks of this size. 8K for now.
+ HTTP_RESP_BLOCK_SIZE = 8*1024;
/// create a TCrtSocket, returning nil on error
@TobiX
TobiX / SynCrtSock.pas.diff
Created December 18, 2012 15:49
Patch for WinInet error handling
Index: SynCrtSock.pas
===================================================================
--- SynCrtSock.pas (revision 53301)
+++ SynCrtSock.pas (working copy)
@@ -900,9 +900,12 @@
/// WinINet exception type
EWinINet = class(Exception)
+ private
+ fCode: Cardinal;
@TobiX
TobiX / Debian Timescale Output
Last active December 11, 2015 12:59
Simple tool to calculate distance between Debian releases (and freezes)
--- Debian history ---
Version 0.93R6 was released 1995-10-26
235 days (0.64384 years) later came Version 1.1 (buzz)
178 days (0.48767 years) later came Version 1.2 (rex)
175 days (0.47945 years) later came Version 1.3 (bo)
414 days (1.13425 years) later came Version 2.0 (hamm)
228 days (0.62466 years) later came Version 2.1 (slink)
525 days (1.43836 years) later came Version 2.2 (potato) (freeze time: 212 days)
703 days (1.92603 years) later came Version 3.0 (woody) (freeze time: 383 days)
1053 days (2.88493 years) later came Version 3.1 (sarge) (freeze time: 34 days)
@TobiX
TobiX / laola.rb
Created May 24, 2013 13:37
Some crappy script I once did
#!/usr/bin/env ruby
# we do ECMA-48 / vt100 only - this may be portable or not...
TIOCGWINSZ = 0x5413
Alternative = true
if !Alternative then
NormalPerson = [
' o ',
'/O\\ ',