Skip to content

Instantly share code, notes, and snippets.

View gist:645127
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...
View gist:646089
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]:
View gist:646117
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
View gist:933540
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;
}
View gist:933678
$ 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
View gist:933688
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 Jun 30, 2011
Quick example of ncurses in Python!
View cs.py
#!/usr/bin/env python
import curses
import curses.textpad
import time
stdscr = curses.initscr()
#curses.noecho()
#curses.echo()
@myano
myano / supercombiner.sh
Created Jul 23, 2011 — forked from sbp/supercombiner.sh
Supercombiner pasteboard script for Linux
View supercombiner.sh
#!/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 Aug 9, 2011
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.
View main.py
#!/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 Aug 17, 2011
This script checks to see if a given phrase is profane according to Google's Profane API.
View profanity.py
#!/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.