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
| """ CLI parser example using dataclasses. Two different approaches. | |
| As presented by ArjanCodes https://youtu.be/Y9_h7ehjhO4?si=YrtPhBs_TXvUOv6A&t=1295 | |
| But seems to be found on GitHub or Reddit as well, so not sure if it's his original work or if he just found it somewhere else. | |
| Doesn't matter, it's pretty helpful. | |
| """ | |
| import argparse | |
| from dataclasses import dataclass, fields | |
| from typing import Self, Type | |
| @dataclass |
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
| from typing import Dict, List, Set, Tuple, Union | |
| import json | |
| def analyze_nested_structure( | |
| variable: Union[List, Dict, Tuple, Set], indent: int = 0 | |
| ) -> None: | |
| """ | |
| A generic (recursive) function to analyze the structure of a nested list, dictionary, tuple, or set. | |
| comment out the recursive call to avoid printing large content as required. | |
| """ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| name: allround | |
| channels: | |
| - anaconda | |
| - conda-forge | |
| - defaults | |
| dependencies: | |
| - python=3.8 | |
| - anaconda | |
| - pip | |
| - tensorflow-gpu |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| #!/usr/bin/env python3 | |
| # coding: utf-8 | |
| # Test Cuda availability and benchmark CPU vs GPU | |
| # | |
| # see for example: https://colab.research.google.com/notebooks/gpu.ipynb | |
| import tensorflow as tf | |
| import timeit |
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
| import tkinter as tk | |
| import ctypes | |
| import sys | |
| class myBox(tk.Tk): | |
| '''Prevents a Windows system from sleeping by keeping the screen alive. | |
| At the same time an excercise in using tkinter.... | |
| (Python 3) | |
| Inspired by multiple code snippets on the net, certainly the | |
| SetThreadExecutionState gimmick. |