source
stringlengths
3
86
python
stringlengths
75
1.04M
single_instance.py
#!/usr/bin/env python """ Main program for the Gify-Box. This program is currently running with Python 2. https://github.com/informatik-mannheim/gify-box """ import os from time import sleep from gpiozero import Button import os, random, picamera, requests from rpi_ws281x import * from subprocess import Popen import...
OntologyAPIServer.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...
RunServer.py
#!/bin/python3 ## This program is meant for Linux! Most things will probably work on Windows, but not everything. ## ## Macintoshes are also not supported ## ## This program must be run in unbuffered mode (default with "python3" command on Linux and Windows, but not IDLE) ## # Imports # System import os, sys, subp...
main.py
# Based on: https://github.com/EbenKouao/pi-camera-stream-flask # Copyright smartbuild.io Licensed under MIT # See license text at https://github.com/EbenKouao/pi-camera-stream-flask/blob/master/LICENSE # Modified by Jan Brebeck # Date: 20.01.21 from flask import Flask, render_template, Response, request from camera i...
main.py
from multiprocessing import Process from core.proxy_spider.run_spiders import RunSpider from core.proxy_test import ProxyTester from core.proxy_api import ProxyApi def run(): process_list = [] process_list.append(Process(target=RunSpider.start)) process_list.append(Process(target=ProxyTester.start)) pr...
paco.py
#!/usr/bin/env python import numpy import math import ant import types import random from random import shuffle from multiprocessing import Process, Queue # Parameters used - # index - stores the city number # x - x coordinate for the city i # y - y coordinate for the city i class City: def __init__(self,i=0, x_c...
kaldi_io_multi.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014-2016 Brno University of Technology (author: Karel Vesely) # Licensed under the Apache License, Version 2.0 (the "License") # # Modified: # 2018 Yi Liu import numpy as np import sys, os, re, gzip, struct import random from six.moves import range ###...
ttsfb.py
#!/usr/bin/python3 """ Copyright 2014 Tomáš Vician, Štefan Uram 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...
test_s3boto3.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import gzip import pickle import threading import warnings from datetime import datetime from unittest import skipIf from botocore.exceptions import ClientError from django.conf import settings from django.core.exceptions import ImproperlyConfigured from...
test_sys.py
# -*- coding: iso-8859-1 -*- import unittest, test.test_support import sys, cStringIO, os import struct class SysModuleTest(unittest.TestCase): def test_original_displayhook(self): import __builtin__ savestdout = sys.stdout out = cStringIO.StringIO() sys.stdout = out dh = ...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "I AM BACK" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
vato.py
#!/usr/bin/python ''' @author: coldewey ''' # # Note: on *nix systems you may invoke 'lsof -i :5555' from the command line # to determine which process is using port 5555 # # Requires tornado libraries, which can be downloaded from tornadoweb.org # (links to github). Make sure you use the right python version, i.e. ...
TestSocket.py
#!/usr/bin/env python """ Connects to shotManager so you can send it messages. Fun times! """ import os import socket import struct import sys import threading import logging import time sys.path.append(os.path.realpath('..')) import app_packet # create socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
sabre-tk.py
#!/usr/bin/python3 import tkinter as tk from tkinter import ttk from multiprocessing import Process #needs pip installed import os import subprocess #from PIL import Image, ImageTK # needs pip installed tocIP = '' tocUser = '' tocConnections = '' #def sabreClient(u,s): def sabreClient(*args): try: serve...
robiot.py
#!/usr/bin/env python3 """ robiot.py - Robot application to interact with the iot shadow. Telemetry state is reported to the shadow. Desired states are used to drive motors. Shadow interaction is based on the examples from Amazon. Their command line is: python shadow.py --endpoint a15t3x0cscxlt9-ats.iot....
twisterlib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fut...
test_autograd.py
import contextlib import gc import sys import io import math import random import tempfile import time import threading import unittest import warnings from copy import deepcopy from collections import OrderedDict from itertools import product, permutations from operator import mul from functools import reduce, partial...
utility.py
import os import subprocess import sys import ConfigParser import types import tempfile import grapeGit as git import grapeMenu import grapeConfig toplevel = os.path.join(os.path.realpath(os.path.dirname(__file__)), "..") if toplevel not in sys.path: sys.path.insert(0, toplevel) from docopt.docopt import docop...
server.py
#!/usr/bin/env python """ Dummy server used for unit testing. """ from __future__ import print_function import errno import logging import os import random import string import sys import threading import socket import warnings from urllib3.exceptions import HTTPWarning from tornado.platform.auto import set_close_e...
utils.py
import shutil import os import sys import threading import subprocess import requests try: import winreg except ModuleNotFoundError: pass from .log import Log import math def find_program_win(name, program_to_find='SOFTWARE\\7-Zip'): log = Log(name=name) try: h_key = winreg.CreateKey(winreg.HK...
__init__.py
""" objectstore package, abstraction for storing blobs of data for use in Galaxy. all providers ensure that data can be accessed on the filesystem for running tools """ import abc import logging import os import random import shutil import threading import time from collections import OrderedDict import yaml try: ...
testreflector.py
from Queue import Queue from virtualisation.misc.jsonobject import JSONObject as JOb import os from rabbitmq import RabbitMQ from threading import Timer, Thread, Lock import argparse __author__ = 'Marten Fischer' class Reflector(object): """ This programm is only for development purposes. It re-s...
thread.py
#!/usr/bin/env python """Classes to build and manage concurrent Pyon worker greenlets, aka threads.""" __author__ = "Adam R. Smith" import time import os import signal from gevent.event import AsyncResult from pyon.util.async import Event, spawn from pyon.util.log import log from pyon.core.exception import Contain...
load_balancer.py
#!/usr/bin/python3.8 """ Author : Gabriel Cuba Desc : Distributes workload across the smpp workers """ import csv import json import time from itertools import product, islice import random from threading import Thread import zmq import queue from datetime import datetime import logging logger = ...
mainwindow.py
"""The Qt MainWindow for the QtConsole This is a tabbed pseudo-terminal of Jupyter sessions, with a menu bar for common actions. """ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import sys import webbrowser from threading import Thread from jupyter_core.paths i...
worker_pool_main.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...
story_command.py
import json import threading import requests from discord_bot.commands.base_command import BaseCommand class StoryCommand(BaseCommand): """ Fetch a random story from an API """ COMMAND_OPTION = 'story' def __init__(self, client, config): """ :param client: discord client ...
utils.py
from bitcoin.rpc import RawProxy as BitcoinProxy from btcproxy import BitcoinRpcProxy from collections import OrderedDict from decimal import Decimal from ephemeral_port_reserve import reserve from lightning import LightningRpc import json import logging import lzma import os import random import re import shutil impo...
ReadIt.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Document Reader functions This program is the mechanics for the Document Reader Program. It contains the functionality of the buttons and the what and how different information is obtained and given. The layout and design for the program is in reader.py and was g...
test_map_runner.py
# Copyright 2021 Zilliz. 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 applicable law or agree...
runtests.py
#!/usr/bin/env python from __future__ import print_function import atexit import base64 import os import sys import re import gc import heapq import locale import shutil import time import unittest import doctest import operator import subprocess import tempfile import traceback import warnings import zlib import glo...
application.py
""" This is the main module for the Flask webserver """ import functools from flask import Flask, render_template, request, redirect, session, Response, url_for import json import requests import time import pyDes from threading import Thread import logging from sys import path path.append('..') from core.Authorizat...
copy.py
# coding: utf-8 # Copyright 2013 The Font Bakery 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 re...
scan.py
# -*- coding: utf-8 -*- """Scan module.""" import logging import queue import time import threading from concurrent.futures import ThreadPoolExecutor from scapy.all import sniff from scapy.layers.dot11 import Dot11 class Scan: """Scan a wireless interface for passenger' WiFi ProbeRequest data Attributes: ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
BeadsEe.py
#!/usr/bin/env /usr/bin/python # -*- coding: utf-8 -*- # ----------------------------------------------- # ROS Node # Beads End effector Control # # The MIT License (MIT) # Copyright (C) 2020 myasu. # ----------------------------------------------- import logging import os import rospy import rosparam import time impo...
main.py
from subprocess import Popen, PIPE from threading import Thread from queue import Queue, Empty import atexit import os import sys agent_processes = [None, None] t = None q = None def cleanup_process(): global agent_processes for proc in agent_processes: if proc is not None: proc.kill() def...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools ssl =...
test_pr_preview.py
try: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer except ImportError: # Python 3 case from http.server import BaseHTTPRequestHandler, HTTPServer import contextlib import errno import json import os import shutil import stat import subprocess import tempfile import threading subject = os.pa...
04_dynamic_web_server.py
import socket import re import sys from multiprocessing import Process # 设置静态文件根目录 HTML_ROOT_DIR = "./html" # 设置脚本文件根目录 WSGI_PYTHON_DIR = "./wsgipython" class HTTPServer(object): def __init__(self): self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server_socket.setsock...
crs_reco.py
""" Fitting functions for CRS2-based FreeDOM event reconstruction Also provides a main() function to drive a CRS2-based reconstruction job """ __author__ = "Aaron Fienberg" import argparse import pickle import math import time import json import datetime import pkg_resources import functools import sys from multipr...
speechSpyGlobalPlugin.py
# A part of NonVisual Desktop Access (NVDA) # Copyright (C) 2018 NV Access Limited # This file may be used under the terms of the GNU General Public License, version 2 or later. # For more details see: https://www.gnu.org/licenses/gpl-2.0.html """This module provides an NVDA global plugin which creates a and robo...
forch_proxy.py
"""Module for proxy server to aggregate and serve data""" import functools import threading import urllib.request from forch.http_server import HttpServer from forch.utils import get_logger DEFAULT_PROXY_PORT = 8080 DEFAULT_SERVER_ADDRESS = '127.0.0.1' class ForchProxy(): """Class that implements the module th...
hypeman_listener.py
# -*- coding: utf-8 -*- """ HypeMan in python """ import configparser import socketserver #import time import json import threading import discord import os config = configparser.ConfigParser() config.read('hypeman.ini') BOT_ID = config['HYPEMAN']['BOT_ID'] PORT = config.getint('HYPEMAN', 'PORT') HOST = config['HYPE...
test_kafka_eager.py
# Copyright 2018 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 applic...
child_processes.py
from __future__ import print_function from six.moves import queue import atexit import base64 import inspect import shlex import signal import subprocess import sys import threading import time import uuid import os import pickle import pipes from six import string_types from artemis.general.should_be_builtins imp...
runtests_log_handler.py
# -*- coding: utf-8 -*- ''' :codeauthor: Pedro Algarvio (pedro@algarvio.me) :copyright: Copyright 2016 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. pytestsalt.salt.log_handlers.pytest_log_handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
games_cog.py
import re from multiprocessing import Process, Queue from typing import Union import discord from discord.ext import commands from lib.connectX import Board as ConnectX from lib.discord_interface import add_choices_message, wait_for_choice, remove_choices from lib.emoji import extract_emoji from lib.emotes import bas...
ngram_wrapper.py
""" Service wrapper for the ngram model - Gensim implementation. """ from typing import Tuple, Optional # noqa # pylint: disable=unused-import import logging import os import uuid import requests import json import pandas as pd from multiprocessing import Process from werkzeug.datastructures import FileStorage impo...
rust_cli.py
import json import logging import os import sys import threading from uuid import uuid4 import easygui import requests import urllib3 from flask import Flask, render_template, request from push_receiver.push_receiver import listen, gcm_register, fcm_register # Dealing with hiding the messages :) cli = sys.modules["fl...
Table.py
import time import threading import py_cui NO_RESULTS = "Nothing to display! Try searching for your heart's desire 😻" class Table: def __init__( self, player, title: str, x_offset, y_offset, width, height, elements: list, select_callback, ...
scrim_finder_cog.py
from discord.ext.commands import Cog, Bot from discord.ext import commands from multiprocessing import Process, Queue from lib.config import scraper_token, logger import asyncio import discord import re class ScrimScraper(Bot): async def on_ready(self): logger.info(f"Scraper logged in as {self.user.name}...
leda.py
import threading import time import signal class Leda: """Handles Timing, data capture and logging""" def __init__(self, camera_obj, cam_period, uart_obj, serial_period, gps_obj, logger_obj, debug_obj): # assign capture periods self.cam = camera_obj self.cam_period = cam_period ...
__init__.py
import os import re import select import subprocess import threading import time from platypush.context import get_bus from platypush.message.response import Response from platypush.plugins.media import PlayerState, MediaPlugin from platypush.message.event.media import MediaPlayEvent, MediaPlayRequestEvent, \ Medi...
fake_snapd.py
# Copyright 2021 Canonical 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 agreed to in writing, s...
tracker.py
# Copyright 1999-2021 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...
engine.py
""" Main BZT classes Copyright 2015 BlazeMeter 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...
volumio_event_receiver.py
import logging from http.server import HTTPServer, BaseHTTPRequestHandler from socketserver import ThreadingMixIn from volumio_webthing.volumio import VolumioListener import requests import json import threading class EventHandler(BaseHTTPRequestHandler): handler = None def do_POST(self): try: ...
test_poplib.py
# expected: fail """Test script for poplib module.""" # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL # a real test suite import poplib import asyncore import asynchat import socket import os import time import errno from unittest import TestCase, skipUnless from test import test_support from...
views.py
import uuid import re from os import path import threading import logging import requests from .webvtt_utils import create_vtt_from_azure_output, create_json_vtt_from_azure_output from django.contrib import messages from django.contrib.auth.decorators import login_required from django.shortcuts import render, get_ob...
train_abstractive.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import platform import torch from pytorch_transformers import BertTokenizer import distributed from models import data_loader, model_builder from mod...
tcp.py
#!/usr/bin/env python3 # MIT License # # Copyright (C) 2020, Entynetproject. All Rights Reserved. # # 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 lim...
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from typing import Dict, List from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR from common.hardware import HA...
SAVED.py
import os try: from tkinter import * import tkinter as tk from tkinter import messagebox import tkinter.scrolledtext as tkst import time import pickle from datetime import datetime from shutil import copyfile import random from vlc import Instance import ctypes from subpr...
base.py
"""Contains the abstract interface for sending commands back to a vehicle interface. """ import numbers import time import threading import binascii try: from queue import Queue from queue import Empty except ImportError: # Python 3 from queue import Queue from queue import Empty class ResponseRec...
participant_server.py
#!/usr/bin/env python # Author: # Florian Kaufmann (DE-CIX) import json from multiprocessing.connection import Listener from threading import Thread import os import sys ''' server for participants to handle policy updates ''' class ParticipantServer(object): def __init__(self, address, port, logger): ...
test_fanout.py
"Test diskcache.fanout.FanoutCache." from __future__ import print_function import collections as co import errno import functools as ft import hashlib import io import mock import os import os.path as op import pytest import random import shutil import sqlite3 import subprocess as sp import sys import tempfile import...
client.py
import rpyc import threading def connect_and_call(): c = rpyc.connect("172.17.0.2", 18861) print(c.root.get_answer()) t = threading.Thread(target=connect_and_call) t.start() print('client start...') input('any key')
mturk_manager.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. import logging import math...
run_summarization.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # # 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...
download_cache_test.py
import os import textwrap import time import unittest from collections import Counter from threading import Thread from bottle import static_file, request import pytest from conans.client.downloaders.cached_file_downloader import CachedFileDownloader from conans.test.utils.test_files import temp_folder from conans.te...
subproc_vec_env.py
import multiprocessing from collections import OrderedDict import numpy as np from stable_baselines.common.tile_images import tile_images from stable_baselines.common.vec_env.base_vec_env import (CloudpickleWrapper, VecEnv) import gym def _worker(remote, par...
__init__.py
from flask import Flask from flask_cors import CORS from flask_socketio import SocketIO from pathlib import Path from shutil import copyfile from ruamel.yaml import YAML import pathlib from threading import Thread BASE_PATH = Path(__file__).parents[1] socketio = SocketIO() yaml = YAML() def create_di...
Coyote.py
import os import socket import subprocess from subprocess import call from subprocess import Popen, PIPE from scapy.all import * from scapy.layers.inet import IP from scapy.layers.l2 import Ether from scapy.layers.eap import EAP from scapy.layers.dhcp import DHCP """ # To remove DHCP service on attacking machine upd...
__init__.py
from ctypes import sizeof from types import SimpleNamespace import socket import threading from pyardrone.navdata.options import Metadata, OptionHeader, index from pyardrone.abc import BaseClient header = 0x55667788 class NavDataError(Exception): pass class ChecksumError(NavDataError): pass class Incor...
saml.py
from datetime import datetime, timedelta from threading import Thread from flask import current_app import json import os from ..lib.certutil import KEY_FILE, CERT_FILE, create_self_signed_cert from ..lib.utils import urlparse class SAML(object): def __init__(self): if current_app.config['SAML_ENABLED']:...
test_barrier.py
import threading from nose.tools import eq_ from kazoo.testing import KazooTestCase class KazooBarrierTests(KazooTestCase): def test_barrier_not_exist(self): b = self.client.Barrier("/some/path") eq_(b.wait(), True) def test_barrier_exists(self): b = self.client.Barrier("/some/path"...
testing.py
from pyftpdlib import ftpserver import asyncore import threading import logging import StringIO _stop_serving = False def start_ftp_server(dir, user='test', password='testpw', host='', port=2001, suppress_real_errors=True): # we don't want our FTP server to create all ki...
multirunner.py
#!/usr/bin/env python """ Multirunner example Stephen Bailey Lawrence Berkeley National Lab March 2019 """ import sys, os, time import multiprocessing as mp import argparse import glob parser = argparse.ArgumentParser(usage = "{prog} [options]") parser.add_argument("-i", "--indir", type=str, help="input directory"...
example_test.py
import re import os import struct import socket import http.server from threading import Thread import ssl from tiny_test_fw import DUT import ttfw_idf import random import subprocess server_cert = "-----BEGIN CERTIFICATE-----\n" \ "MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\ ...
draw_rect.py
import queue import threading import tkinter as tk import wx from component import draw_rect app = wx.App(False) q = None def prepare_refresh_screen(): """ prepare for refresh the full screen to clean up the last draw angle :return: """ root = tk.Tk() root.overrideredirect(True) root.at...
__init__.py
import contextlib import datetime import errno import functools import inspect import os import re import signal import socket import subprocess import sys import tempfile import threading from collections import namedtuple from enum import Enum from warnings import warn import six import yaml from six.moves import co...
train.py
import argparse import logging import math import os import random import time from pathlib import Path from threading import Thread import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler impo...
ltr_watcher.py
import threading try: from . import linuxtrack except Exception: #ImportError import linuxtrack import time try: from talon import rctx except ImportError: rctx = None class Watcher(object): def __init__(self): self.started = False self.callbacks = set() self.running_cv = ...
AmazonBot_multi.py
import oneinstance from multiprocessing import Process import sys try: product = str(sys.argv[1]) instances = int(sys.argv[2]) headless = str(sys.argv[3]) if __name__ == '__main__': for items in range(0,instances): print(f"Starting Search for {product}") p = Process(ta...
worker.py
import argparse from multiprocessing import Process from fifo import FifoWorker parser = argparse.ArgumentParser(description='Fifo Worker') parser.add_argument('module', help='the python module to process tasks from') parser.add_argument('--broker', dest='broker', default='redis...
main.py
import tweepy import logging import emoji # import config_creds as config import config import time import textgears import re from PIL import Image, ImageChops import requests from io import BytesIO # TODO: add threading for the img w/ an upd a day # TODO: check if possible to have two threads w/ # a while lo...
core.py
############################################################################# # # $Id: core.py,v 2.104.2.19 2008/08/19 14:30:38 irmen Exp $ # Pyro Core Library # # This is part of "Pyro" - Python Remote Objects # which is (c) Irmen de Jong - irmen@users.sourceforge.net # ##############################################...
comms.py
import os import signal import socket import sys import time import threading def str2bytes(s): if type(s) == str: return bytes(s, "utf8") else: return s def bytes2str(b): if type(b) == bytes: return str(b, "utf8") else: return b class Comms: def __init__(self, h...
exemple-dht11.py
#!/usr/bin/python3 import sys import Adafruit_DHT import json from multiprocessing import Process # def main(): class dht(object): def __init__(self,gpio_dht,dht_type): self.gpio,self.dht = gpio_dht,dht_type def get_info(self): self.humidity, self.temperature = A...
multicore.py
import multiprocessing import sys if (sys.version_info > (3, 0)): import queue else: import Queue as queue def fun(f, q_in, q_out): try: while True: # print("%s : seeking work" % os.getpid()) i, x = q_in.get(True, 1) try: ret = f(x) ...
market_data_sim.py
from algoplex.api.common.market_data import MarketData import threading import os import time class MarketDataSim(MarketData): def __init__(self, market_data_file): self.market_data_file = market_data_file self.subscribers = [] self.subscribed = False self.watcher = None se...
ddos.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # python 3.3.2+ Hammer Dos Script v.1 # by Can Yalçın # only for legal purpose from queue import Queue from optparse import OptionParser import time,sys,socket,threading,logging,urllib.request,random from colorama import Fore import sys hour = time.strftime("%H:%M:%S") nara...
SoloFaceDetect.py
import cv2 import sys import time import threading from SoloCamera import SoloCamera #open HDMI-In as a video capture device #BE SURE YOU HAVE RUN `SOLO VIDEO ACQUIRE` video_capture = SoloCamera() #HDMI-In uses a ring buffer that stops grabbing new frames once full #so this allows us to remove excess frames that we a...
main.py
#!/usr/bin/env python3 import argparse import os import torch import numpy as np import torch.multiprocessing as mp import my_optim from envs import * # from wrappers import * from model import ActorCritic from test import test from train import train # Training settings parser = argparse.ArgumentParser(description=...
quickping.py
""" quickping/quickping.py Python3 package for find active addresses for IPv4 in range of IP address """ import sys import time import subprocess import ipaddress from threading import Thread from queue import Queue from .error import AddressRangeError from .color import colorize class Quickping: def __init__(s...
stoppable_thread.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from threading import Thread, Event class StoppableThread(object): def __init__(self): self._stop = Event() self._stop.set() def _run(self): while not self._stop.isSet(): self.run() def run(self): pass def st...
main.py
import requests import time import threading def get_links(): f = open("links.txt", "r") text = f.read() links = text.split("\n") for i in range(len(links)): if links[i] == "": links.pop(i) print(f"Found {len(links)} links.") return links def setup(): choice = input("W...
sound.py
import wave from threading import Thread from pyaudio import PyAudio def play_wav(path): def target(): chunk = 1024 f = wave.open(path) p = PyAudio() stream = p.open(format=p.get_format_from_width(f.getsampwidth()), channels=f.getnchannels(), rate=f.getfram...
bmv2.py
import os import socket import re import json import threading import urllib2 import time from contextlib import closing from mininet.log import info, warn, error from mininet.node import Switch, Host SIMPLE_SWITCH_GRPC = 'simple_switch_grpc' PKT_BYTES_TO_DUMP = 80 VALGRIND_PREFIX = 'valgrind --leak-check=yes' SWITC...