Как я могу поделиться своим подключением к Интернету через USB?

Я нашел хороший скрипт Python для этого на GitHub, написанный Джастином Абрамом, который также печатает шестнадцатеричные коды цветов.

Загрузите скрипт в текущий рабочий каталог

wget https://gist.githubusercontent.com/justinabrahms/1047767/raw/a79218b6ca8c1c04856968d2d202510a4f7ec215/colortest.py

] дайте ему разрешение на выполнение

chmod +x colortest.py

Запустите его:

./colortest.py

хороший скрипт Python для этого на GitHub

Вот сценарий полностью в случае ссылки-rot:

#!/usr/bin/env python
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349

print "Color indexes should be drawn in bold text of the same color."
print

colored = [0] + [0x5f + 40 * n for n in range(0, 5)]
colored_palette = [
    "%02x/%02x/%02x" % (r, g, b) 
    for r in colored
    for g in colored
    for b in colored
]

grayscale = [0x08 + 10 * n for n in range(0, 24)]
grayscale_palette = [
    "%02x/%02x/%02x" % (a, a, a)
    for a in grayscale 
]

normal = "\033[38;5;%sm" 
bold = "\033[1;38;5;%sm"
reset = "\033[0m"

for (i, color) in enumerate(colored_palette + grayscale_palette, 16):
    index = (bold + "%4s" + reset) % (i, str(i) + ':')
    hex   = (normal + "%s" + reset) % (i, color)
    newline = '\n' if i % 6 == 3 else ''
    print index, hex, newline, 

2
задан 4 February 2012 в 07:47

0 ответов

Другие вопросы по тегам:

Похожие вопросы: