source
stringlengths
3
86
python
stringlengths
75
1.04M
quick_server.py
""" The following code has been adapted from mpld3. Modifications (c) 2014, Zachary King. mpld3, http://mpld3.github.io/, A Simple server used to show mpld3 images. Copyright (c) 2013, Jake Vanderplas All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted p...
test_statsd_thread_safety.py
# stdlib from collections import deque from functools import reduce import threading import time import unittest # 3p from mock import patch # datadog from datadog.dogstatsd.base import DogStatsd from datadog.util.compat import is_p3k class FakeSocket(object): """ Mocked socket for testing. """ def ...
workers_manager.py
import importlib import threading from pip import main as pip_main from apscheduler.schedulers.background import BackgroundScheduler from interruptingcow import timeout from functools import partial from logger import _LOGGER from workers_queue import _WORKERS_QUEUE class WorkersManager: class Command: def __in...
rsa_key_pair_signer.py
# coding:utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"...
tmp.py
""" Manages uploading files from encoders to origins. Also deals with multiple origins, timeouts, retries, and parallelism of uploads """ from __future__ import absolute_import from __future__ import print_function import os import threading import time from six.moves import queue as Queue from uplynkcore.logger import...
test_interface.py
# Copyright 2017 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
net.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import absolute_import, division, print_function, unicode_literals """Test helpers for networking. """ import os import re import requests import so...
_mDNS.py
import mdns import socket import struct import threading HANDLERS = [] def handler(func): if func not in HANDLERS: HANDLERS.append(func) return func class dnssocket: def __init__(self, proto='ipv4', address=None, broadcast_ip=None) -> None: if proto not in ('ipv4', 'ipv6'): raise ValueError("Inva...
Win32Service.py
#encoding=utf-8 import win32serviceutil import win32service import win32event import os import logging import inspect import servicemanager import sys import win32timezone import threading from main import Bing bing = Bing() class PythonService(win32serviceutil.ServiceFramework): ...
clamscanner.py
#!/usr/bin/env python3 import json import queue import sys import time import argparse import threading from multiprocessing import cpu_count from pathlib import Path from subprocess import Popen, PIPE, TimeoutExpired from threading import Thread, Lock, Event from typing import List, Tuple, Iterator, Set, Optional, Nam...
test_cpu_sampler.py
# (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2020 import time import unittest import random import threading import sys import traceback from instana.autoprofile.profiler import Profiler from instana.autoprofile.runtime import runtime_info from instana.autoprofile.samplers.cpu_sampler import CPUSampler...
asyncorereactor.py
# Copyright 2013-2016 DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
VideoDisplay.py
import cv2 import os import threading from PyQt5.QtWidgets import QFileDialog, QLCDNumber from PyQt5.QtGui import QImage, QPixmap # from test import test as test, cut_picture from test import cut_picture # os.environ["CUDA_VISIBLE_DEVICES"] = "-1" class Display: def __init__(self, ui, mainWnd): self.ui = ...
streaming.py
""" Streaming Parallel Data Processing =================================================================== Neuraxle steps for streaming data in parallel in the pipeline .. Copyright 2019, Neuraxio Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in com...
Demo.py
#This short demo was created by Athanasios Raptakis and Viacheslav Honcharenko #during WS2017 for the Robotics Practical Lip articulation Roboface at heidelberg uni import numpy as np from threading import Thread, Event import face from time import sleep, time import os from scipy.io import wavfilerenko from scipy.n...
perfmon.py
''' monitor CPU usage ''' from __future__ import division import os, sys from threading import Thread from ctypes import WinError, byref, c_ulonglong from time import clock, sleep from traceback import print_exc from cStringIO import StringIO from datetime import datetime from common.commandline import where from...
main.py
#! python3 ''' main method along with argument parsing functions ''' # ************************************************************ # Imports # ************************************************************ import sys # Verify Python version if sys.version_info[0] <= 3 and sys.version_info[1] < 7: sys.exit("This scr...
test_disconnect.py
import asyncio import logging import multiprocessing as mp from io import StringIO from queue import Empty import numpy as np import ucp mp = mp.get_context("spawn") async def mp_queue_get_nowait(queue): while True: try: return queue.get_nowait() except Empty: pass ...
frontend.py
import logging import os import threading import time import pykka import requests from mopidy import core import netifaces from . import Extension from .brainz import Brainz logger = logging.getLogger(__name__) class PiDiConfig: def __init__(self, config=None): self.rotation = config.get("rotation", ...
ultrasound_tracker.py
""" Functions to receive ultrasound frames and track muscle thickness This file contains the code to receive data from the ultrasound machine, and display the received images. It also contains the tracking code that allows the user to select areas of the muscle to track, and performs optical flow tracking to determine...
player.py
""" The MIT License (MIT) Copyright (c) 2021 xXSergeyXx Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
tests.py
import threading from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections from django.db.models.manager import BaseManager from django.db.models.query import EmptyQuerySet, QuerySet from dj...
vodloader_video.py
from vodloader_chapters import vodloader_chapters from threading import Thread from math import floor import logging import os import datetime import streamlink import requests import json import pytz class vodloader_video(object): def __init__(self, parent, url, twitch_data, backlog=False, quality...
refinement.mp.py
import pydiffvg import argparse import torch import skimage.io import os import re from shutil import copyfile import shutil from PIL import Image import numpy as np import torch.multiprocessing as mp from torch.multiprocessing import Pool, Process, set_start_method try: set_start_method('spawn') exce...
utils.py
from biosimulators_utils.log.data_model import CombineArchiveLog # noqa: F401 from biosimulators_utils.report.data_model import SedDocumentResults # noqa: F401 import functools import importlib import multiprocessing import os import sys import time import types # noqa: F401 import yaml __all__ = [ 'get_simula...
pixels_4mic_hat.py
import apa102 import time import threading from gpiozero import LED try: import queue as Queue except ImportError: import Queue as Queue from alexa_led_pattern import AlexaLedPattern from google_home_led_pattern import GoogleHomeLedPattern class Pixels: PIXELS_N = 12 def __init__(self, pattern=Googl...
framework.py
#!/usr/bin/env python from __future__ import print_function import gc import sys import os import select import unittest import tempfile import time import resource import faulthandler from collections import deque from threading import Thread, Event from inspect import getdoc from traceback import format_exception fr...
notif_handler.py
#!/usr/bin/python from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer from os import curdir, sep from urlparse import urlparse import cgi import threading import sys, traceback from config import Config from utils import restartDHCP from dhcp_conf_helper import DhcpConfEntry, DhcpConfHelper # This class will...
example.py
from gevent import monkey; monkey.patch_all() # noqa import logging import time from watchdog_gevent import Observer from watchdog.events import LoggingEventHandler from threading import Thread logging.basicConfig(level=logging.DEBUG) running = True def printer(): global running logger = logging.getLogg...
InventoryBuilder.py
from flask import Flask from flask import request from flask import abort from flask import jsonify from gevent.pywsgi import WSGIServer from threading import Thread from resources.Vcenter import Vcenter from tools.Resources import Resources import time import json import os class InventoryBuilder: def __init__(s...
server.py
#Advanced NGN: Rotational Program #File: Database Server - Content Provider Front End #Writer: Rohit Dilip Kulkarni #Team Members: Mansi, Shikha, Rohit #Dated: 31 March 2019 from flask import Flask, jsonify, request, render_template, Response import json import os import requests import time import threadin...
master_sync.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code mus...
19.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio import time from threading import Thread now = lambda: time.time() def start_loop(loop): asyncio.set_event_loop(loop) loop.run_forever() def more_work(x): print('More work {}'.format(x)) time.sleep(x) print('Finished more work {}'.form...
PopUp.py
#!/usr/bin/python3 from __future__ import print_function, division try: import tkinter as tk except ImportError: import Tkinter as tk import multiprocessing as mp import sys from time import sleep import ctypes # User32.dll if getattr(ctypes, "windll", False): User32 = ctypes.windll.User32 else: Use...
interprocess.py
''' this is to make sure our design for interprocess communication will work we want to have multiple threads modifying and reading the same objects... if this works well we could perhaps replace the loops with listeners and behavior subjects as streams. ''' import threading import time import datetime as dt class Da...
library.py
import glob import os import random import time from threading import Thread from itertools import chain from more_itertools import peekable import re from typing import List, Iterable class ClipLibrary: def __init__(self, folder: str, log: bool = True, auto_update: bool = True): if log: print...
handythread.py
import sys import time import threading import itertools zip = getattr(itertools, 'izip', zip) #from itertools import izip, count #http://wiki.scipy.org/Cookbook/Multithreading #https://github.com/scipy/scipy-cookbook/blob/master/ipython/attachments/Multithreading/handythread.py def foreach(f,l,threads=3,return_=Fa...
decorators.py
import functools import resource from matplotlib import pyplot as pd from threading import Thread from datetime import datetime from time import sleep from .templates import time_result def monitor(measure): def time_monitor(func): @functools.wraps(func) def wrapper(*args, **kwargs): ...
multi_echo_server.py
import socket from multiprocessing import Process HOST = "" PORT = 8001 BUFFER_SIZE = 1024 def main(): with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s: s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) s.bind((HOST,PORT)) s.listen(10) while True: conn, ad...
server.py
# Copyright 1999-2018 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
clientserver.py
# -*- coding: UTF-8 -*- """Module that implements a different threading model between a Java Virtual Machine a Python interpreter. In this model, Java and Python can exchange resquests and responses in the same thread. For example, if a request is started in a Java UI thread and the Python code calls some Java code, t...
listen.py
from __future__ import absolute_import from __future__ import division import errno import socket from pwnlib.context import context from pwnlib.log import getLogger from pwnlib.timeout import Timeout from pwnlib.tubes.sock import sock log = getLogger(__name__) class listen(sock): r"""Creates an TCP or UDP-sock...
fs.py
import os,socket,threading,sys,ast, queue, shutil, xattr from pathlib import Path lock = threading.Lock() Q = queue.Queue() # ''' To do: 3) Deleting Replicated Files 4) Connecting using hostname 5) Smart client and file transfer with data server direct 6) Making directory and file 7) Removing from list ''' MAX_MSG = 1...
stock_correlation.py
#!/usr/bin/env python3 """ Find and visualize correlation between various equities. Takes ticker symbols as parameters """ import argparse import os import sys import re import time import math import urllib.request import platform import threading import queue import svgwrite # pip install svgwrite QUOTE_API...
server.py
import backoff import grpc import logging import queue import redis import threading import time import uuid import log from battleships_pb2 import Attack, Response, Status from battleships_pb2_grpc import BattleshipsServicer from game import Game from message import Message logger = log.get_logger(__name__) logger.se...
wikisourcetext.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ This bot applies to Wikisource sites to upload text. Text is uploaded to pages in Page ns, for a specified Index. Text to be stored, if the page is not-existing, is preloaded from the file used to create the Index page, making the upload feature independent from the forma...
subproc_vec_env.py
import numpy as np from multiprocessing import Process, Pipe from . import VecEnv, CloudpickleWrapper def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() try: while True: cmd, data = remote.recv() if cmd == 'step': ...
example_test.py
import re import os import sys import socket import BaseHTTPServer import SimpleHTTPServer from threading import Thread import ssl try: import IDF except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, # we need to set environment variable `TEST_FW_...
__init__.py
""" S3 Binding Module with logging handler and stream object """ __author__ = 'Omri Eival' import atexit import signal import threading import queue import gzip import codecs from logging import StreamHandler from io import BufferedIOBase, BytesIO from boto3 import Session import time from aws_logging_handlers.valid...
bad_thread_instantiation.py
# pylint: disable=missing-docstring import threading threading.Thread(lambda: None).run() # [bad-thread-instantiation] threading.Thread(None, lambda: None) threading.Thread(group=None, target=lambda: None).run() threading.Thread() # [bad-thread-instantiation]
piman.py
import logging import logging.config import os from zipfile import ZipFile import io import time # create the logger before doing imports since everyone is going # to use them local_logfile = './logging.conf' if os.path.isfile(local_logfile): logging.config.fileConfig(local_logfile) else: zipfile = os.path.dir...
network.py
# Electrum - Lightweight Bitcoin Client # Copyright (c) 2011-2016 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the ri...
audio_reader.py
import fnmatch import os import re import threading import librosa import numpy as np import tensorflow as tf def find_files(directory, pattern='*.wav'): '''Recursively finds all files matching the pattern.''' files = [] for root, dirnames, filenames in os.walk(directory): for filename in fnmatch...
fsspec_utils.py
# # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
snapraid-runner.py
#!/usr/bin/env python3 from __future__ import division import argparse import configparser import logging import logging.handlers import os.path import subprocess import sys import threading import time import traceback from collections import Counter, defaultdict from io import StringIO # Global variables config = N...
portscanPython3.py
# py3 import socket import threading import queue memes = int(input("threads: ")) target = (input("IP address: ")) minRange = int(input("min: ")) maxRange = int(input("max: ")) maxRange += 1 print_lock = threading.Lock() q = queue.Queue() def portscan(port): s = socket.socket(socket.AF_INET , socket.SOCK_STREAM) ...
sdca_ops_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_raft.py
#!/usr/bin/env python # Copyright (C) 2014: # Gabes Jean, naparuba@gmail.com import threading from multiprocessing import cpu_count, Process NB_CPUS = cpu_count() from opsbro_test import * from opsbro.raft import RaftLayer, RaftManager from opsbro.log import cprint NB_NODES = 3 ALL_NODES = {} class TestRaftLa...
fuchsia.py
# Copyright (C) 2018 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
mash.py
#!/usr/bin/env python from accessoryFunctions.accessoryFunctions import printtime, make_path, GenObject from threading import Thread from subprocess import call from queue import Queue import os import re __author__ = 'adamkoziol' class Mash(object): def sketching(self): printtime('Indexing files for {} a...
preprocess.py
import numpy as np from random import shuffle import scipy.io as io import argparse from helper import * import threading import time import itertools import sys parser = argparse.ArgumentParser() parser.add_argument('--data', type=str, default='Indian_pines', help='Default: Indian_pines, options: Salinas, KSC, Botswa...
fullnode.py
#!env/bin/python import json from operator import truediv import socketserver import sys import threading import time import logging from PyChain import Blockchain, request from PyChain.protocol import recv_msg, send_msg """ A PyChain full node This network communicated through sockets. Messages are encoded using JSON...
model_train_eval_manager.py
import os import threading from application.paths.services.path_service import PathService from domain.models.hyper_parameter_information import HyperParameterInformation from domain.models.paths import Paths from application.training_module.services.model_evaluation_service import ModelEvaluationService from applicat...
main.py
import argparse from threading import Thread from dl import Downloader from utils.query import download_state, print_download_state parser = argparse.ArgumentParser(description='Downloader.') parser.add_argument('strings', metavar='L', type=str, nargs='+', help='an string for the download') parser...
cluster.py
import threading from .container_manager import ContainerManager from .statistics_collector import StatisticsCollector class Cluster(object): def __init__(self, containers, is_wait_sync=None, debug=False): self.is_wait_sync = is_wait_sync self.containers = containers self.container_manage...
server.py
from __future__ import absolute_import import subprocess from multiprocessing import Process import signal from .common import * from .utils import colorify from . import search CHILD_PROC = None MASTER = None WORKER = None def server_up(host, port): import socket sock = socket.socket(socket.AF_INET, socket...
__init__.py
# -*- coding: utf-8 -*- # @Author: Cody Kochmann # @Date: 2017-04-27 12:49:17 # @Last Modified 2018-03-12 # @Last Modified time: 2020-04-05 11:01:47 """ battle_tested - automated function fuzzing library to quickly test production code to prove it is "battle tested" and safe to use. Examples of Prim...
dataframe.py
import os import threading import time import pandas as pd import tensorflow as tf import numpy as np def split_dataframe_list_to_rows(df, target_column, separator): """Splits column that contains list into row per element of the list. Args: df: dataframe to split target_column: the column conta...
singleton.py
import threading class Singleton(object): _instance_lock = threading.Lock() @classmethod def instance(cls, *args, **kwargs): if not hasattr(Singleton, "_instance"): with Singleton._instance_lock: Singleton._instance = Singleton(*args, **kwargs) return ...
background_loop.py
import os, psycopg2 import config from time import sleep import csv, random import threading petrol_requests = [] def connect(): conn = psycopg2.connect( database=config.db, user=config.user, password=config.pswd, host=config.host, port=config.port) return conn def ca...
advanced-reboot.py
# # ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";...
augment_agent_meta_data.py
import os import sys sys.path.append(os.path.join(os.environ['ALFRED_ROOT'])) sys.path.append(os.path.join(os.environ['ALFRED_ROOT'], 'gen')) import json import glob import os import constants import cv2 import shutil import numpy as np import argparse import threading import time import copy import random from gen.ut...
test_common.py
from __future__ import absolute_import, unicode_literals import pytest import socket from amqp import RecoverableConnectionError from case import ContextMock, Mock, patch from kombu import common from kombu.common import ( Broadcast, maybe_declare, send_reply, collect_replies, declaration_cached, ignore_...
vclustermgr.py
#!/usr/bin/python3 import os, random, json, sys, imagemgr, threading, servicemgr import datetime from log import logger import env ################################################## # VclusterMgr # Description : VclusterMgr start/stop/manage virtual clusters # #######################################...
websocketServerModule.py
""" Websocket server communication module """ from websocket_server import WebsocketServer from simplesensor.shared.threadsafeLogger import ThreadsafeLogger from simplesensor.shared.message import Message from simplesensor.shared.moduleProcess import ModuleProcess from distutils.version import LooseVersion, StrictVers...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.heterograph_index import cre...
mock_server.py
import logging import queue import traceback from http.server import BaseHTTPRequestHandler, HTTPServer from multiprocessing import Process, Queue from .pact_request_handler import PactRequestHandler _providers = {} log = logging.getLogger(__name__) def getMockServer(pact): if pact.provider.name not in _provi...
utils.py
# Copyright (c) MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
test_socket_connection.py
import functools import threading import time import logging import socket import struct import sys import unittest import zlib import pytest import ipaddress import netifaces from boofuzz.socket_connection import SocketConnection from boofuzz import socket_connection from boofuzz import ip_constants from boofuzz imp...
conftest.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from contextlib import closing import os import socket import tempfile import threading from lxml.builder import ElementMaker, E as B from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.servers import FTPServer from pyftpdlib.handlers import T...
Servo.py
""" Authors: Brian Henson """ from Pwm_Interface import set_pwm import threading import Frame_Thread as ft # prints an assload of debug statements for the servo with the specified ID # specifically only frame-thread debug statements # there is no servo with id -1 so that will turn off debugging DEBUG_SERVO_ID = ...
util.py
import logging import pickle from time import time import math import faiss import numpy as np import torch from collections import defaultdict folder_pickles = '../data/' best_metric=0 #读取和存储数据到pkl #取数据 def restoreVariableFromDisk(name): #logging.info('Recovering variable...') #t0 = time() ...
fifo_queue_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
rsa.py
#!/usr/bin/python '''***************************************************************************** Purpose: To analyze the sentiments of the reddit This program uses Vader SentimentIntensityAnalyzer to calculate the ticker compound value. You can change multiple parameters to suit your needs. See below under "set prog...
scheduler.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # Author: Binux<i@binux.me> # http://binux.me # # Contributor: qiulimao<qiulimao@getqiu.com> # http://www.getqiu.com # # Created on 2014-02-07 17:05:11 # Modified on 2016-10-26 20:46:20 import itertools im...
dynconf_light.py
# # DYNCONF LIGHT: Dynamic Configuration # Config generator, administrator, and retriever based on Jinja2 templates, # CSV data, and Netmiko SSH/Telnet Sessions for Cisco IOS and Junos # # 2018 Dyntek Services Inc. # Kenneth J. Grace <kenneth.grace@dyntek.com> # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF A...
remot3.it.connect.py
#!/Users/harley/anaconda3/bin/python import json from json import dumps from urllib.request import urlopen import requests import httplib2 from terminaltables import AsciiTable import subprocess import pyperclip import config URL = config.URL DEVELOPERKEY = config.DEVELOPERKEY USERNAME = config.USERNAME PASSWORD = co...
host.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
tcp_proxy_encoded.py
#!/usr/bin/env python3 import os import json import socket import threading from selectors import DefaultSelector, EVENT_READ # Proxy开放的端口号 LOCAL_PORT = 7088 # 连接的远程服务器与端口,修改成你的远程服务器地址 REMOTE_ADDR = "hachinasp.duckdns.org" REMOTE_PORT = 7088 def xor_encode( bstring ): """一个简单编码:两次编码后与原值相同""" MASK = 0x55 ...
app.py
# packages that need to be pip installed import praw from psaw import PushshiftAPI # packages that come with python import traceback from multiprocessing import Process, Value from time import sleep, time # other files import config import database from setInterval import setInterval rows = [] reddit = praw.Reddit(c...
config_manager.py
import fnmatch import logging import os import sys import threading import time from configparser import (ConfigParser, DuplicateSectionError, DuplicateOptionError, InterpolationError, ParsingError) from datetime import datetime from types import FrameType from typing...
HPLC_control.py
# This could become a mess... # what needs to be done is switch the lamps on, which works over serial. # the rest is just sending commands to the console, possibly also to another machine # https://www.dataapex.com/documentation/Content/Help/110-technical-specifications/110.020-command-line-parameters/110.020-command-...
_progress.py
from __future__ import division, absolute_import import sys import threading import time from timeit import default_timer def format_time(t): """Format seconds into a human readable form. >>> format_time(10.4) '10.4s' >>> format_time(1000.4) '16min 40.4s' """ m, s = divmod(t, 60) h, ...
take_images.py
import base64 import io import threading import time from time import sleep import socketio from picamera import PiCamera from picamera.array import PiRGBArray sio = socketio.Client() sio.connect('http://localhost:5000') with PiCamera() as camera: # Set the camera's resolution to VGA @40fps and give it a couple ...
test_webpack.py
import json import os import time from subprocess import call from threading import Thread import django from django.conf import settings from django.test import RequestFactory, TestCase from django.views.generic.base import TemplateView from django_jinja.builtins import DEFAULT_EXTENSIONS from unittest2 import skipIf...
telemetry.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
multi.py
import gym import multiprocessing import threading import numpy as np import os import shutil import matplotlib.pyplot as plt import tensorflow as tf # PARAMETERS OUTPUT_GRAPH = True # safe logs RENDER = True # render one worker LOG_DIR = './log' # savelocation for logs N_WORKERS = multiprocessing.cpu_count() # nu...
MonochromatorGUI.py
import os os.environ['KIVY_IMAGE'] = 'pil,sdl2' import serial import threading import re import time from serial.tools import list_ports from uart import uart from kivy.properties import StringProperty from kivy.uix.gridlayout import GridLayout from kivy.uix.widget import Widget from kivy.uix.boxlayout import BoxLayout...
doh-fork-async.py
#!/usr/bin/env python3 import asyncio, aiohttp, aioprocessing import random, struct import argparse, logging # Handle command line arguments parser = argparse.ArgumentParser() parser.add_argument('-a', '--listen-address', default='127.0.0.1', help='address to listen on for DNS over HTTPS requests (default: %(def...