This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cykooz@cykooz-nb:~/Work/backend$ ./bin/python | |
Python 3.6.2 (default, Jul 20 2017, 08:43:29) | |
[GCC 5.4.1 20170519] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> | |
>>> from raven.base import DummyClient | |
>>> import psutil | |
>>> | |
>>> client = DummyClient() | |
>>> client.is_enabled = lambda: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cykooz@cykooz-nb:~/Work/backend$ ./bin/python | |
Python 3.6.2 (default, Jul 20 2017, 08:43:29) | |
[GCC 5.4.1 20170519] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> | |
>>> from raven.base import DummyClient | |
>>> import psutil | |
>>> | |
>>> psutil.Popen._Popen__subproc = None | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
:Authors: cykooz | |
:Date: 19.11.2015 | |
""" | |
import re | |
import six | |
from six.moves.urllib.parse import urlparse, parse_qsl, unquote_plus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def get_pdf_first_page(executors_manager: ExecutorsManager, src_path, dst_path, *, dpi=72, png=False): | |
"""Try to get a first page of the given pdf-file with GS, ignoring all errors.""" | |
command = [ | |
'gs', | |
'-q', | |
f'-r{dpi}', | |
'-dTextAlphaBits=4', | |
'-dGraphicsAlphaBits=4', | |
] | |
if png: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
:Version: 1.3.1 | |
Look for the latest version of the script in the GIST: | |
https://gist.github.com/Cykooz/118fba100c9ceb76ee822f7541d480c4 | |
""" | |
import argparse | |
import logging | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Pre-reading data from memory increases speed slightly for some operations | |
#[inline(always)] | |
fn foreach_with_pre_reading<D, I>( | |
mut iter: impl Iterator<Item = I>, | |
mut read_data: impl FnMut(I) -> D, | |
mut process_data: impl FnMut(D), | |
) { | |
let mut next_data: D; | |
if let Some(src) = iter.next() { | |
next_data = read_data(src); |