Skip to content

Instantly share code, notes, and snippets.

error: uncaptured python exception, closing channel <bot.jenny connected at 0x7fcae67f9128> (<type 'exceptions.IndexError'>:deque index out of range [/usr/lib64/python2.7/asyncore.py|write|87] [/usr/lib64/python2.7/asyncore.py|handle_write_event|454] [/usr/lib64/python2.7/asynchat.py|handle_write|174] [/usr/lib64/python2.7/asynchat.py|initiate_send|244])
Closed!
Warning: Disconnected. Reconnecting in 20 seconds...
def leave (self, phenny, input):
if not self.game_on or not self.deck:
return
if input.nick not in self.players:
return
if len(self.playerOrder) < 3:
phenny.reply("You can't leave a 2 player game.")
return
if input.nick == self.playerOrder[self.currentPlayer]:
def leave (self, phenny, input):
phenny.say("list before: " + str(self.playerOrder))
if not self.game_on or not self.deck:
return
if input.nick not in self.players:
return
if len(self.playerOrder) < 3:
phenny.reply("You can't leave a 2 player game.")
return
@myano
myano / gist:933540
Created April 21, 2011 02:05
web/dict.pm
use strict;
use warnings;
sophia_module_add('web.dict', '1.0', \&init_web_dict, \&deinit_web_dict);
sub init_web_dict {
sophia_command_add('web.dict', \&web_dict, 'Provides definitions of a given word.', '');
sophia_global_command_add('dict', \&web_dict, 'Provides definitions of a given word.', '');
return 1;
}
$ echo '{"query":"cat","sourceLanguage":"en","targetLanguage":"en","primaries":[{"type":"headword","terms":[{"type":"text","text":"cat","language":"en","labels":[{"text":"Verb","title":"Part-of-speech"}]},{"type":"phonetic","text":"/kat/","language":"und"},{"type":"sound","text":"http://www.gstatic.com/dictionary/static/sounds/de/0/cat.mp3","language":"und"}],"entries":[{"type":"related","terms":[{"type":"text","text":"cats","language":"und","labels":[{"text":"3rd person singular present"}]},{"type":"text","text":"catted","language":"und","labels":[{"text":"past participle"}]},{"type":"text","text":"catting","language":"und","labels":[{"text":"present participle"}]},{"type":"text","text":"catted","language":"und","labels":[{"text":"past tense"}]}]},{"type":"meaning","terms":[{"type":"text","text":"Raise (an anchor) from the surface of the water to the cathead","language":"en"}]}]},{"type":"headword","terms":[{"type":"text","text":"cat","language":"en","labels":[{"text":"Noun","title":"Part-of-speech"}]},{"typ
use warnings;
use JSON;
sophia_module_add('web.dict', '1.0', \&init_web_dict, \&deinit_web_dict);
sub init_web_dict {
sophia_command_add('web.dict', \&web_dict, 'Provides definitions of a given word.', '');
sophia_global_command_add('dict', \&web_dict, 'Provides definitions of a given word.', '');
return 1;
}
@myano
myano / cs.py
Created June 30, 2011 01:25
Quick example of ncurses in Python!
#!/usr/bin/env python
import curses
import curses.textpad
import time
stdscr = curses.initscr()
#curses.noecho()
#curses.echo()
@myano
myano / supercombiner.sh
Created July 23, 2011 12:33 — forked from sbp/supercombiner.sh
Supercombiner pasteboard script for Linux
#!/bin/bash
python -c '
import sys, unicodedata
s = "u"
for i in xrange(1, 3000):
if unicodedata.category(unichr(i)) == "Mn":
s += unichr(i)
if len(s) > 100: break
sys.stdout.write(s.encode("utf-8"))
@myano
myano / main.py
Created August 9, 2011 01:13
This file queries NOAA's severe weather alert ATOM feeds and displays each alert. One must provide the 6-digit FIPS code for the county. This code is pretty crude and was whipped up pretty quickly.
#!/usr/bin/env python
import feedparser
loc = raw_input("Please input county code: ")
feed_url = 'http://alerts.weather.gov/cap/wwaatmget.php?x=%s' % (loc)
feed = feedparser.parse(feed_url)
for x in feed.entries:
a = x["title"]
@myano
myano / profanity.py
Created August 17, 2011 15:28
This script checks to see if a given phrase is profane according to Google's Profane API.
#!/usr/bin/env python
# vim: set fileencoding=UTF-8 :
"""
This script checks to see if a given phrase is profane according to Google's
Profane API. This script returns a 'True' if it's profane, a 'False' if it's
not profane and a 0 if there is an error.
Copyright 2011 Michael Yanovich
Licensed under the GNU General Public License version 3.