Beispiel #1
0
 def setUp(self):
     """Start web driver"""
     self.page = page()
     self.driver = webdriver.Chrome()
     self.helper = help(self.driver)
     self.driver.implicitly_wait(10)
     self.driver.get('https://www.google.com/')
     pageTitle = self.driver.title
     assert "Google" in pageTitle
Beispiel #2
0
#!/usr/bin/env python
import sys, string
import re
import helper

helper.help("Expands race/role abbreviations. Example usage: !wtf TrBe")


def expand_any(what, lookup, expanded):
    if what in lookup:
        return pick_first(expanded[lookup.index(what)])
    else:
        llookup = [x.lower() for x in lookup]
        lwhat = what.lower()
        if lwhat in llookup:
            return pick_first(expanded[llookup.index(lwhat)])
    return None


def pick_first(thing_or_list):
    return thing_or_list[0] if isinstance(thing_or_list,
                                          list) else thing_or_list


def expand_race(what):
    return expand_any(what, helper.SPECIES_ABBR, helper.SPECIES)


def expand_role(what):
    return expand_any(what, helper.ROLES_ABBR, helper.ROLES)
Beispiel #3
0
#! /usr/bin/python

from datetime import datetime, timedelta
import time
import helper

TOURNEY = helper.default_tourney()
TOURNEY_BEGIN = TOURNEY.start_date()
TOURNEY_END   = TOURNEY.end_date()
TOURNEY_NAME = '%d %s tournament' % (TOURNEY_BEGIN.year, TOURNEY.game_version())

helper.help('Shows the UTC time on crawl.akrasiac.org.')

def pretty_delta(delta):
  seconds = delta.seconds
  hours = seconds / (60 * 60)
  minutes = (seconds / 60) % 60
  seconds = seconds % 60
  days = delta.days

  keys = [ [days, 'day'], [hours, 'hour'],
           [minutes, 'minute'],  [seconds, 'second'] ]
  keys = ["%d %s%s" % (k[0], k[1], k[0] > 1 and 's' or '')
          for k in keys if k[0] > 0]
  if not keys:
    return "now"
  elif len(keys) == 1:
    return "in " + keys[0]
  return "in " + ", ".join(keys[:-1]) + " and " + keys[-1]

now = datetime.utcnow()
import serial
import os
import sys
import helper
from termcolor import colored
from prettytable import PrettyTable
import logging

log = logging.getLogger()
helps = helper.help()
config = helps.load_config()

Board = "SignalIO board v1.0"
SOC = "ESP32 WROOM 4mb Flash"

try:
    operating_system = os.uname()
    if operating_system[0] == 'Linux':
        os.system("clear")

    else:
        os.system('cls')

except Exception as e:
    pass


def on_load():
    command = PrettyTable(['Board', 'SOC'])
    command.add_row([Board, SOC])
    print("----------------BOARD--------------------------")
Beispiel #5
0
#! /usr/bin/python

from datetime import datetime, timedelta
import time
import helper
import socket

TOURNEY = helper.default_tourney()
TOURNEY_BEGIN = TOURNEY.start_date()
TOURNEY_END   = TOURNEY.end_date()
TOURNEY_NAME = '%d %s tournament' % (TOURNEY_BEGIN.year, TOURNEY.game_version())

helper.help('Shows the UTC time on %s.' % socket.getfqdn())

def pretty_delta(delta):
  seconds = delta.seconds
  hours = seconds / (60 * 60)
  minutes = (seconds / 60) % 60
  seconds = seconds % 60
  days = delta.days

  keys = [ [days, 'day'], [hours, 'hour'],
           [minutes, 'minute'],  [seconds, 'second'] ]
  keys = ["%d %s%s" % (k[0], k[1], k[0] > 1 and 's' or '')
          for k in keys if k[0] > 0]
  if not keys:
    return "now"
  elif len(keys) == 1:
    return "in " + keys[0]
  return "in " + ", ".join(keys[:-1]) + " and " + keys[-1]
Beispiel #6
0
#!/usr/bin/env python
import sys, string
import re
import helper

