示例#1
0
def banner__nmap():
    print(
        colored.white(
            """             ██╗   ██╗███╗   ███╗      ███╗   ██╗███╗   ███╗ █████╗ ██████╗                """
        ))
    time.sleep(0.5)
    print(
        colored.white(
            """             ╚██╗ ██╔╝████╗ ████║      ████╗  ██║████╗ ████║██╔══██╗██╔══██╗              """
        ))
    time.sleep(0.5)
    print(
        colored.white(
            """              ╚████╔╝ ██╔████╔██║█████╗██╔██╗ ██║██╔████╔██║███████║██████╔╝              """
        ))
    time.sleep(0.1)
    print(
        colored.black(
            """               ╚██╔╝  ██║╚██╔╝██║╚════╝██║╚██╗██║██║╚██╔╝██║██╔══██║██╔═══╝               """
        ))
    time.sleep(0.1)
    print(
        colored.black(
            """                ██║   ██║ ╚═╝ ██║      ██║ ╚████║██║ ╚═╝ ██║██║  ██║██║                   """
        ))
    time.sleep(0.1)
    print(
        colored.black(
            """                ╚═╝   ╚═╝     ╚═╝      ╚═╝  ╚═══╝╚═╝     ╚═╝╚═╝  ╚═╝╚═╝                     """
        ))
示例#2
0
文件: cli.py 项目: Autoplectic/legit
def status_log(func, message, *args, **kwargs):
    """Executes a callable with a header message."""

    print message
    log = func(*args, **kwargs)

    if log:
        out = []

        for line in log.split('\n'):
            if not line.startswith('#'):
                out.append(line)
        print colored.black('\n'.join(out))
示例#3
0
def status_log(func, message, *args, **kwargs):
    """Executes a callable with a header message."""

    print message
    log = func(*args, **kwargs)

    if log:
        out = []

        for line in log.split('\n'):
            if not line.startswith('#'):
                out.append(line)
        print colored.black('\n'.join(out))
示例#4
0
def queryStation(sID):
    api_key = "UPIIJBD0QEG"

    url = "http://api.rideuta.com/SIRI/SIRI.svc/"
    url += "StopMonitor?stopid="  # Query type
    url += sID  # Stop ID
    url += "&minutesout=20"  # How far in the future to query
    url += "&onwardcalls=false"  # Include vehicle calls inbetween current location and stop
    url += "&filterroute="  # Filter vehicles
    url += "&usertoken="
    url += api_key

    r = requests.get(url)
    xml = r.content

    d = xmldict.xml_to_dict(xml)

    d2 = d['{http://www.siri.org.uk/siri}Siri']['{http://www.siri.org.uk/siri}StopMonitoringDelivery']['{http://www.siri.org.uk/siri}MonitoredStopVisit']['{http://www.siri.org.uk/siri}MonitoredVehicleJourney']

    if '{http://www.siri.org.uk/siri}MonitoredVehicleJourney' not in d['{http://www.siri.org.uk/siri}Siri']['{http://www.siri.org.uk/siri}StopMonitoringDelivery']['{http://www.siri.org.uk/siri}MonitoredStopVisit']:
        print "Uh Oh!"
    else:
        # Print Query Header
        localtime = time.asctime(time.localtime(time.time()))
        print ("\nQUERY STATION: %s \n" % colored.black(d['{http://www.siri.org.uk/siri}Siri']['{http://www.siri.org.uk/siri}StopMonitoringDelivery']['{http://www.siri.org.uk/siri}Extensions']['{http://www.siri.org.uk/siri}StopName']))
        print "Query Time: %s /n" % str(localtime)
        getData(nStopID, 0)
        getData(sStopID, 1)
示例#5
0
def display_info():
    """Displays Legit informatics."""

    puts('{0}. {1}\n'.format(colored.red('legit'),
                             colored.black(u'A Kenneth Reitz Project™')))

    puts('Usage: {0}'.format(colored.blue('legit <command>')))
    puts('Commands: {0}.\n'.format(
        eng_join([str(colored.green(c)) for c in sorted(cmd_map.keys())])))
示例#6
0
 def as_text(self):
     if self._face_up:
         if self._color == Color.RED:
             return colored.red(self.rank_text() + SUIT_IMAGES[self._suit])
         else:
             return colored.black(self.rank_text() +
                                  SUIT_IMAGES[self._suit])
     else:
         return '?'
示例#7
0
文件: cli.py 项目: myles/twtxt-cli
def timeline(reverse):
    timeline = twtxt.timeline(reverse=reverse)

    for tweet in timeline:
        tweet.process_text()

        puts(columns(
            [colored.black(tweet.source.nick, bold=True), 10],
            [colored.magenta(humanize.naturaldate(tweet.timestamp)), 10],
            [tweet.text, 59]
        ))
