Skip to content

Instantly share code, notes, and snippets.

View funvit's full-sized avatar
:shipit:
Hmm...

Vitaliy F. funvit

:shipit:
Hmm...
  • Russia, Moscow
View GitHub Profile
@funvit
funvit / comparision.py
Created October 29, 2018 18:56 — forked from dmahugh/comparision.py
comparison of asynchronous HTTP requests (aiohttp/asyncio) and traditional sequential requests (with Requests library)
"""Comparison of fetching web pages sequentially vs. asynchronously
Requirements: Python 3.5+, Requests, aiohttp, cchardet
For a walkthrough see this blog post:
http://mahugh.com/2017/05/23/http-requests-asyncio-aiohttp-vs-requests/
"""
import asyncio
from timeit import default_timer
@funvit
funvit / cash_dispenser_without_limits.py
Last active October 21, 2018 15:47
Тренировка ума. Решение задачи банкомата (выдача суммы купюрами наибольшего номинала). Вариант без лимитов.
# !/bin/python3.6
# Алгоритм банкомата, используя левостороннее дерево.
# Вариант без лимитов банкнот!
class Node(list):
# Левостороннее дерево
_value = None
_childrens = None
@funvit
funvit / check_brackets_syntax.py
Created October 20, 2018 18:20
Тренировка для ума. Решение задания по проверке синтаксиса правильного открытия/закрытия скобок.
import logging
class SomeSyntaxError(Exception): pass
class SyntaxError(SomeSyntaxError):
bracket = None
idx = -1
import logging
class SomeSyntaxError(Exception): pass
class SyntaxError(SomeSyntaxError):
bracket = None
idx = -1
@funvit
funvit / promise-router.js
Created June 13, 2018 19:18 — forked from joepie91/promise-router.js
Using Express.js with Promises
/* Without using express-promise-router...
* If either of the two Promise-returning methods ends up failing (ie. rejecting),
* an uncaught exception will be printed to stdout, and the client will never get
* a response - instead, they'll be stuck on an infinitely loading page.
*/
express = require("express").router();
router.get("/", function(req, res) {
Promise.try(function(){
@funvit
funvit / Default (OSX).sublime-keymap -- User
Created April 9, 2018 10:04 — forked from coldnebo/Default (OSX).sublime-keymap -- User
Sublime Text 2 fix for OSX home/end keys
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }
@funvit
funvit / docker-compose.yml
Created February 20, 2018 01:07 — forked from pwaller/docker-compose.yml
selenium hub docker-compose file
hub:
image: selenium/hub
ports:
- "127.0.0.1:4444:4444"
chrome:
image: selenium/node-chrome-debug
links: [hub]
external_links:
- myapplication_frontend_1:pdftables
"""
A TestRunner for use with the Python unit testing framework. It
generates a tabular report to show the result at a glance.
The simplest way to use this is to invoke its main method. E.g.
import unittest
import TestRunner
... define your tests ...
@funvit
funvit / pronounce_meduza_io_interview.js
Last active October 22, 2017 13:16
Прочитать голосом в браузере интервью с сайта meduza.io.
// Прочитать голосом интервью на сайте meduza.io
//
// Когда ты слишком ленив, что бы читать самому...
//
// Запуск: скопировать в консоль на стр интервью и запустить
function _say_with_voice(text, voice) {
var msg = new SpeechSynthesisUtterance(text);
msg.voice = voice;
@funvit
funvit / pronounce_meduza_io_interview.js
Created October 22, 2017 12:34
Прочитать голосом в браузере интервью с сайта meduza.io
// Прочитать голосом интервью на сайте meduza.io
//
// Когда ты слишком ленив, что бы читать самому...
//
// Запуск: скопировать в консоль на стр интервью и запустить
function _say_with_voice(text, voice) {
var msg = new SpeechSynthesisUtterance(text);
msg.voice = voice;