Skip to content

Instantly share code, notes, and snippets.

View kidig's full-sized avatar
☮️
Make code! Not war!

DmitrII Gerasimenko kidig

☮️
Make code! Not war!
  • Toronto, Canada
View GitHub Profile
@kidig
kidig / parse_schedule.py
Created April 4, 2014 11:29
Parse timetable from mosgortrans.org/pass3/
def parse_schedule_page(content):
doc = lxml.html.document_fromstring(content)
rows = doc.xpath('//table[@class="reqform"]/tr/td')
print "Rows:", len(rows)
description = ''
if len(rows):
description = " ".join([line.text_content().strip() for line in rows[0].xpath('.//h3')])
# n) Something text or
# n) Right text*
match = re.match(r'^\w\)\s+(.[^\*]*)(\*?)$', line, re.UNICODE)
if match and len(match.groups()):
answer = dict(zip(['text','right'], [x for x in match.groups() if len(x)]))
@kidig
kidig / nodejs-wd-sample.js
Last active December 19, 2015 19:29
This is a sample of using node.js, selenium wd for testing search at yandex.ru
var wd = require('wd'),
assert = require('assert'),
colors = require('colors'),
browser = wd.promiseRemote();
browser.on('status', function(info) {
console.log(info.cyan);
});
browser.on('command', function(meth, path, data) {
>>> import sqlite3
>>> sqlite3.version
'2.6.0'
>>> sqlite3.sqlite_version
'3.7.17'