Skip to content

Instantly share code, notes, and snippets.

View voroninman's full-sized avatar
🇺🇦

Viktor Voronin voroninman

🇺🇦
View GitHub Profile
#!/bin/bash
#.git/hooks/prepare-commit-msg
echo `git rev-parse --abbrev-ref HEAD` >> $1
for (var items = document.querySelectorAll('[id*="audio_info"]'), l = items.length - 1; l >= 0; l--) {
try {
console.log(items[l].value.match(/.*\.mp3/)[0]);
} catch (e) {}
}
"""
Question:
Suppose I had a network of switches, or more generally, Nodes. Each Node
has a method getNeighbors(), which returns a set of adjacent Nodes in the
network. Write a function findNeighborhood(Node, n) which given a Node and
int n returns all nodes no more than n hops away.
Python 3.x
"""
Question:
Design a deck of cards that can be used for different card games
Python 3.x
"""
"""
Code snippet for changing Django user's password.
It implies that your unique user's field is email.
Start Django's shell and run code below:
cd /path/to/project
python manage.py shell
Or use built-in `changepassword` command:
cd /path/to/project
import sys
import xml.etree.cElementTree as et
def main(file_path):
f = open(file_path, 'r')
iter = et.iterparse(f)
print '<html><meta charset="utf8">'
for event, elem in iter:

Engineering Excellence Scorecard

Process Questions
Product/Project Management
  • Do we have clearly articulated goals and measures of success for every project?
  • Do we have clearly articulated scope for every project?
Development
  • Do we have predictable and repeatable process?
  • Do we have clear doneness criteria?
  • Do we have any impediments to productivity?
Source Code Management
  • Do we have an effective branching model?
Release
  • Do we have zero downtime release process?
  • Do we have continius integration?
QA
  • Do we have 100% code review coverage?
  • Do we have 80%+ automated unit test coverage?
  • Do we have 80%+ automated integration test coverage?
  • Do our staging environments adequately represent production environments?
Monitoring Are we alerted to all critical issues?Are we warned before issues b
from functools import reduce
checkio = lambda number: reduce(lambda x, y: x * y,
filter(lambda digit: digit,
map(int, str(number))))
assert checkio(1) == 1, 'The simplest one'
assert checkio(10) == 1, 'With zero'
assert checkio(234) == 24, '234'
import re;p=lambda n:not re.match(r'^1?$|^(11+?)\1+$','1'*n)
d=lambda s:s==s[::-1]
def golf(n):
while 1:
n+=1
if p(n)*d(str(n)):return n
@voroninman
voroninman / save_postgres_docs_as_html_file.py
Last active February 18, 2017 16:37
Download and save PostgreSQL documentation as a single HTML-page replacing URLs with HTML anchors
"""
Download and save PostgreSQL documentation as a single
HTML-page replacing URLs with HTML anchors.
To convert the resulting HTML file to an e-book use
appropriate online services.
Be carful opennig it in a browser. The resulting HTML
could be heavy.
"""