Skip to content

Instantly share code, notes, and snippets.

@atiaxi
atiaxi / preip.py
Created November 20, 2012 20:31
Persona list
#!/usr/bin/env python
import sys
IPS = {
'alice' : "10.0.5.101",
'bob' : "10.0.5.102",
'carol' : "10.0.5.103",
'dave' : "10.0.5.104",
'eliza' : "10.0.5.105",
@atiaxi
atiaxi / itertest.py
Created January 23, 2013 21:43
iteritems behaves strangely!
#!/usr/bin/env python
from collections import MutableMapping
class Itertest(MutableMapping):
def __init__(self):
self.underlying = {}
def __getitem__(self, key):
[
{
"name": "Periopolis",
"srname": "Periopolis",
"connections": ["Sapphire District"],
"capital": 1
},
{
"name": "Sapphire District",
#!/bin/bash
. /opt/reddit/etc/reddit-env.sh
# poor man's interpolation!
INI_FILE=$(mktemp)
trap "rm $INI_FILE" EXIT
cat > $INI_FILE <<EOF
[DEFAULT]
http_port = $STAGING_HTTP_PORT
@atiaxi
atiaxi / post-receive
Created December 18, 2013 21:56
post-receive
#!/bin/sh
sudo /sbin/stop valkyribot
GIT_WORK_TREE=/var/valkyribot git checkout -f
# Perform any necessary migrations
git rev-parse --verify HEAD > /var/faceless-games/valkyribot/VERSION
cd /var/valkyribot
/usr/local/bin/alembic --config=/etc/chromabot/alembic.ini upgrade head
# Bump the server
sudo /sbin/start valkyribot
@atiaxi
atiaxi / timeanalyze.py
Created June 10, 2014 19:48
Time analyzer
#!/usr/bin/env python
import sys
def main():
total = 0
entries = 0
outlier_total = 0
outlier_entries = 0
with open(sys.argv[1], "r") as infile:
@atiaxi
atiaxi / gist:a3b0793bc9a24502556b
Created July 11, 2014 14:32
That snippet for debugging hubot
robot.error (err, msg) ->
robot.logger.error err.stack
process.exit(1)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#### PEP8: Module names are usually lowercase; something like `chromabot_listener.py`
"""
The listening server for the Chromeconomist's connection with Chromabot.
Very, very sketchy and impromptu, my first try at something even remotely similar to a
REST-like API. Hopefully the pseudo-API I provide Reostra with, in addition to this listening
server, will allow Chromabot and Chromeconomist to mesh, adding new depth to the game.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#### PEP8: Module names should be lowercase, e.g. `chromeconomist.py`
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: James Boggs
# -*- coding: utf-8 -*-
#### PEP8: econ_buffs.py
"""
Created on Sun Dec 14 14:49:05 2014
@author: boggs
Module to retrieve defensive buffs from Chromeconomist's DB