Skip to content

Instantly share code, notes, and snippets.

View klen's full-sized avatar

Kirill Klenov klen

View GitHub Profile
@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': []},
#!/usr/bin/env python
import random
from json import dump
def get_matrix_value():
return random.randint(10000, 99999)

An Ansible summary

Patterns

  • all (or *)
  • hostname: foo.example.com
  • groupname: webservers
  • or: webservers:dbserver
  • exclude: webserver:!phoenix
  • intersection: webservers:&staging
/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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFQQNgbNB4TmtdflMyki2VTyHUPmWkZISnVZ45oyNzkjaq4Vu5TgOignXcWYpFNO8kt07gv7ouX+nDudsbKGNyfarqJHqujVzxYySN+QlBgSBH9mBoUFdb7OrRhNXhEyW3AxOdIZov14KUuTSILKulS/wIPp6CmKLxQ55dkxpWqz5vrubgj9ZeSr6XpNgzIS+ds/eALTf/wlXGB4uTF/YXTf1M3O4SqH18XJxNZpCnc3zRplnJZKQAhzqjZJs63D+VZlpaalIfD/uMIMaId90iutB4TH8QHECWkn+vPSC96fbxRI/jo4MB8tLSI8u6DexP8A9jrt+EQV28wACJVK4z horneds@gmail.com
""" 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
""" Project Euler problem #5. """
from fractions import gcd
def problem():
""" Solve the problem.
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
""" Project Euler problem #4. """
import itertools as it
def problem():
u""" Solve the problem.
A palindromic number reads the same both ways. The largest palindrome made
from the product of two 2-digit numbers is 9009 = 91 * 99.
@klen
klen / euler3.py
Last active August 29, 2015 13:57
""" Project Euler problem #3. """
def problem():
""" Solve the problem.
What is the largest prime factor of the number 600851475143 ?
Answer: 6857
""" Project Euler problem #2. """
def problem():
""" Solve the problem.
By considering the terms in the Fibonacci sequence whose values do not
exceed four million, find the sum of the even-valued terms.
Answer: 4613732