Skip to content

Instantly share code, notes, and snippets.

Anton Patrushev apatrushev

Block or report user

Report or block apatrushev

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
@apatrushev
apatrushev / background_loop.py
Last active Jul 27, 2018
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.
View background_loop.py
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')
View closable.rs
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};
View actix-udp.rs
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};
View Keybase Proof
### 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:
View test.sql
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);
View virtualenv-bootstrap.py
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:
View lektor.py
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,
View hello.py
import sys
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QPlainTextEdit,
QVBoxLayout,
QWidget
)
View pyinstaller
https://github.com/pyinstaller/pyinstaller/tarball/abfc806618b16ea2037d1d5a6b7272976b34562e
View server_socket.py
import os
import logging
import gevent
from gevent import socket
from gflows import (
SocketSource,
SocketWrapper,
Partitioner,
Transparent,
You can’t perform that action at this time.