This file contains hidden or 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
| def decorator_reporter(report_string="Running...", period=1, reporting_function=None): | |
| """ | |
| A decorator function that will "report." | |
| This function returns 'function_wrapper.' | |
| :param report_string: The string to "report." | |
| :param period: The number of seconds between reports. | |
| :param reporting_function: The reporting function to use instead of 'print.' | |
| This could be a logging function like 'logging.debug' for instance. | |
| This must be capable of taking no more than one string argument. |
This file contains hidden or 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
| function addAlias() | |
| { | |
| echo "alias $1='$2'" >> ~/.bash_profile | |
| . ~/.bash_profile #reload .bash_profile | |
| } |
This file contains hidden or 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
| function newBranch() | |
| { | |
| git checkout -b "$1" | |
| if [ $? -eq 0 ]; then | |
| git push -u | |
| fi | |
| } |
This file contains hidden or 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
| function deleteBranch() | |
| { | |
| git branch -d "$1" | |
| if [ $? -ne 0 ]; then | |
| echo "Trying with -D" | |
| git branch -D "$1" | |
| fi | |
| if [ $? -ne 0 ]; then |
This file contains hidden or 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
| Python | |
| - A directory that contains a __main__.py file can be executed directly by the python interpreter | |
| - If that directory contains a __init__.py file it can be executed as a module. | |
| - If using MatPlotLib you might receive a "Python was not installed as a framework..." error. | |
| - Create a file `~/.matplotlib/matplotlibrc` and populate it with `backend: TkAgg` to solve the problem. | |
| - Why? Who fuckin knows? | |
| Jupyter | |
| - When installing a Javascript Jupyter kernel following the following page: | |
| - https://github.com/n-riesco/ijavascript |
This file contains hidden or 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
| class TemporaryDirectory(object): | |
| """ | |
| Produces a temporary directory on the system using tempfile.mkdtemp() under the hood. | |
| Exposes a path attribute that will represent the path of the directory | |
| until the instance has deleted the temporary directory. | |
| TemporaryDirectory can be used as a context manager. | |
| """ |
This file contains hidden or 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
| class DefaultList(list): | |
| def __init__(self, iterable=[], default=None): | |
| super(self.__class__, self).__init__(iterable) | |
| self.default = default | |
| def __getitem__(self, index): | |
| """ | |
| If 'index' is outside of the bounds (including negative indexing) of the list, | |
| return 'self.default.' |
This file contains hidden or 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
| class ColorCycler | |
| { | |
| /** | |
| * A class that will return a CSS-valid "hsl()" string, assigned to distinct items. | |
| * | |
| * An internal mapping of "items" (any valid Object key) to "hsl()" strings. | |
| * If a color is requested for an existing item, the existing color is returned. | |
| * If a color is requested for a non-existing item, a new color is generated, stored for future use and returned. | |
| * | |
| * When a new color is generated the "hue" value is rotated (0 - 360). |
This file contains hidden or 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
| { | |
| "client_secrets": { | |
| "web": { | |
| "auth_uri": "<Retrieve from IBMid registration>", | |
| "client_id": "<your_client_id>", | |
| "client_secret": "<your_client_secret>", | |
| "token_uri": "<Retrieve from IBMid registration>", | |
| "token_introspection_uri": "<Retrieve from IBMid registration>", | |
| "issuer": "<Retrieve from IBMid registration>" | |
| } |
This file contains hidden or 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
| vertical-align: top; | |
| display: inline-block; | |
| position: relative; | |
| top: 50%; | |
| transform: translateY(-50%); |