General code cleanup
This commit is contained in:
0
audiotrim.sh
Executable file → Normal file
0
audiotrim.sh
Executable file → Normal file
9
ddusb.py
Executable file → Normal file
9
ddusb.py
Executable file → Normal file
@ -2,14 +2,15 @@
|
||||
"""Write an ISO image to a usb drive using dd."""
|
||||
|
||||
import argparse
|
||||
import configparser
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
# TODO add a config file for blacklisting certain devices e.g. /dev/sda
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-b", "--bs", default=512, help="block size", metavar="bs")
|
||||
parser.add_argument("-b", "--bs",
|
||||
default=512,
|
||||
help="block size",
|
||||
metavar="bs")
|
||||
parser.add_argument("input_file", help="input file to write")
|
||||
parser.add_argument("output_file", help="output block device")
|
||||
args = parser.parse_args()
|
||||
|
11
drivetemp.py
Executable file → Normal file
11
drivetemp.py
Executable file → Normal file
@ -13,7 +13,11 @@ import argparse
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
# ========== Constants ==========
|
||||
DUMP_CMD = ['skdump', '--temperature']
|
||||
|
||||
|
||||
# ========== Functions ==========
|
||||
def verify_device_node(query):
|
||||
"""Check if query is a device node.
|
||||
:param query: input that refers to a device
|
||||
@ -31,11 +35,10 @@ def retrieve_smart_temp(device_node):
|
||||
:returns: output of skdump in mKelvin
|
||||
:rtype: float
|
||||
"""
|
||||
dump_cmd = subprocess.run(['sudo', 'skdump', '--temperature',
|
||||
device_node],
|
||||
temp = subprocess.run(DUMP_CMD + device_node,
|
||||
capture_output=True,
|
||||
text=True)
|
||||
return float(dump_cmd.stdout)
|
||||
text=True).stdout
|
||||
return float(temp)
|
||||
|
||||
|
||||
def convert_to_celsius(mkel_temp):
|
||||
|
Reference in New Issue
Block a user