Skip to content

Instantly share code, notes, and snippets.

"""Usage:
pymodoro start <taskname> [--minutes=<minutes>]
Options:
--version Show program's version number and exit
-h, --help Show this help message and exit
"""
import time
import datetime
import urwid
def on_exit_clicked(button):
raise urwid.ExitMainLoop()
def exit_on_q(key):
if key.upper() == 'Q':
raise urwid.ExitMainLoop()
def task_question():
import argparse
parser = argparse.ArgumentParser(description='Prints stuff out')
parser.add_argument("thingy")
parser.add_argument("separator", nargs='?', default="")
options = parser.parse_args()
print(options.separator.join([x for x in options.thingy]))
import urwid
def on_exit_clicked(button):
raise urwid.ExitMainLoop()
def exit_on_q(key):
if key.upper() == 'Q':
raise urwid.ExitMainLoop()
def task_question():
def command_live(self, rest):
player = rest.partition(' ')
if player:
# find the player on lichess
pass
else:
# show all channel members on lichess
pass
import sys
import urllib2
import json
import collections
from twisted.internet import defer, endpoints, protocol, reactor, task
from twisted.python import log
from twisted.words.protocols import irc
@mekhami
mekhami / fen.py
Last active March 21, 2016 19:10
import sys
import unittest
class ChessGame(object):
fen_startpos = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
fen_test = "rnbqkb1r/1p2pppp/p2p1n2/8/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq -"
def __init__(self):
self.board = [["#"]*12 for i in range(12)]
self.turn = "-"
execute pathogen#infect()
syntax on
filetype plugin indent on
set ts=4
set sw=4
set sts=4
set textwidth=79
set expandtab
set autoindent
from copy import deepcopy
grid = [[0]*10 for x in range(8)]
grid[4][4] = 1
grid[4][5] = 1
grid[4][6] = 1
def life_check(grid, x, y):
import unittest
from gameoflife import life_check, run_mutations
class GameofLifeTest(unittest.TestCase):
def setUp(self):
# Set up a grid with a blinker
grid = [[0]*8 for x in range(8)]
grid[4][4] = 1