helper.help("Expands race/role abbreviations. Example usage: !wtf TrBe")

def expand_any(what, lookup, expanded):
    if what in lookup:
        return pick_first(expanded[ lookup.index(what) ])
    else:
        llookup = [ x.lower() for x in lookup ]
        lwhat = what.lower()
        if lwhat in llookup:
            return pick_first(expanded[ llookup.index(lwhat) ])
    return None

def pick_first(thing_or_list):
    return thing_or_list[0] if isinstance(thing_or_list, list) else thing_or_list

def expand_race(what):
    return expand_any(what, helper.SPECIES_ABBR, helper.SPECIES)

def expand_role(what):
    return expand_any(what, helper.ROLES_ABBR, helper.ROLES)

def expand(what):
    if what == '': return [ 'WTF?' ]
    if what.lower() == 'wtf': return [ 'WTFF!' ]

    args = re.findall(r'(?i)([a-z]{2})', what) or [ what ]
Beispiel #7
0
#!/usr/bin/python
#coding: utf-8

import helper
import sys
import random

helper.help('Celebrate!')

beverage = [
    ('whiskey', 2),
    ('beer', 2),
    ('mead', 2),
    ('lager', 2),
    ('vodka', 2),
    ('cider', 2),
    ('tequila', 2),
    ('gin', 2),
    ('bourbon', 2),
    ('scotch', 2),
    ('rum', 2),
    ('brandy', 2),
    ('cognac', 1),
    ('vermouth', 1),
    ('saké', 1),
    ('sangria', 1),
    ('goldschläger', 1),
    ('absinthe', 1),
    ('cabernet sauvignon', 1),
    ('moonshine', 1),
]
Beispiel #8
0
#! /usr/bin/python

from datetime import datetime, timedelta
import time
import helper
import socket

TOURNEY = helper.default_tourney()
TOURNEY_BEGIN = TOURNEY.start_date()
TOURNEY_END = TOURNEY.end_date()
TOURNEY_NAME = '%d %s tournament' % (TOURNEY_BEGIN.year,
                                     TOURNEY.game_version())

helper.help('Shows the UTC time on %s.' % socket.getfqdn())


def pretty_delta(delta):
    seconds = delta.seconds
    hours = seconds / (60 * 60)
    minutes = (seconds / 60) % 60
    seconds = seconds % 60
    days = delta.days

    keys = [[days, 'day'], [hours, 'hour'], [minutes, 'minute'],
            [seconds, 'second']]
    keys = [
        "%d %s%s" % (k[0], k[1], k[0] > 1 and 's' or '') for k in keys
        if k[0] > 0
    ]
    if not keys:
        return "now"
Beispiel #9
0
def sniffles(argv):
    output = None
    hex_ = False
    protocol = None

    try:
        opts, args = getopt.getopt(
            argv, "ho:t:xf:",
            ["output=", "timeout=", "hexdump", "help", "filter="])
        if args == []:
            helper.help(1)
        interface = args[0].lower()
        # interface = helper.get_ip_addr(str.encode(interface))
        # if(interface == -1):
        #     helper.help(1)
    except getopt.GetoptError:
        print("Exception")
        helper.help(1)
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            helper.help(0)
        elif opt in ("-o", "--output"):
            output = arg
        elif opt in ("-t", "--timeout"):
            timeout = int(arg)
            if timeout < 1:
                helper.printing.error(
                    "time: %d -- Not valid. time needs to be more than 1" %
                    (timeout))
                helper.help(1)
            signal.alarm(timeout)
        elif opt in ("-x", "--hexdump"):
            hex_ = True
        elif opt in ("-f", "--filter"):
            protocol = arg.lower()
            if protocol not in ("ethernet", "ip", "tcp", "udp", "dns", "icmp"):
                helper.printing.error("Protocol: %s -- Not found" % (protocol))
                helper.help(1)
        else:
            if __debug__:
                print("opts are:\n")
                print(opts)
                print("args are:\n")
                print(agrs)
            helper.help(1)
        # print(interface)
    conn = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,
                         socket.ntohs(0x0003))
    helper.printing.debug(interface)
    # conn.bind((interface, 0))
    # conn.setsockopt(socket.AF_PACKET, socket.IP_HDRINCL, 1)
    if protocol is None:
        helper.parsing.print_first_2_blocks(True, output, hex_)
    while True:
        r = conn.recv(65535)
        helper.printing.debug(r)
        helper.printing.debug(str(len(r)))
        helper.parsing.print_all_bytes(r, protocol == None, output, hex_)
        if protocol is not None:
            helper.parsing.parse_protocol(r, protocol)
