This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" | |
Parser will be colourised using ANSI colors via "blessings" library | |
Calling: | |
$ python ./parser.py --help | |
Will show the help printed in a different colour: | |
$ python ./parser.py options --foo sausage --bar egg | |
Will display the argument namespace in colour | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" | |
If template file "template.conf" contains: | |
["--foo", "sausage", "--bar", "egg"] | |
Calling: | |
$ python ./parser.py template template.conf | |
Will be equivalent to calling: | |
$ python ./parser.py options --foo sausage --bar egg | |
And the initial option we attach to the parser needs to appear before the command: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that "alexvicegrab.id" is my Blockstack ID. https://onename.com/alexvicegrab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# Calvin has to cross several signals when he walks from his home to school. | |
# Each of these signals operate independently. | |
# They alternate every 80 seconds between green light and red light. | |
# At each signal, there is a counter display that tells him how long it will be before the current signal light changes. | |
# Calvin has a magic wand which lets him turn a signal from red to green instantaneously. | |
# However, this wand comes with limited battery life, so he can use it only for a specified number of times. | |
# | |
# a. If the total number of signals is 2 and Calvin can use his magic wand only once, then what is the expected waiting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import curses | |
import os | |
import sys | |
from socket import * | |
from kodi.xbmcclient import * # You may need to install the kodi xbmc client | |
from blessings import Terminal # Not strictly necessary, but for printing warning messages in colour | |
t = Terminal() |