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
import gc | |
import time | |
from twisted.internet import asyncioreactor | |
asyncioreactor.install() | |
from twisted.internet import reactor | |
def bug_reset_later(): |
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
from typing import TypeVar, Generic, Callable | |
import attr | |
from twisted.internet import defer | |
@attr.s(slots=True) | |
class _Result: | |
pending = attr.ib() | |
result = attr.ib() |
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
#ifndef __VARIANT_H | |
#define __VARIANT_H | |
#include <cstdio> | |
#include <typeinfo> | |
#include <map> | |
typedef void (*deleter)(void*); | |
typedef void* (*copier)(const void*); |
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
export const binarySearchByField = function (data, field, value) { | |
var r = data.length, l = -1, m; | |
while (r - l > 1) | |
if (data[m = r + l >> 1][field] < value) l = m | |
else r = m | |
return {l, r} | |
} | |
export const binarySearchByIndex0 = function (data, value) { |
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
from attr import dataclass | |
from rx import AnonymousObservable, Observable | |
from rx.core import ObservableBase | |
from rx.subjects import Subject | |
from twisted.internet import reactor, defer | |
from twisted.internet.defer import Deferred | |
from twisted.internet.protocol import Protocol, connectionDone, Factory | |
from twisted.python.failure import Failure | |
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: '2' | |
## INITIAL SETUP | |
# docker-compose run --rm ovpn ovpn_genconfig -u udp://<IP> | |
# docker-compose run --rm ovpn ovpn_initpki | |
# docker-compose up -d | |
# docker-compose run --rm ovpn easyrsa build-client-full myvpn nopass | |
# docker-compose run --rm ovpn ovpn_getclient myvpn > myvpn.ovpn | |
services: |
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
#include <cstdio> | |
class A { | |
public: | |
int x; | |
A(int x): x(x) {} | |
}; | |
class B: public A { |
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
WriteOp = Union[ | |
InsertOne, | |
UpdateOne, UpdateMany, | |
DeleteOne, DeleteMany, | |
ReplaceOne | |
] | |
class MongoCollectionQueue: | |
# FIXME: |
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
import sys | |
import os | |
import gc | |
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol | |
from twisted.internet.protocol import Protocol, Factory | |
from twisted.internet import ssl, defer, error | |
from twisted.internet.task import react | |
from twisted.protocols.loopback import loopbackAsync | |
import psutil |
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
from twisted.internet import defer | |
from klein import Klein | |
from mocked_db import Database | |
def users_aspect(app: Klein, db: Database): | |
@app.route('/') | |
@defer.inlineCallbacks |
NewerOlder