Skip to content

Instantly share code, notes, and snippets.

View MostAwesomeDude's full-sized avatar

Corbin Simpson MostAwesomeDude

View GitHub Profile
def fib():
i, j = 0, 1
while True:
yield i
i, j = j, i + j
diff --git a/beta/plugins/generators.py b/beta/plugins/generators.py
index 2412c8e..b0fd832 100644
--- a/beta/plugins/generators.py
+++ b/beta/plugins/generators.py
@@ -22,8 +22,10 @@ class BoringGenerator(object):
Fill the bottom half of the chunk with stone.
"""
+ stone = blocks["stone"].slot
+
#!/usr/bin/env python
"""The results from my computer:
Good headers:
List creation and iteration: 4.34622311592
List iteration and substitution: 3.61615085602
LC (spendy): 9.65025401115
Mixed headers:
List creation and iteration: 8.39401197433
def save_to_packet(self):
"""
Generate a chunk packet.
"""
array = [chr(i) for i in self.blocks.ravel()]
array += pack_nibbles(self.metadata)
array += pack_nibbles(self.skylight)
array += pack_nibbles(self.lightmap)
packet = make_packet("chunk", x=self.x * 16, y=0, z=self.z * 16,
diff --git a/creepy/creepymap.py b/creepy/creepymap.py
index 2baf278..5bb3033 100644
--- a/creepy/creepymap.py
+++ b/creepy/creepymap.py
@@ -86,6 +86,7 @@ class CreepyUI(gtk.Window):
tmp_conf = ConfigObj(infile=config_file)
tmp_conf.create_empty=True
tmp_conf.write_empty_values=True
+ tmp_conf['directories'] = {}
tmp_conf['directories']['img_dir'] = os.path.join(self.CONF_DIR, 'images')
[simpson@athena ~/Nu] ( >&) $ ./packets.py minecraft_server-1.4.jar
Grepping the JAR...
Guessing packet class fy.class
Found packet 0: gx
Found packet 1: hy
Found packet 2: hd
Found packet 3: ik
Found packet 4: eg
Found packet 5: j
Found packet 6: jj
Found all packets; analyzing...
-Packet 0: gn.class
-Packet 1: hm.class
+Packet 0: gx.class
+Packet 1: hy.class
To read the packet:
readInt
readUTF
@@ -69,28 +70,28 @@
writeLong
Grepping the JAR...
Guessing packet class gc.class
Found packet 1: hb
Found packet 1: id
Found packet 1: hh
Found packet 1: iq
Found packet 0: ek
Found packet 0: k
Found packet 0: jr
Found packet 1: a
Grepping the JAR...
defaultdict(<type 'list'>, {'gj.class': ['Protocol error, unexpected packet'], 'gc.class': ['Bad packet id ', 'Duplicate packet class:', 'Duplicate packet id:', 'Skipping packet with id '], 'cl.class': ['Failed to handle packet: ']})
Guessing packet class gc.class
Found packet 0 (True, True): hb
Found packet 1 (True, True): id
Found packet 2 (True, True): hh
Found packet 3 (True, True): iq
Found packet 4 (True, False): ek
Found packet 5 (True, False): k
Found packet 6 (True, False): jr
#!/usr/bin/env python
from collections import defaultdict
from hashlib import sha512
from pprint import pprint
from StringIO import StringIO
import sys
from zipfile import ZipFile
from nu.bytecode import StreamDisassembler