Skip to content

Instantly share code, notes, and snippets.

View aheadley's full-sized avatar

Alex Headley aheadley

View GitHub Profile
#!/bin/bash
# The minimum age (in days) of tiles to modify
MIN_AGE=7
# Number of simultaneous image modifications to run, default is the number of cores
MAX_PROCS="$(grep ^processor /proc/cpuinfo | wc -l)"
# Percent of saturation to apply to new image, should be an integer from 0-100
DESATURATION=90
if [ -z "$1" ]; then
@aheadley
aheadley / terminal-snowfall.sh
Created December 21, 2011 22:41 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
#SNOWFLAKE_CHAR='*'
SNOWFLAKE_CHAR='❄'
declare -A snowflakes
declare -A lastflakes
@aheadley
aheadley / timeclock.py
Created January 6, 2012 00:21 — forked from gmr/timespent_ranking.py
Reads in a minecraft server log ranking users by time spent
#!/usr/bin/env python
import datetime
import re
class LogParser(object):
"""
"""
def __init__(self):
self._data = {
'sync': function() {
$.getJSON(worldData.config.syncFilePath,
function(data) {
worldData.data.world = data.world;
worldData.data.players = data.players;
worldData.data.counts = data.counts;
worldData.data.map = data.map;
worldData.util.syncStatus();
worldData.util.syncMarkers();
worldData.update();
20:41 < aheadley> kahrl_: that's what i was figuring, can you give me just a real high level idea of what minetest does?
20:47 < kahrl_> aheadley: minetest calls each cube a mapnode; a mapnode consists of an ID (tree, dirt, dirt with grass, ...) and two
parameters (light and direction for torches etc.)
20:47 < kahrl_> 16x16x16 of these mapnodes are called a mapblock
20:48 < kahrl_> besides the nodes it can contain metadata for specific nodes (like the contents of chests) and static objects
(unloaded entities)
20:49 < kahrl_> a stack of those mapblocks (with the same X and Z value) is called a mapsector
20:49 < aheadley> is there a Y limit for mapsectors?
20:49 < kahrl_> the whole map is stored in a sqlite database, each row contains one mapblock
20:50 < kahrl_> Y goes from approx. -30900 to +30900
$ python test_builder.py
Traceback (most recent call last):
File "test_builder.py", line 1, in <module>
import builder
File "/home/overviewer/devel/Overviewer-Build/builder.py", line 354, in <module>
class EL5Builder(EL6Builder):
TypeError: Error when calling the metaclass bases
cannot create 'NoneType' instances
75% [=========================================== ] 1664/2210 15.33T/s ETA: 00:00:35
from overviewer_core.observer import Observer
import os
class AnnouncingObserver(Observer):
def __init__(self):
self.handle = open('/full/path/to/input_command', 'w')
super(AnnouncingObserver,self).__init__()
def finish(self):
self.handle.write("say Rendered %d of %d. %d%% complete\n" % (self.get_max_value(), self.get_max_value(), 100.0))
>>> r
(Array){
item[] =
(item){
key[] =
"code",
value[] =
1,
},
(item){
<config>
<plugin type="hesperus.plugins.irc.IRCPlugin">
<server>irc.freenode.net</server>
<port>6667</port>
<nick>box-bot</nick>
<channelmap>
<channel name="default">#overviewer</channel>
</channelmap>