Beispiel #10
0
import serial
import os
import sys
import helper
from termcolor import colored
from prettytable import PrettyTable
import logging

log = logging.getLogger()
help = helper.help()
config = help.load_config()

Board = "SignalIO board v1.0"
SOC = "ESP32 WROOM 4mb Flash"


def on_load():
    command = PrettyTable(['Board', 'SOC'])
    command.add_row([Board, SOC])
    print("----------------BOARD--------------------------")
    print(command)


def Serial_init():
    try:
        port = serial.Serial(
                port=config["port"],
                baudrate=config["port_speed"],
                parity=serial.PARITY_NONE,
                stopbits=serial.STOPBITS_ONE,
                bytesize=serial.EIGHTBITS
Beispiel #11
0
# Launching the analysor                                                       #
################################################################################
def plot_data():
    #import plotter
    #TODO: bring in the
    return


################################################################################
# Start of benchmarking script                                                 #
################################################################################
print_header()
cpu_count = myplatform()
len_sys = len(sys.argv)
if (len_sys == 2):
    if sys.argv[1] in ['--help']: help()
    exit(0)
if (len_sys > 2):
    if sys.argv[1] in ['--use_gpu=yes', '--use_gpu=no']:
        print "sys.argv[1]: ", sys.argv[1]
    if sys.argv[2] in ['--bench_gpu=yes', '--bench_gpu=no']:
        print "sys.argv[2]: ", sys.argv[2]
    if sys.argv[3] in ['--fix_gpu=yes', '--fix_gpu=no']:
        print "sys.argv[3]: ", sys.argv[3]

    if sys.argv[4] in ['--set_gpu=0', '--set_gpu=0']:
        print "sys.argv[4]: ", sys.argv[4]
    if sys.argv[4] in ['--set_gpu=1', '--set_gpu=1']:
        print "sys.argv[4]: ", sys.argv[4]
    if sys.argv[4] in ['--set_gpu=2', '--set_gpu=2']:
        print "sys.argv[4]: ", sys.argv[4]
 def response(self):
     client = help(data["user_posts"]["End_point"])
     return client.get(request_data["route"])
Beispiel #13
0
#! /usr/bin/python

from datetime import datetime, timedelta
import time
import helper

TOURNEY = helper.default_tourney()
TOURNEY_BEGIN = TOURNEY.start_date()
TOURNEY_END = TOURNEY.end_date()
TOURNEY_NAME = '%d %s tournament' % (TOURNEY_BEGIN.year,
                                     TOURNEY.game_version())

helper.help('Shows the UTC time on crawl.akrasiac.org.')


def pretty_delta(delta):
    seconds = delta.seconds
    hours = seconds / (60 * 60)
    minutes = (seconds / 60) % 60
    seconds = seconds % 60
    days = delta.days

    keys = [[days, 'day'], [hours, 'hour'], [minutes, 'minute'],
            [seconds, 'second']]
    keys = [
        "%d %s%s" % (k[0], k[1], k[0] > 1 and 's' or '') for k in keys
        if k[0] > 0
    ]
    if not keys:
        return "now"
    elif len(keys) == 1:
Beispiel #14
0
#!/usr/bin/python
import helper
import sys

helper.help("see {banishment}")

if __name__ == '__main__':
    if sys.argv[1].lower() == 'wensley':  # nice try
        print sys.argv[2] + ' miscasts Banishment. ' + sys.argv[2] + ' is cast into the Abyss!'
    else:
        print sys.argv[2] + ' casts a spell. ' + sys.argv[1] + ' is devoured by a tear in reality!'