示例#8
0
文件: cli.py 项目: myles/twtxt-cli
def view(nick, reverse):
    source = twtxt.view(nick, reverse=reverse)

    puts("@{0} - {1}".format(colored.black(source.nick, bold=True),
                             source.url))

    for tweet in source.get_tweets():
        puts(columns(
            [colored.magenta(humanize.naturaldate(tweet.timestamp)), 10],
            [tweet.text, 69]
        ))
示例#9
0
文件: cli.py 项目: myles/twtxt-cli
def timeline(reverse):
    timeline = twtxt.timeline(reverse=reverse)

    for tweet in timeline:
        tweet.process_text()

        puts(
            columns(
                [colored.black(tweet.source.nick, bold=True), 10],
                [colored.magenta(humanize.naturaldate(tweet.timestamp)), 10],
                [tweet.text, 59]))
示例#10
0
文件: cli.py 项目: myles/twtxt-cli
def view(nick, reverse):
    source = twtxt.view(nick, reverse=reverse)

    puts("@{0} - {1}".format(colored.black(source.nick, bold=True),
                             source.url))

    for tweet in source.get_tweets():
        puts(
            columns(
                [colored.magenta(humanize.naturaldate(tweet.timestamp)), 10],
                [tweet.text, 69]))
示例#11
0
文件: cli.py 项目: Autoplectic/legit
def display_info():
    """Displays Legit informatics."""

    puts('{0}. {1}\n'.format(
        colored.red('legit'),
        colored.black(u'A Kenneth Reitz Project™')
    ))

    puts('Usage: {0}'.format(colored.blue('legit <command>')))
    puts('Commands: {0}.\n'.format(
        eng_join(
            [str(colored.green(c)) for c in sorted(cmd_map.keys())]
        )
    ))
示例#12
0
def display_available_branches():
    """Displays available branches."""

    branches = get_branches()

    branch_col = len(max([b.name for b in branches], key=len)) + 1

    for branch in branches:

        marker = '*' if (branch.name == repo.head.ref.name) else ' '
        color = colored.green if (branch.name
                                  == repo.head.ref.name) else colored.yellow
        pub = '(published)' if branch.is_published else '(unpublished)'

        print columns([colored.red(marker), 2],
                      [color(branch.name), branch_col],
                      [colored.black(pub), 14])
示例#13
0
文件: cli.py 项目: Autoplectic/legit
def display_available_branches():
    """Displays available branches."""

    branches = get_branches()

    branch_col = len(max([b.name for b in branches], key=len)) + 1

    for branch in branches:

        marker = '*' if (branch.name == repo.head.ref.name) else ' '
        color = colored.green if (branch.name == repo.head.ref.name) else colored.yellow
        pub = '(published)' if branch.is_published else '(unpublished)'

        print columns(
            [colored.red(marker), 2],
            [color(branch.name), branch_col],
            [colored.black(pub), 14]
        )
示例#14
0
def show_info():
    print '{0}. {1}.'.format(
        colored.red('tmpsshd'),
        colored.black('A Kenneth reitz Project')
    )
   | |           @@@ ||>@@@         |
   | |              @@@@            |
   | |                              |
   | |                              |
   | |                              |
   | |                              |
    \|______________________________|

