Skip to content

Instantly share code, notes, and snippets.

@whutch
whutch / hidespace.py
Last active February 12, 2018 23:42
Hide/find messages hidden in text indentation.
#!/usr/bin/env python
"""Hide/find messages hidden in text indentation."""
import argparse
from collections import deque
import os
from os.path import exists
# Command line parsing stuff.
PARSER = argparse.ArgumentParser(description="Hide/find messages hidden in text indentation.")
"""
Install:
sudo pip install praw
git clone https://github.com/PurelyApplied/roll_one_for_me
cd roll_one_for_me
wget https://gist.githubusercontent.com/whutch/418cd6a7d8048b3ec2bcdc13a59133c6/raw/roll.py
Example usage:
@whutch
whutch / accuweather.py
Created March 18, 2016 22:27
Game module for Clockwork that demonstrates terminal manipulation possibilities.
# -*- coding: utf-8 -*-
"""Weather monitor; example of client terminal manipulation."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2016 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from ... import settings
from ...contrib.weather.patterns import WeatherPattern
from ...contrib.worldgen.maps import _render_map_data, render_map_from_layers
from ...core.events import EVENTS
@whutch
whutch / testweather.py
Last active February 15, 2016 21:02
Atria weather system test script
from time import sleep, time
from subprocess import call
from atria.contrib.weather.patterns import WeatherPattern
from atria.contrib.worldgen.maps import (_render_map_data,
render_map_from_layers)
from atria.contrib.worldgen.terrain import _parse_terrain_grid
from atria.libs.miniboa import colorize
@whutch
whutch / lumberjacking.py
Last active March 15, 2016 20:11
Example contrib modules for Clockwork
from functools import partial
from cwmud.contrib.crafting import Material
from cwmud.contrib.gathering import GatheringNode
from cwmud.core.characters import CharacterShell
from cwmud.core.commands import COMMANDS
from cwmud.core.items import Item, ITEMS, Trash
from cwmud.core.skills import AbilityCommand, Skill, SKILLS
@whutch
whutch / testgame.py
Created January 26, 2016 19:19
Test game module for Atria
# -*- coding: utf-8 -*-
"""A test game for prototyping."""
# Part of Atria MUD Server (https://github.com/whutch/atria)
# :copyright: (c) 2008 - 2016 Will Hutcheson
# :license: MIT (https://github.com/whutch/atria/blob/master/LICENSE.txt)
import re
from .. import settings
from ..core.accounts import Account, AccountMenu, AccountName
@whutch
whutch / mapgen.patch
Created January 14, 2016 02:27
Patch for Atria to turn it into a map generation server
diff --git a/atria/core/server.py b/atria/core/server.py
index f85c091..0c180b2 100644
--- a/atria/core/server.py
+++ b/atria/core/server.py
@@ -23,6 +23,7 @@ from .storage import STORES
from .timing import TIMERS
from .utils.exceptions import ServerReboot, ServerReload, ServerShutdown
from .utils.funcs import joins
+from .world import MapShell
@whutch
whutch / mineavoider.js
Last active December 9, 2015 21:45
A Bot Land mine avoider
init = function () {
started = false;
count = 0;
}
update = function () {
if (!started && (x != 0 || y != 0))
moveTo(0,0);
else
started = true;
@whutch
whutch / cheatsheet.js
Last active December 9, 2015 21:05
Bot Land JS Cheat Sheet
// GLOBALS
life // bot's current life (out of 1000?)
x // bot's current x coordinate
y // bot's current y coordinate
arenaWidth
arenaHeight
sharedA
sharedB
sharedC
@whutch
whutch / d2replayutils.py
Last active December 27, 2015 01:19
Dota 2 replay analysis stuff
import tarrasque
# Mapping of hero dt_key values to their keys in the CombatLogNames string table
hero_clnames = {
# This list is incomplete! I add to it whenever I hit a new hero parsing
"DT_DOTA_Unit_Hero_Abaddon": "npc_dota_hero_abaddon",
"DT_DOTA_Unit_Hero_Alchemist": "npc_dota_hero_alchemist",
"DT_DOTA_Unit_Hero_AncientApparition": "npc_dota_hero_ancient_apparition",
"DT_DOTA_Unit_Hero_Axe": "npc_dota_hero_axe",
"DT_DOTA_Unit_Hero_Bane": "npc_dota_hero_bane",