Skip to content

Instantly share code, notes, and snippets.

View klen's full-sized avatar

Kirill Klenov klen

View GitHub Profile
""" Project Euler problem #6. """
def problem():
""" Solve the problem.
Find the difference between the sum of the squares of the first one hundred
natural numbers and the square of the sum.
Answer: 25164150
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFQQNgbNB4TmtdflMyki2VTyHUPmWkZISnVZ45oyNzkjaq4Vu5TgOignXcWYpFNO8kt07gv7ouX+nDudsbKGNyfarqJHqujVzxYySN+QlBgSBH9mBoUFdb7OrRhNXhEyW3AxOdIZov14KUuTSILKulS/wIPp6CmKLxQ55dkxpWqz5vrubgj9ZeSr6XpNgzIS+ds/eALTf/wlXGB4uTF/YXTf1M3O4SqH18XJxNZpCnc3zRplnJZKQAhzqjZJs63D+VZlpaalIfD/uMIMaId90iutB4TH8QHECWkn+vPSC96fbxRI/jo4MB8tLSI8u6DexP8A9jrt+EQV28wACJVK4z horneds@gmail.com
/usr/lib/plato/venv/bin/python /usr/lib/plato/source/manage.py syncdb --settings=main.settings.local --noinput || echo 'sync failed'
15.04 15:56:04 root INFO Core settings loaded.
15.04 15:56:04 root INFO Production settings are loaded.
15.04 15:56:04 root INFO Develop settings are loaded.
15.04 15:56:04 root INFO Vagrant settings are loaded.
15.04 15:56:04 root INFO Local settings are loaded.
Syncing...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions

An Ansible summary

Patterns

  • all (or *)
  • hostname: foo.example.com
  • groupname: webservers
  • or: webservers:dbserver
  • exclude: webserver:!phoenix
  • intersection: webservers:&staging
#!/usr/bin/env python
import random
from json import dump
def get_matrix_value():
return random.randint(10000, 99999)
@klen
klen / response
Last active August 29, 2015 14:04
[{u'deal_term_pfc': False,
u'event': {u'created_at': None,
u'id': u'5357baaff51600525c9e1397',
u'lifetime': u'BEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20140710T000000\r\nDTEND;VALUE=DATE-TIME:20140910T000000\r\nEND:VEVENT\r\n',
u'org': {u'contact': {},
u'desc': None,
u'id': u'5357b929f51600525c9e1396',
u'name': u'Organizator',
u'roles': [u'org'],
u'tags': []},
File "/usr/lib/ticketscloud/env/lib/python3.4/site-packages/raven/middleware.py", line 35, in __call__
iterable = self.application(environ, start_response)
File "/usr/lib/ticketscloud/env/lib/python3.4/site-packages/pyramid/router.py", line 242, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
File "/usr/lib/ticketscloud/env/lib/python3.4/site-packages/pyramid/router.py", line 217, in invoke_subrequest
response = handle_request(request)
File "/usr/lib/ticketscloud/env/lib/python3.4/site-packages/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "./ticketscloud/lib/tweens.py", line 52, in __call__
raise exc
[
{
"org": {
"desc": null,
"contact": {},
"name": "Organizator",
"tags": [],
"id": "5357b929f51600525c9e1396"
},
"deal": {
@klen
klen / configure
Last active September 3, 2021 05:31
OSX vim +python +python3 (pyenv)
#! /bin/sh
# This is just a stub for the Unix configure script, to provide support for
# doing "./configure" in the top Vim directory.
PY_CONFIG=`pyenv prefix 2.7.11/lib/python2.7/config`
PY3_PREFIX=`pyenv prefix 3.4.4`
PY3_CONFIG=`$PY3_PREFIX/bin/python-config --configdir`
cd src && exec ./configure \
from django.core.exceptions import ValidationError, PermissionDenied
from .models import QualityProcess
from .utils.flow import task_loader
from viewflow import flow, lock
from viewflow.base import Flow, this
class QualityFlow(Flow):