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 zmq | |
from zmq.utils import z85 | |
server_public, server_secret = zmq.curve_keypair() | |
context = zmq.Context() | |
server = context.socket(zmq.PAIR) | |
server.set(zmq.CURVE_SECRETKEY, z85.decode(server_secret)) | |
server.set(zmq.CURVE_PUBLICKEY, z85.decode(server_public)) | |
server.set(zmq.CURVE_SERVER, True) | |
server.bind("tcp://127.0.0.1:5556") |
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
''' | |
https://github.com/OpenMined/PyPSI | |
''' | |
import gmpy2 | |
import secrets | |
import hashlib | |
from Crypto.PublicKey import RSA | |
class PSI(object): | |
def __init__(self, rsa_size=1024): |
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 Crypto import Random | |
from Crypto.Cipher import AES | |
from Crypto.Cipher import Salsa20 | |
from Crypto.Cipher import ChaCha20 | |
from Crypto.Cipher import ARC4 | |
from Crypto.Cipher import PKCS1_OAEP | |
from Crypto.Util import Padding | |
from Crypto.PublicKey import RSA | |
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 imaplib | |
import time | |
import email | |
import logging | |
import logging.config | |
logging_config = dict( | |
version=1, | |
formatters={'f': { | |
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' | |
}}, |
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 logging | |
import logging.config | |
import os | |
logging_config = dict( | |
version=1, | |
disable_existing_loggers=False, | |
formatters={'f': { | |
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' |
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 logging | |
import logging.config | |
logging_config = dict( | |
version=1, | |
formatters={'f': { | |
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' | |
}}, | |
handlers={'h': { | |
'class': 'logging.StreamHandler', | |
'formatter': 'f', |
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
package main | |
import ( | |
"log" | |
"strings" | |
"github.com/fsnotify/fsnotify" | |
) | |
type Event fsnotify.Op |
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 ctypes import * | |
import time | |
import datetime | |
class Record(Structure): | |
_fields_ = [ | |
("time", c_double), | |
("count", c_double) | |
] |
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 socket | |
import threading | |
import queue | |
HOST = '0.0.0.0' | |
PORT = 50000 | |
class Worker(threading.Thread): | |
def __init__(self, queue, **kwargs): |
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 -*- | |
from __future__ import print_function | |
import lxml.html | |
from collections import OrderedDict | |
import re | |
def after_first_check(func): |