------------------------------------------------
Thank you for visiting https://asciiart.website/
This ASCII pic can be found at
https://asciiart.website/index.php?art=objects/audio%20equipment

    ''')

print(black("\n--------------------------------------------------------------------------"))
print(magenta("Welcome to python music visualiser written by Soumya Saurav"))
print(black("--------------------------------------------------------------------------\n"))
while(True):
	try:
		filname = input(green("Enter a file name: "))
		if filname[len(filname)-3:len(filname)] == "mp3":
			print(red("Mp3 file detected, converting to wav file, this may take some time \n"))
			sound = AudioSegment.from_mp3(filname)
			sound.export("converted.wav", format="wav")
			print(green("Loading the audio file...."))
			pygame.mixer.init()
			pygame.mixer.music.load("converted.wav")
			rate, data = wav.read('converted.wav')
			#pygame.mixer.music.play()
			break
示例#16
0
文件: util.py 项目: bholt/ipa
def note(text):
    return colored.black(text)
示例#17
0
文件: util.py 项目: bholt/ipa
def heading(text):
    return colored.black(text, bold=True)
示例#18
0
def black(s):
    if settings.allow_black_foreground:
        return colored.black(s)
    else:
        return s.encode('utf-8')
示例#19
0
    def __find_pairs(self, renamed=False):
        if renamed:
            print colored.black('RENAMED')
        paired_rows = [r for r in self.rows if r.is_paired]
        paired_index = []
        for i in range(len(paired_rows)):
            if i in paired_index:
                continue
            # print paired_rows[i].new_data_file
            pair_found = False
            splitter = '.' + paired_rows[i].new_data_file.split('.')[-2]
            common_part_i = paired_rows[i].new_data_file.split(
                splitter)[0].replace('.txt', '')
            if common_part_i.endswith('R1_001'):
                common_part_i = common_part_i.replace('R1_001', 'R1')
                # paired_rows[i].new_data_file = paired_rows[i].new_data_file.replace('R1_001', 'R1')
            elif common_part_i.endswith('R2_001'):
                common_part_i = common_part_i.replace('R2_001', 'R2')
                # paired_rows[i].new_data_file = paired_rows[i].new_data_file.replace('R2_001', 'R2')
            if common_part_i.endswith('R_001'):
                common_part_i = common_part_i.replace('R_001', 'R')
                # paired_rows[i].new_data_file = paired_rows[i].new_data_file.replace('R_001', 'R')
            if common_part_i.endswith('F_001'):
                common_part_i = common_part_i.replace('F_001', 'F')
                # paired_rows[i].new_data_file = paired_rows[i].new_data_file.replace('F_001', 'F')
            for j in range(i + 1, len(paired_rows)):
                if j in paired_index:
                    continue
                common_part_j = paired_rows[j].new_data_file.split(
                    splitter)[0].replace('.txt', '')
                if common_part_j.endswith('R1_001'):
                    common_part_j = common_part_j.replace('R1_001', 'R1')
                    # paired_rows[j].new_data_file = paired_rows[j].new_data_file.replace('R1_001', 'R1')
                elif common_part_j.endswith('R2_001'):
                    common_part_j = common_part_j.replace('R2_001', 'R2')
                    # paired_rows[j].new_data_file = paired_rows[j].new_data_file.replace('R2_001', 'R2')
                if common_part_j.endswith('R_001'):
                    common_part_j = common_part_j.replace('R_001', 'R')
                    # paired_rows[j].new_data_file = paired_rows[j].new_data_file.replace('R_001', 'R')
                if common_part_j.endswith('F_001'):
                    common_part_j = common_part_j.replace('F_001', 'F')
                    # paired_rows[j].new_data_file = paired_rows[j].new_data_file.replace('F_001', 'F')
                tmp_assay_name = common_part_i

                for pattern in self.neglect_patterns:
                    common_part_i = common_part_i.replace(pattern, '')
                    common_part_j = common_part_j.replace(pattern, '')
                if common_part_i[:-1] == \
                        common_part_j[:-1]:
                    if paired_rows[i].source != paired_rows[j].source:
                        break
                    pair_found = True
                    paired_index.append(i)
                    paired_index.append(j)
                    paired_rows[i].pair_order = '_1'
                    paired_rows[j].pair_order = '_2'
                    self.pairs.append([paired_rows[i], paired_rows[j]])
                    paired_rows[i].assay_name = tmp_assay_name[:-1]
                    paired_rows[j].assay_name = tmp_assay_name[:-1]
                    break
                    # else:
                    #     print paired_rows[i].new_data_file.split(splitter)[0].replace('.txt', '')[:-1]
                    #     print paired_rows[j].new_data_file.split(splitter)[0].replace('.txt', '')[:-1]
                    #     exit()
            if not pair_found:
                if not self.mixed_pairs:
                    if not renamed:
                        # print colored.yellow(
                        #     'No pairs found. Going to check for combined files or rename the file names')
                        # print paired_rows[i].new_data_file, paired_rows[i].data_file
                        # exit()
                        if len(list(set([r.source for r in self.rows
                                         ]))) == len(self.rows):
                            # self.combined_pairs = True
                            paired_rows[i].combined = True
                            # print colored.cyan('Files are combined. No need for validating fastq.')
                            print colored.cyan('%s is combined.' %
                                               paired_rows[i])
                            continue
                            self.__load_sdrf_file()
                            self.pairs = []
                            return
                        # print colored.yellow('Renaming data files')
                        # self.rename_data_files()
                        self.pairs = []
                        self.__find_advanced_pairs()
                        # self.__find_pairs(renamed=True)
                        break
                    else:
                        for row in self.rows:
                            row.new_data_file = row.data_file
                        self.__find_advanced_pairs()
                        break
                else:
                    print paired_rows[i].source
                    paired_rows[i].combined = True
                    paired_rows[i].assay_name = common_part_i[:-1]
                    self.pairs.append([paired_rows[i], paired_rows[i]])
示例#20
0
def color(number):
    if number < 0:
        return colored.red(number)
    else:
        return colored.black(number)
示例#21
0
文件: cli.py 项目: myles/twtxt-cli
def info(nick):
    info = twtxt.view(nick)

    puts("@{0} - {1}".format(colored.black(info.nick, bold=True), info.url))
示例#22
0
def pprint_passage(words_df, col_to_print, char_width=80):
    # the unite function has a stray print, supress it (hopefully this can be changed)
    num_tokens = max(words_df.token_num)
    sys.stdout = open(os.devnull, 'w')
    words_df['To_Print'] = [
        re.sub(r'\s', ' ', s) for s in list(words_df[col_to_print])
    ]
    words_df >>= (
     mutate(
      sep = np_where((lead(X.cpos) == 'F') & (lead(X.To_Print) != '(') | \
       re_search_any(X.To_Print, r".+?'$") \
       , '', ' '),
     ) >> unite('word_sep', ['To_Print', 'sep'], remove=False, sep="") >>
     mutate(
      char_count = nchar(X.word_sep)
     )
    )
    sys.stdout = sys.__stdout__
    # to get lines we need to iterate through the dataframe, finding groups of characters <= char_width
    char_count = 0
    line_num = 1
    words_df['char_start'] = 0
    words_df['char_stop'] = 0
    words_df['line_num'] = line_num
    words_df['word_sep_nl'] = words_df['word_sep']
    for i, row in words_df.iterrows():
        #print(i)
        # start a new line?
        if char_count + words_df.loc[i, 'char_count'] > char_width:
            char_count = 0
            line_num += 1

            # update the previous line
            previous_text = words_df.loc[i - 1, 'word_sep_nl']
            buffer_text = (" " * math.floor(
                char_width - words_df.loc[i - 1, 'char_stop'])) + "|\n"
            words_df.loc[i - 1, 'word_sep_nl'] = previous_text + buffer_text

        words_df.loc[i, 'char_start'] = char_count
        char_count += words_df.loc[i, 'char_count']
        words_df.loc[i, 'line_num'] = line_num
        words_df.loc[i, 'char_stop'] = char_count

    # update the final line
    #i = len(words_df)
    previous_text = words_df.loc[i - 1, 'word_sep_nl']
    buffer_text = (" " * math.floor(char_width -
                                    words_df.loc[i - 1, 'char_stop'])) + "|\n"
    words_df.loc[i - 1, 'word_sep_nl'] = previous_text + buffer_text

    final_words = words_df.word_sep_nl.str.cat(sep='')
    puts(colored.black(' ' + ('_' * (char_width + 1))))
    with indent(2, quote='|'):
        puts(colored.black(final_words))
    puts(colored.black(' ' + ('_' * (char_width + 1))))

    # remove fields created here
    words_df >>= drop([
        'To_Print', 'sep', 'char_count', 'char_start', 'char_stop', 'line_num',
        'word_sep', 'word_sep_nl'
    ])
    return final_words
示例#23
0
                # Search in Simbad the parallax, Vmag and spectral type
                customSimbad = Simbad()
                # customSimbad.add_votable_fields('plx','plx_error','flux(V)','flux_error(V)','sptype','otype','ids','dist')
                customSimbad.add_votable_fields('plx', 'plx_error', 'flux(V)',
                                                'flux_error(V)', 'sptype',
                                                'otype', 'ids')
                result = customSimbad.query_region(coord.SkyCoord(ra=c.ra,
                                                                  dec=c.dec,
                                                                  frame='icrs'),
                                                   radius='15s')

                empty = 'NULL'
                                
                # Here comes the user interface part...
                puts(colored.black('\nStandard parameters\n'))

                # The metallicity error
                if ~np.isnan(exo.star_metallicity_error_min.values[0]) and ~np.isnan(exo.star_metallicity_error_max.values[0]):
                    errFeH_exo = (abs(exo.star_metallicity_error_min.values[0]) +
                                  abs(exo.star_metallicity_error_max.values[0])) / 2.0
                elif ~np.isnan(exo.star_metallicity_error_min.values[0]):
                    errFeH_exo = abs(exo.star_metallicity_error_min.values[0])
                elif ~np.isnan(exo.star_metallicity_error_max.values[0]):
                    errFeH_exo = abs(exo.star_metallicity_error_max.values[0])
                else:
                    errFeH_exo = np.nan

                # The metallicity
                FeH_exo = exo.star_metallicity.values[0]
                if np.isnan(FeH_exo):
示例#24
0
#!/usr/bin/env python
import datetime
import TheHitList
from clint.textui import puts, colored

thl = TheHitList.Application()
spacer = colored.blue('-' * 50)

print ('Today\'s Tasks')
print (spacer)
for task in thl.today().tasks():
    if task.completed:
        puts(colored.cyan(task.title))
    elif task.canceled:
        puts(colored.black(task.title))
    else:
        puts(colored.white(task.title))

    if (task.start_date is not None):
        buffer = 'Start: %s' % task.start_date.date()
        buffer += ' ' * (20 - len(buffer))
        buffer = colored.yellow(buffer)
    else:
        buffer = ' ' * 20

    if (task.due_date is not None):
        str = 'Due: %s' % task.due_date.date()
        if (task.due_date < datetime.datetime.today()):
            buffer += colored.red(str)
        else:
            buffer += colored.yellow(str)
示例#25
0
                DEC[1] = str(abs(int(DEC[1]))).zfill(2)
                DEC[2] = str(abs(round(DEC[2], 2))).zfill(4)
                if int(DEC[0]) > 0:
                    DEC[0] = '+'+DEC[0]
                if len(DEC[2]) == 4:
                    DEC[2] += '0'
                DEC = "{0} {1} {2}".format(*DEC)
                # search in Simbad the parallax, Vmag and spectral type
                customSimbad = Simbad()
                customSimbad.add_votable_fields('plx','plx_error','flux(V)','flux_error(V)','sptype','otype','ids','dist')
                result = customSimbad.query_region(coord.SkyCoord(ra=c.ra, dec=c.dec,frame='icrs'),radius='15s')

                empty='NULL'
                                
                # Here comes the user interface part...
                puts(colored.black('\nStandard parameters\n'))

                # The metallicity
                if ~np.isnan(exo.star_metallicity_error_min.values[0]) and ~np.isnan(exo.star_metallicity_error_max.values[0]):
                    errFeH_exo=(exo.star_metallicity_error_min.values[0]+exo.star_metallicity_error_max.values[0])/2
                elif ~np.isnan(exo.star_metallicity_error_min.values[0]):
                    errFeH_exo=exo.star_metallicity_error_min.values[0]
                elif ~np.isnan(exo.star_metallicity_error_max.values[0]):
                    errFeH_exo=exo.star_metallicity_error_max.values[0]
                else:
                    errFeH_exo=np.nan 
                
                FeH_exo = exo.star_metallicity.values[0]
                if np.isnan(FeH_exo):
                    puts('The ' + colored.yellow('[Fe/H]'))
                    FeH = variable_assignment(2)
示例#26
0
    words_passage_df = words_df >> mask(X.passage_num == passage_num)

    words_passage_df >>= mutate(
        words_no_target=np_where(X.target_flag == 1, '*___*', X.word),
        words_bold_target=np_where(X.target_flag == 1, '*' + X.word + '*',
                                   X.word))
    # Passage loop
    while True:
        break_all = False
        # replace the target words with *___*
        passage_no_target = pprint_passage(words_passage_df, 'words_no_target')

        puts(
            colored.black('''
			Inserisci le parole corrette per *___*. (e` → è, e^ → é)
			?parole per aiuto
			trad paroli... (tradurre paroli) o trad (tradurre tutti)
			0 per uscire
			'''))
        with indent(4, quote=' >'):
            user_words = prompt.query('>>> ')
        # replace o` with ò, replace e` with è, a` with à
        user_words = re.sub(r'o`', 'ò', user_words)
        user_words = re.sub(r'i`', 'ì', user_words)
        user_words = re.sub(r'e`', 'è', user_words)
        user_words = re.sub(r'a`', 'à', user_words)
        user_words = re.sub(r'u`', 'ù', user_words)
        user_words = re.sub(r'e\^', 'é', user_words)

        if user_words == '0':
            break_all = True
            break
示例#27
0
def black(s):
    if settings.allow_black_foreground:
        return colored.black(s)
    else:
        return s.encode('utf-8')
示例#28
0
文件: cli.py 项目: myles/twtxt-cli
def info(nick):
    info = twtxt.view(nick)

    puts("@{0} - {1}".format(colored.black(info.nick, bold=True),
                             info.url))
示例#29
0
def display_version():
    print '{0}. {1}'.format(
        colored.red('sshit'),
        colored.black('A Kenneth Reitz Project.'))
示例#30
0
def grey(text):
  return colored.black(text, bold=True)