Repo for my development works-in-progress Not meant for public release
-
emptyTrash.py
- os.path.expanduser('~')
Get the value of $HOME on any particular machine to pre-pend to a path - if os.listdir(path[:-1]) == []
This checks if a dir is empty. The [:-1] is to slice off the last char of the path string. - subprocess.check_call(command + filePath, stderr=subprocess.STDOUT, shell=True)
Call a arbitrary shell command. Stderr goes to console output.
- os.path.expanduser('~')
-
setupVSCode.py
- IsDownloadable()
uses requests library to get the headers of a URL and checks content-type for downloadability (currently just checks 'text' vs 'html') - DownloadVSCodePkg(url)
Downloads a file from a URL. Opens it in the Downloads dir of the machine and uses the 'write binary' method. - pipeToDevNull = open(os.devnull, 'w')
USAGE: subprocess.check_call("ls " + outputName, stdout=pipeToDevNull, stderr=pipeToDevNull, shell=True) - subprocess.check_call
USAGE:try: subprocess.check_call("ls " + outputName, stdout=pipeToDevNull, stderr=pipeToDevNull, shell=True) return True except subprocess.CalledProcessError: return False```
- IsDownloadable()
-
setup-python-modules.py
- OSType = platform.linux_distribution()
How to get the OSType through the platform library.
- OSType = platform.linux_distribution()
-
installWebAssembly.py
- os.mkdir(path, 0o0644)
Create dir with least privelege permissions. Octals in Py3.x are in format 0oXX. Leading 0's allowed in this format, but not decimal. 0o0644 translates to '-rw-r--r--'
- os.mkdir(path, 0o0644)