Skip to content

Instantly share code, notes, and snippets.

@sureshvv
sureshvv / gist:e252b69bc5e0b12c701b
Created February 23, 2015 05:04
Instance startup error
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
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)
@sureshvv
sureshvv / test script
Created March 4, 2013 06:24
stable sort in python
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):
@sureshvv
sureshvv / gist:5483690
Last active December 16, 2015 19:18
eight queens
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 / gist:4d7adbd495ba17fb4c468a120f55ec74
Created November 7, 2016 09:15
Result from gcloud app logs read
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
@sureshvv
sureshvv / gist:a29cdb389f5f9a2b5952590d92b47a4b
Created February 16, 2017 06:41
check list for sublist
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
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
@sureshvv
sureshvv / fox_hen_grain.py
Created June 10, 2017 05:03
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 July 29, 2019 00:07
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
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