Skip to content

Instantly share code, notes, and snippets.

View apatrushev's full-sized avatar

Anton Patrushev apatrushev

View GitHub Profile
@apatrushev
apatrushev / background_loop.py
Last active July 27, 2018 20:07
background asyncio loop. the idea behind was to integrate asyncio code with sync code and/or other loops. this approach will work if you need not tight integration but will be happy with callbacks between (sync/your loop) and asyncio.
import time
import threading
import asyncio
import janus
class BackgroundLoopBase(threading.Thread):
def __init__(self, *args, **kwargs):
if len(args) > 1 or 'target' in kwargs:
raise RuntimeError('target override not supported')
extern crate actix;
extern crate tokio_core;
extern crate futures;
use std::time::Duration;
use futures::Stream;
use tokio_core::reactor::Interval;
use actix::prelude::*;
use actix::{Actor, Context, StreamHandler, SpawnHandle, Arbiter};
extern crate actix;
extern crate tokio;
extern crate tokio_codec;
extern crate futures;
extern crate bytes;
use bytes::BytesMut;
use std::io;
use std::net::SocketAddr;
use futures::{Stream, Sink, Future};
### Keybase proof
I hereby claim:
* I am apatrushev on github.
* I am apatrushev (https://keybase.io/apatrushev) on keybase.
* I have a public key ASDk0Vu7jZ9Oxm2Bs0DIUO9-Dr3iLsMSxwCSPzM02YOsSAo
To claim this, I am signing this object:
@apatrushev
apatrushev / test.sql
Last active September 11, 2017 12:22
CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z);
insert into t values (1, 2, 3);
insert into t values (2, 2, 3);
insert into t values (3, 2, 3);
insert into t values (4, 2, 3);
insert into t values (5, 2, 3);
insert into t values (6, 2, 3);
insert into t values (7, 2, 3);
insert into t values (8, 2, 3);
insert into t values (9, 2, 3);
from __future__ import print_function
from contextlib import closing, contextmanager
import os
import re
import sys
import tarfile
import tempfile
import shutil
import ssl
try:
import atexit
import os
import sys
from PyQt5.QtCore import QTimer, pyqtSignal, QProcess, QUrl
from PyQt5.QtGui import QTextCursor, QDesktopServices
from PyQt5.QtWidgets import (
QApplication,
QHBoxLayout,
QMainWindow,
import sys
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QPlainTextEdit,
QVBoxLayout,
QWidget
)
https://github.com/pyinstaller/pyinstaller/tarball/abfc806618b16ea2037d1d5a6b7272976b34562e
import os
import logging
import gevent
from gevent import socket
from gflows import (
SocketSource,
SocketWrapper,
Partitioner,
Transparent,