Skip to content

Instantly share code, notes, and snippets.

trying to quit vim

Ilya Lebedev Melevir

trying to quit vim
Block or report user

Report or block Melevir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Melevir /
Last active Sep 9, 2016
Тест того, что быстрее: sqrt или **
import math
from datetime import timedelta, datetime
def get_time(callable_stuff, tries=10):
deltas = []
for _ in range(tries):
now =
deltas.append( - now)
import requests
from bs4 import BeautifulSoup
def get_product_info_from_website(sku):
host = ''
search_page_text = requests.get('%s/search' % host, params={'q': sku}).text
page = BeautifulSoup(search_page_text)
url = page.find('div', {'class': 'catalog-product-title'})
if not url:
import os
import string
import itertools
from datetime import datetime
import elaphe
def create_dirs():
if not os.path.exists('data'):
View gist:d615635444254a45f7f7
count(*) as msg_count
FROM users
JOIN messages on users.uid = messages.uid
GROUP BY users.uid;
View gist:284d03d7606364787c69
def zip_long(keys, values):
""" Версия zip, которая не удаляет лишние ключи, а оставляет их со значениями None"""
values += [None] * (len(keys) - len(values))
return dict(zip(keys, values))
def test_zip_long():
""" Тестирование для бедных.
При запуске выполнит тестирование функции zip_long и вернет True если тесты прошли
(иначе выкинет AssetrionError).
Melevir / gist:6689056
Created Sep 24, 2013
GitHub Search API example with hammock
View gist:6689056
from hammock import Hammock as Github
github = Github('')
headers = {'Accept': 'application/vnd.github.preview'}
resp ={'q': 'language:python', 'sort': 'stars', 'per_page': 10, 'page': 1}, headers=headers)
res = resp.json()
print res['items'][0]['full_name']
print len(res['items'])
You can’t perform that action at this time.