Skip to content

Instantly share code, notes, and snippets.

@brownan
brownan / consoledump.py
Created September 28, 2011 13:41
Print the output of a command line command in hexdump format
#!/usr/bin/env python
import sys
import pty
import os
import subprocess
import string
"""
An example script to show how Python's pty module can be used to capture the
@brownan
brownan / baud.py
Created October 3, 2011 19:47
Run commands as if connecting through a slow modem
#!/usr/bin/env python
from __future__ import division
import sys
import pty
import os
import subprocess
import termios
import fcntl
@brownan
brownan / ccmap.svg
Created October 19, 2011 03:39
Canopy Carnage Map
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brownan
brownan / chain.py
Created November 11, 2011 14:40
Simple markov chain generator
from __future__ import division
import collections
from StringIO import StringIO
import sys
import random
def analyze(string, k):
# Maps strings of length k to dictionaries of charcter to frequency counts
markovchain = collections.defaultdict(lambda: collections.defaultdict(int))
gistfile1.o: In function `main':
gistfile1.c:(.text+0x73): undefined reference to `rs_region_open'
gistfile1.c:(.text+0xa9): undefined reference to `rs_region_get_chunk_timestamp'
gistfile1.c:(.text+0xcb): undefined reference to `rs_region_get_chunk_length'
gistfile1.c:(.text+0xed): undefined reference to `rs_nbt_parse_from_region'
gistfile1.c:(.text+0xfd): undefined reference to `rs_nbt_get_root'
gistfile1.c:(.text+0x112): undefined reference to `rs_tag_compound_get'
gistfile1.c:(.text+0x127): undefined reference to `rs_tag_compound_get'
gistfile1.c:(.text+0x137): undefined reference to `rs_tag_list_get_length'
gistfile1.c:(.text+0x14d): undefined reference to `rs_tag_list_iterator_init'
@brownan
brownan / gist:1428820
Created December 4, 2011 01:46
multiworld configuration mockup
# Worlds are specified as keys in the pre-defined "render" dictionary
#
# all options about rendering a world go in a configuration dictionary as
# values of this render dict
render["world"] = {
"rendermodes": ["smooth-lighting", "smooth-night"],
"north-direction": ["upper-left"],
}
@brownan
brownan / gist:1434861
Created December 5, 2011 19:18
Another overviewer configuration mockup idea
# Each render is declared by an entry in the renders dictionary. Tiles
# outputted go into a directory named by the dictionary key
# The following two declarations define renders for one world, but two
# rendermodes. They are both defined explicitly here and linked together below.
renders["world-smooth-lighting"] = {
"name": "Day",
"worldpath": "/opt/mc/server/world",
"rendermode": "smooth-lighting"
"north-direction": "upper-left",
@brownan
brownan / workflow.txt
Created December 10, 2011 17:14
Overviewer Workflow
Classes used in rendering
=========================
* World
* QuadtreeGen
* RenderNode
* MapGen
from overviewer_core import dispatcher
from overviewer_core import signals
import hashlib
import string
import os
import sys
import socket
def md5(s):
[translation:ERROR] Error:
[translation:ERROR] Traceback (most recent call last):
[translation:ERROR] File "translate.py", line 308, in main
[translation:ERROR] drv.proceed(goals)
[translation:ERROR] File "/home/andrew/pypy/source/pypy/translator/driver.py", line 809, in proceed
[translation:ERROR] return self._execute(goals, task_skip = self._maybe_skip())
[translation:ERROR] File "/home/andrew/pypy/source/pypy/translator/tool/taskengine.py", line 116, in _execute
[translation:ERROR] res = self._do(goal, taskcallable, *args, **kwds)
[translation:ERROR] File "/home/andrew/pypy/source/pypy/translator/driver.py", line 286, in _do
[translation:ERROR] res = func()