Skip to content

Instantly share code, notes, and snippets.

View gist:d737bee93bc2dc49acf09251e6863b66
from copy import deepcopy
from types import SimpleNamespace
from hypothesis import note, settings
from hypothesis.stateful import (invariant, precondition, rule,
RuleBasedStateMachine)
DIM = 3
SIZE = DIM * DIM
View gist:448a40457470d57f94edf56e59ab84de
03:59:23:~/simplegui$ sudo apt-get install python-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-tk is already the newest version (2.7.15~rc1-1).
python-tk set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
04:40:39:~/simplegui$ sudo apt-get install python3-tk
Reading package lists... Done
Building dependency tree
View fox_hen_grain.py
from hypothesis import note, settings
from hypothesis.stateful import RuleBasedStateMachine, rule, invariant, precondition
from hypothesis import strategies as st
class Item():
def __init__(self, name):
self.crossed = False
self.name = name
@sureshvv
sureshvv / diehard.py
Last active Jul 29, 2019
diehard.py
View diehard.py
from hypothesis import note, settings
from hypothesis.stateful import RuleBasedStateMachine, rule, invariant, precondition
from hypothesis import strategies as st
class Person():
def __init__(self, time_taken):
self.crossed = False
self.time_taken = time_taken
View gist:a29cdb389f5f9a2b5952590d92b47a4b
http://stackoverflow.com/questions/3847386/testing-if-a-list-contains-another-list-with-python
http://stackoverflow.com/questions/425604/best-way-to-determine-if-a-sequence-is-in-another-sequence-in-python
http://stackoverflow.com/questions/3313590/check-for-presence-of-a-sublist-in-python
View gist:4d7adbd495ba17fb4c468a120f55ec74
2016-11-07 08:51:25 default[test] [2016-11-07 08:51:25 +0000] [5] [INFO] Starting gunicorn 19.6.0
2016-11-07 08:51:25 default[test] [2016-11-07 08:51:25 +0000] [5] [INFO] Listening at: http://0.0.0.0:8080 (5)
2016-11-07 08:51:25 default[test] [2016-11-07 08:51:25 +0000] [5] [INFO] Using worker: sync
2016-11-07 08:51:25 default[test] [2016-11-07 08:51:25 +0000] [8] [INFO] Booting worker with pid: 8
2016-11-07 08:53:31 default[test] [2016-11-07 08:53:31 +0000] [5] [CRITICAL] WORKER TIMEOUT (pid:8)
2016-11-07 08:53:31 default[test] [2016-11-07 08:53:31 +0000] [8] [INFO] Worker exiting (pid: 8)
2016-11-07 08:53:31 default[test] [2016-11-07 08:53:31 +0000] [10] [INFO] Booting worker with pid: 10
2016-11-07 08:54:02 default[test] [2016-11-07 08:54:02 +0000] [5] [CRITICAL] WORKER TIMEOUT (pid:10)
2016-11-07 08:54:02 default[test] [2016-11-07 08:54:02 +0000] [10] [INFO] Worker exiting (pid: 10)
2016-11-07 08:54:03 default[test] [2016-11-07 08:54:03 +0000] [12] [INFO] Booting worker with pid: 12
View gist:a89da9640254f403b399
class IMyEditComment(Interface):
eff_date = schema.Datetime(title=_(u"Effective date"), required=False)
exp_date = schema.Datetime(title=_(u"Expiration date"), required=False)
class MyEditCommentForm(EditCommentForm):
"""Form to edit an existing comment."""
form.extends(EditCommentForm, ignoreButtons=True)
fields += field.Fields(IMyEditComment)
View gist:e252b69bc5e0b12c701b
Traceback (most recent call last):
File "/home/suresh/vnc/vnc-plone-buildout/parts/instance/bin/interpreter", line 419, in <module>
exec(compile(__file__f.read(), __file__, "exec"))
File "/home/suresh/vnc/vnc-plone-buildout/eggs/Zope2-2.13.21-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
run()
File "/home/suresh/vnc/vnc-plone-buildout/eggs/Zope2-2.13.21-py2.7.egg/Zope2/Startup/run.py", line 22, in run
starter.prepare()
File "/home/suresh/vnc/vnc-plone-buildout/eggs/Zope2-2.13.21-py2.7.egg/Zope2/Startup/__init__.py", line 86, in prepare
self.startZope()
File "/home/suresh/vnc/vnc-plone-buildout/eggs/Zope2-2.13.21-py2.7.egg/Zope2/Startup/__init__.py", line 262, in startZope
@sureshvv
sureshvv / gist:5483690
Last active Dec 16, 2015
eight queens
View gist:5483690
def solve():
board = [ [' ' for i in range(8) ] for j in range(8) ]
start = [ 0 ] * 8
row = 0
nq = 0
turn_on = False
while row < 8:
col = start[row]
while col < 8:
added = add_a_queen(board, row, col)
@sureshvv
sureshvv / test script
Created Mar 4, 2013
stable sort in python
View test script
from random import choice
from operator import attrgetter
years = range(1992, 1995)
months = range(1, 3)
day = range(1, 3)
idx = range(2)
class A(object):
def __init__(self):