source
stringlengths
3
86
python
stringlengths
75
1.04M
ventana_convolucional.py
# -*- coding: utf-8 -*- """ Created on Mon Dec 16 21:11:25 2019 @author: Jorge """ import tkinter as tk from tkinter import ttk import crearcapasconv from threading import Thread import sys from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk from matplotlib.figure impor...
testserver.py
import argparse import itertools import logging import os import random import signal import selectors import socket import sys import threading import time import dns.message import dns.rdatatype from pydnstest import scenario, mock_client from networking import InterfaceManager class TestServer: """ This simu...
file_watcher.py
import argparse import logging import subprocess import threading import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler logging.basicConfig() logger = logging.getLogger(__name__) class FileChangeHandler(PatternMatchingEventHandler): def __init__(self, exec_s...
test_logging.py
import logging from threading import Thread from unittest.mock import patch import pytest from pip._internal.utils.logging import ( BrokenStdoutLoggingError, IndentingFormatter, RichPipStreamHandler, indent_log, ) from pip._internal.utils.misc import captured_stderr, captured_stdout logger = logging....
r2d2.py
import torch import torch.utils.data import torch.optim as optim import torch.nn as nn import numpy as np from collections import deque import random import gym import os from copy import deepcopy from time import time, sleep import torch.multiprocessing as mp #mp.set_start_method('spawn', force=True) from models impor...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR> # # This program and the accompanying materials # are...
client3.py
__author__ = 'tanel' import argparse from ws4py.client.threadedclient import WebSocketClient import time import threading import sys import urllib import Queue import json import time import os def rate_limited(maxPerSecond): minInterval = 1.0 / float(maxPerSecond) def decorate(func): lastTimeCalled =...
test_c10d.py
import copy import math import multiprocessing import os import random import sys import tempfile import threading import time import unittest from datetime import timedelta from itertools import groupby from functools import wraps from collections import namedtuple import torch import common_utils as common from tor...
multicore.py
#encoding:UTF-8 #!/usr/bin/python #author:justry import os import time import multiprocessing def job(q): ret = 0 for i in range(1000000): ret = i + i**2 + i**3 q.put(ret) def multicore(): q = multiprocessing.Queue() p1 = multiprocessing.Process(target=job, args=(q, )) p1.start() ...
pipeline1.py
import time import argparse import numpy as np from sklearn.metrics import confusion_matrix import cv2 from models import TSN from transforms import * import pycuda.driver as cuda from PIL import Image from streaming import streaming import os def make_ucf(): index_dir = '/cmsdata/hdd2/cmslab/haabibi/UCF101CL...
modin_aqp.py
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
server.py
from multiprocessing import Process #,Manager from listenerImplementation import rabbitMQ_Implementation as Listener from fastapi import FastAPI from models import * from constants import * import data_handler as d_handler import query_handler as q_handler # ----------- App initialisation ----------------------------...
spawn.py
""" Spawning child processes while tracking their output. """ import logging import subprocess import threading _log = logging.getLogger(__name__) def _copy_lines(readable, write_callable): for line in iter(readable.readline, ''): write_callable(line.rstrip('\n')) def spawn(command, out_callable=N...
WatchDog.py
import threading import time import subprocess import os import datetime import json import copy from .WtLogger import WtLogger from enum import Enum class WatcherSink: def __init__(self): pass def on_start(self, appid:str): pass def on_stop(self, appid:str): ...
test_memory.py
import ctypes import threading import unittest import cupy.cuda from cupy.cuda import memory from cupy import testing class MockMemory(memory.Memory): cur_ptr = 1 def __init__(self, size): self.ptr = MockMemory.cur_ptr MockMemory.cur_ptr += size self.size = size self.device =...
threaded_cv_input.py
# source: https://gist.github.com/allskyee/7749b9318e914ca45eb0a1000a81bf56 from threading import Thread, Lock import cv2 as cv class WebcamVideoStream : def __init__(self, src = 0, width = 640, height = 480) : self.stream = cv.VideoCapture(src) self.stream.set(cv.CAP_PROP_FRAME_WIDTH, width) ...
run-spec-test.py
#!/usr/bin/env python3 # Author: Volodymyr Shymanskyy # Usage: # ./run-spec-test.py # ./run-spec-test.py ./core/i32.json # ./run-spec-test.py ./core/float_exprs.json --line 2070 # ./run-spec-test.py ./proposals/tail-call/*.json # ./run-spec-test.py --exec "../build-custom/wasm3 --repl" # # Running WASI veris...
control.py
#!/usr/bin/python3 # ***************************************** # PiTender Control Python script # ***************************************** # # Description: This script will dispense beverages. # # This script runs as a separate process from the Flask / Gunicorn # implementation which handles the web interface....
exchange_rate.py
from datetime import datetime import inspect import requests import sys from threading import Thread import time import traceback import csv from decimal import Decimal from electrum_sib.bitcoin import COIN from electrum_sib.plugins import BasePlugin, hook from electrum_sib.i18n import _ from electrum_sib.util import ...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum.wallet import Wallet from electrum.storage import WalletStorage from electrum.util import UserCancelled, InvalidPassword from electrum.base_wizard import BaseWizard,...
manager.py
import logging import random import threading import time from timeswitch.switch.model import (SWITCH_OFF, SWITCH_ON, SWITCH_UNDEF, is_absolute_time, is_relative_time) time.strptime('2012-01-01', '%Y-%m-%d') # dummy call to prevent error... class NullHandler(logging.Handler): ...
Cache.py
from array import array as C_Array from LinkedListArrays import getNext, getPrev, getHead, getTail, increment, switch, pop, push, bringToFirst, setIndex from threading import Lock class CacheSlubLRU(object): def __init__(self, totalSize, slabSize, logger): # to create slabArray: #before self.slab...
distribute_corpus.py
import glob import logging as log import os import sys import threading from typing import List, Dict from utils.utils import count_size, execute_command, create_remote_dir, measure, execute_via_ssh, read_default_config config = read_default_config() def handle_args(args: List[str]) -> (List[str], List[str], str): ...
__init__.py
# # Copyright 2017 Scott A Dixon # # 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 t...
map_reduce.py
r""" Parallel computations using RecursivelyEnumeratedSet and Map-Reduce There exists an efficient way to distribute computations when you have a set `S` of objects defined by :func:`RecursivelyEnumeratedSet` (see :mod:`sage.sets.recursively_enumerated_set` for more details) over which you would like to perform the fo...
nerdbot.py
import requests import socket import time import atexit import threading import json import logging import re import itertools import isodate import random from datetime import datetime import pytz def is_json(string): try: json.loads(string) return True except ValueError: return False...
thefatcat.py
#!/usr/bin/env python #!/usr/bin/env python __author__ = 'Rajesh Majumdar' from tkinter import * import os import time import ttk import threading from modules import core import argparse import subprocess top = Tk() def getinfo(domain, resolve): core.header_target(domain) core.show_...
Packet-Sniffer.py
#! /usr/local/bin/python3.5 import socket import struct import threading import textwrap TAB_1 = '\t - ' TAB_2 = '\t\t - ' TAB_3 = '\t\t\t - ' TAB_4 = '\t\t\t\t - ' DATA_TAB_1 = '\t ' DATA_TAB_2 = '\t\t ' DATA_TAB_3 = '\t\t\t ' DATA_TAB_4 = '\t\t\t\t ' def run(id): conn = socket.socket...
Checker_for_QNAP_RCE_cve20197192_95.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function try: import queue except ImportError: import Queue as queue import datetime import re import sys import logging import threading try: import requests import requests from requests.packages.urllib3.exceptions impo...
benchmarker.py
from setup.linux import setup_util from benchmark import framework_test from benchmark.test_types import * from utils import header from utils import gather_tests from utils import gather_frameworks from utils import verify_database_connections import os import uuid import shutil import stat import json import reques...
scapyListening.py
#!/usr/bin/env python # -*- coding: utf-8 -*-​ import os, time, socket, fcntl, struct from subprocess import call from platform import system import threading, os, time from threading import Thread, Lock from subprocess import Popen, PIPE from signal import SIGINT, signal from scapy.all import * import os, ConfigParser...
test_pdb.py
# A test suite dla pdb; nie very comprehensive at the moment. zaimportuj doctest zaimportuj pdb zaimportuj sys zaimportuj types zaimportuj unittest zaimportuj subprocess zaimportuj textwrap z test zaimportuj support # This little helper klasa jest essential dla testing pdb under doctest. z test.test_doctest zaimportu...
testme.py
#!/usr/bin/env python3 import io import os import sys import time import queue import shutil import tempfile import subprocess import threading import multiprocessing as mp import config import watch import generate import evaluate import progress def evaluate_thread (dirname, tid): real_stdout = sys.stdout ...
preprocess.py
import librosa import yaml import os import numpy as np from python_speech_features import mfcc import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable import pickle import threading import time def feature_extraction(path, MFCC_dim=13): audio, sr = librosa.load(path) energy = l...
ga.py
"""Module for PyVVO's genetic algorithm. """ # Standard library: import multiprocessing as mp import threading import os import queue import logging import time import operator import math import itertools import copy from functools import wraps from typing import Union # Third party: import numpy as np import pandas ...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import import os import copy import errno import signal import hashlib import logging import weakref from random import randint # Import Salt Libs import salt.auth import salt.crypt import salt.utils import s...
backend.py
from thonny.common import ( InputSubmission, InterruptCommand, EOFCommand, parse_message, ToplevelCommand, ToplevelResponse, InlineCommand, InlineResponse, UserError, serialize_message, BackendEvent, ValueInfo, execute_system_command, ) import sys import logging impor...
utils.py
from collections import OrderedDict from multiprocessing import Queue, Process import numpy as np import tensorflow as tf import torch as th from stable_baselines.common.vec_env import VecEnv, VecNormalize, DummyVecEnv, SubprocVecEnv, VecFrameStack from environments import ThreadingType from environments.utils import...
conftest.py
"""Fixtures and setup / teardown functions Tasks: 1. setup test database before starting the tests 2. delete test database after running the tests """ import os import copy import random from collections import namedtuple from logging import getLogger from logging.config import dictConfig import pytest from pymongo ...
dmlb2000genomeServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
tests.py
from __future__ import unicode_literals from datetime import datetime import threading from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.db import connections, DEFAULT_DB_ALIAS from django.db.models.fields import Field, FieldDoesNotExist from django.db.models.manager import Ba...
test_server.py
"""Tests for the HTTP server.""" # -*- coding: utf-8 -*- # vim: set fileencoding=utf-8 : from __future__ import absolute_import, division, print_function __metaclass__ = type import os import socket import tempfile import threading import uuid import pytest import requests import requests_unixsocket import six from...
prepare_data.py
import sys sys.path.insert(0, '../') import os import errno from collections import Counter, defaultdict from setup.settings import preprocessing, hparams from core.tokenizer import tokenize, apply_bpe_init, apply_bpe, sentence_split from tqdm import tqdm from itertools import zip_longest from multiprocessing import Po...
spawn.py
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
mp_dev.py
import numpy as np import multiprocessing as mp def run_sub(pipe_to_sup): print(pipe_to_sup.recv()) print(pipe_to_sup.recv()) message = pipe_to_sup.recv_bytes() print(message) print(message == "test") print(np.fromstring(message,dtype=np.uint8)) if __name__ == "__main__": pipe_to_sub, pipe...
camera.py
import cv2, threading, time, sys, queue, os import numpy as np from pywfom.devices.utils import * """ import win32com.client wmi = win32com.client.GetObject ("winmgmts:") for usb in wmi.InstancesOf ("Win32_USBHub"): print usb.DeviceID """ def find_cameras(): cameras = [] # OpenCV for i in range(10...
grpc_asyncio.py
import asyncio from concurrent import futures import functools import inspect import threading from grpc import _server def _loop_mgr(loop: asyncio.AbstractEventLoop): asyncio.set_event_loop(loop) loop.run_forever() # If we reach here, the loop was stopped. # We should gather any remaining tasks and...
controller.py
import random import socket import threading import time from encrypted_dns import upstream, parse, utils, log, server class Controller: def __init__(self, dns_config_object): self.server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.server.bind(('', 0)) (self.controller_addres...
acquire.py
import numpy as np import multiprocessing import threading from inspect import signature import copy import types import time from pycromanager.core import deserialize_array, Bridge from pycromanager.data import Dataset import warnings import os.path import queue import subprocess import platform import atexit def st...
bombV1.03.py
# MIT License # # Copyright (c) 2021 Pablo Henrique # # 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, merg...
mitm_proxy.py
from pathlib import Path import multiprocessing from trafficmonitor.trafficviewer import start from trafficmonitor.helper_functions import create_path class MitmProxy: """ class for mitmproxy configuration """ def __init__(self): # default command for mitmdump lib self.command = ...
__init__.py
from __future__ import print_function from past.builtins import xrange from builtins import input, bytes import six import os import sys import cmd import time import serial import select import struct import threading import math import pickle import binascii from cancat import iso_tp baud = 4000000 # command con...
server.py
import socket import threading class Server: def __init__(self): self.ip = socket.gethostbyname(socket.gethostname()) while 1: try: self.port = int(input('Enter port number to run on --> ')) self.s = socket.socket(socket.AF_...
appjar.py
# -*- coding: utf-8 -*- """ appJar.py: Provides a GUI class, for making simple tkinter GUIs. """ # Nearly everything I learnt came from: http://effbot.org/tkinterbook/ # with help from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html # with snippets from stackexchange.com # make print & unicode backwards ...
test_connection.py
# Copyright 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 writing, softwa...
test_generator_api.py
import functools import threading import unittest import pytest import numpy import cupy from cupy.random import _generator_api from cupy.random import _bit_generator from cupy import testing from cupy.testing import attr from cupy.testing import condition def numpy_cupy_equal_continuous_distribution(significance_l...
test_server.py
# -*- coding: utf-8 -*- """Tests for pyss3.server.""" import pyss3.server as s import threading import argparse import socket import pytest import pyss3 import json import sys from os import path from pyss3 import SS3 from pyss3.util import Dataset, Print HTTP_REQUEST = "%s %s HTTP/1.1\r\nContent-Length: %d\r\n\r\n%s...
tests.py
from django.test import TestCase # Create your tests here. import requests import json import time import threading def get_license(user, password, product): ip = "http://192.168.3.50:8000" login_url = ip + "/upp/users/?action=login" data = {"u_name": user, "u_password": password} response = requests...
env_stock_papertrading.py
import datetime import threading import time import alpaca_trade_api as tradeapi import gym import numpy as np import pandas as pd import torch from finrl_meta.data_processors.processor_alpaca import AlpacaProcessor class AlpacaPaperTrading(): def __init__(self, ticker_list, time_interval, drl_l...
__init__.py
"""A helper which runs a MongoDB-queue consumer. Note that, if this gets too bogged down, the collection would need to be multiplexed (queue1, queue2, ...) to avoid mongoDB's write-lock bottleneck. Current design should make that fairly straightforward... """ # System-level imports import bson import click import dat...
test_dota_base.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process from utils import...
messaging.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 """An implementation of the session and presentation layers as used in the Debug A...
ddos_server.py
import socket import argparse from threading import Thread ''' 1. 第一步,编写主函数 创建socket,绑定所有网络地址和58868端口并开始监听; 新开一个线程等待客户端的连接,以免阻塞我们输入命令(注意) ''' def main(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('0.0.0.0', 58868)) s.listen(1024) # TODO t = Thread(target=waitConnect, args(s,)) ...
midiator.py
from midi.midi_io import find_device from midi.midi_enums import Notes from windows.windows_enums import KeyFlags, DICodes, MouseFlags, MouseDirections from windows.windows_io import send_key_event, send_mouse_movement_event, send_mouse_button_event import threading import time from math import sin class MIDIator: ...
__init__.py
import os from threading import Thread from flask import current_app from flask_mail import Message def send_async_mail(app, msg): with app.app_context(): app.mail.send(msg) def send_mail_html(subject, recipients, body, inline_images=None): app = current_app._get_current_object() msg = Message( ...
auth.py
from flask import ( Blueprint, render_template, request, jsonify, make_response, flash ) import threading from os import environ auth_bp = Blueprint('auth_bp', __name__, template_folder='templates', static_folder='static', ) from app import db from dryFunctions impor...
twitter.py
import datetime import logging import threading import json import tweepy from twisted.internet.protocol import ReconnectingClientFactory from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory from pajbot import utils from pajbot.managers.db import DBManager from pajbot.models.twitter ...
qt.py
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2020 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) """Visualization of grid data using Qt. This module provides a few methods and classes for visual...
test_config.py
import threading import asdf_standard.integration import pytest import asdf from asdf import get_config, resource from asdf.extension import BuiltinExtension, ExtensionProxy from asdf.resource import ResourceMappingProxy def test_config_context(): assert get_config().validate_on_read is True with asdf.conf...
writer.py
# # Copyright (c) 2020, 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 ...
val.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as...
pickletester.py
import collections import copyreg import dbm import io import functools import os import pickle import pickletools import shutil import struct import sys import threading import unittest import weakref from textwrap import dedent from http.cookies import SimpleCookie from test import support from tes...
BuildReport.py
## @file # Routines for generating build report. # # This module contains the functionality to generate build report after # build all target completes successfully. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## Import Modules ...
pymultidown.py
#!/usr/bin/env python3 # encoding: utf-8 import sys import os import argparse import logging import hashlib import json import math import mmap import urllib.request import time import threading LOG = logging.getLogger("pymultidown") LOG.setLevel(logging.DEBUG) LOG_HANDLER = logging.StreamHandler(sys.stderr) LOG_HAN...
websockets.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 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...
demo_1.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by Em on 2017/5/12 """ 创建一个子进程 """ from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print 'Run child process %s (%s)...' % (name, os.getpid()) if __name__ == '__main__': print 'Parent process %s.' % os.getpid() p = P...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import unittest.mock import queue as pyqueue import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import subprocess import struct import operator import p...
projTransform.py
import numpy as np import sys import math import time import datetime from array import * from PIL import Image import Transform import Stitching_InitConv_TIFFtoHDF4_single import ctypes from multiprocessing import Pool,Process, Array, Queue def child(i, step, totalimage, prefs, kind, finalData, monitor, nOutstart): ...
executorservodriver.py
import json import os import socket import threading import time import traceback from .base import (Protocol, BaseProtocolPart, RefTestExecutor, RefTestImplementation, TestharnessExecutor, strip_server) from ..testrunner im...
device_connection_test.py
# Copyright 2020 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...
_testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import operator import os from shutil import rmtree import string import tempfile from typing import Any, Callable, ContextManager, List, Optional, Type, Union, cast imp...
gen_dep_imgs.py
import numpy as np from multiprocessing import Process import os from api import PRN from skimage.io import imread, imsave from skimage.transform import rescale, resize from utils.render_app import get_depth_image import ast import argparse import time def run(imgList, args): # ---- init PRN prn = PRN(is_dlib...
MyContigCountServer.py
#!/usr/bin/env python from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, ServerError, InvalidRequestE...
thread.py
"""Threading utilities.""" import time import threading from .timing import TimeoutException def execute_as_thread(target, args=None, kwargs=None, daemon=False, join=True, break_join=None, join_sleep=0.01, timeout=None): """ Execute target callable in a separate thread. :param tar...
pmdahttp_ping.py
#!/usr/bin/env python2 ''' Performance Metrics Domain Agent exporting an http status code ''' # # Copyright (c) 2014-2015 Red Hat. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either versio...
thumbnail_inject.py
from src.platform.railo.interfaces import RINTERFACES from src.module.deploy_utils import _serve, waitServe, parse_war_path, killServe from hashlib import md5 from commands import getoutput from threading import Thread from base64 import b64encode from os.path import abspath from requests import get from time import sl...
Infrared_transmit.py
# # Created on Sat Oct 09 2021 # Author: Owen Yip # Mail: me@owenyip.com # import os,sys pwd = os.path.abspath(os.path.abspath(__file__)) father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..") sys.path.append(father_path) import time import threading import json from datetime import datetime from Se...
app.py
import os from queue import Queue from threading import Thread from typing import TypeVar from bot.telegram_logger import logger, TelegramLogsHandler from config.config import Config from flask import request, render_template import telegram from telegram import Bot from telegram.ext import Dispatcher, CommandHandler,...
stl_capture_test.py
#!/router/bin/python from .stl_general_test import CStlGeneral_Test, CTRexScenario from trex_stl_lib.api import * import os, sys import pprint import zmq import threading import time import tempfile import socket from scapy.utils import RawPcapReader from nose.tools import assert_raises, nottest def ip2num (ip_str): ...
nexmark_util.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 us...
03_daemon_threads.py
import threading from time import sleep from random import randint def func(s): print(f"Hello, {s}!") sleep_time = randint(0, 3) print(f"Sleeping for {sleep_time} seconds") sleep(sleep_time) print(f"Good-bye, {s}!") thread1 = threading.Thread(target=func, args=("Judy",), daemon=True) thread2 = t...
run.py
#!/usr/bin/python from functions import * t2 = threading.Thread(target=pcb_fun) t2.daemon = True t2.start() while True: #lid = round(random(),2) #pcb = round(random(),2) #acc = round(random(),2) pcb = get_vals() print(pcb) pcb = round(pcb, 4) sleep(.5)
pureblood.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Script Created By: Cr4sHCoD3 Github: https://github.com/cr4shcod3 FB Page: https://facebook.com/cr4shcod3.py Youtube: https://www.youtube.com/channel/UCEw5DaWEUY0XeUOTl1U2LKw Buy Me A Coffee: https://www.buymeacoffee.com/f4a5kJcyl Google Plu...
fact_gan.py
""" GAN for generating new images from FACT eventfiles """ import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"] = "" import tensorflow as tf from keras.backend.tensorflow_backend import set_session config = tf.ConfigProto() config.gpu_options.allow_growth = Tr...
server.py
import socket import threading def conexiones(socket_cliente): peticion = socket_cliente.recv(1024) print "[*] Mensaje recibido: %s" % peticion socket_cliente.send("HOLA CLIENTE") socket_cliente.close() ip = "0.0.0.0" puerto = 443 max_conexiones = 5 servidor = socket.socket(socket.AF_INET, socket....
grid_search.py
""" Gridsearch implementation """ from hops import hdfs, tensorboard, devices from hops.experiment_impl.util import experiment_utils from hops.experiment import Direction import threading import six import time import os def _run(sc, train_fn, run_id, args_dict, direction=Direction.MAX, local_logdir=False, name="no...
basic01.py
""" web服务器返回灵活页面,根据制定的路径打开指定的页面 """ import socket, threading, multiprocessing,gevent import re import sys import time # dynamic包中存放的是框架之类的东西,注意更新import的路径 import dynamic.mini_framework from gevent import monkey monkey.patch_all() class WSGIServer(object): def __init__(self, app): self.server_socket...
test_websocket_integration.py
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
configure_and_test_integration_instances.py
from __future__ import print_function import argparse import ast import json import logging import os import subprocess import sys import uuid import zipfile from datetime import datetime from distutils.version import LooseVersion from enum import IntEnum from pprint import pformat from threading import Thread from ti...
ws_manager.py
# @Author: Manuel Rodriguez <valle> # @Date: 11-Jun-2018 # @Email: valle.mrv@gmail.com # @Last modified by: valle # @Last modified time: 2019-10-19T16:10:59+02:00 # @License: Apache license vesion 2.0 from kivy.event import EventDispatcher from kivy.properties import BooleanProperty from kivy.clock import Clock f...