<jupyter_start><jupyter_text>📚 For more information please visit our [GitHub](https://github.com/cyberboysumanjay/RcloneLab/).  ![](https://cyberboysumanjay.github.io/RcloneLab/img/title_rclonelab.png =x45)<jupyter_code>#@markdown <h3>📝 Note: Run this before use RcloneLab.</h3>
Setup_Time_Zone = False #@param {type:"boolean"}

import os; from google.colab import files; from IPython.display import HTML, clear_output

def upload_conf():
  try:
    display(HTML("<h2 style=\"font-family:Trebuchet MS;color:#446785;\">Please upload the config file of rclone (rclone.conf) from your computer.</h2><br>"))
    for fn in files.upload().keys():
      upload_conf = "{name}".format(name=fn)
      os.environ["rclone_conf"] = upload_conf
    if os.path.isfile("/content/" + upload_conf) == True:
      !mv -f $rclone_conf /root/.rclone.conf
      !chmod 666 /root/.rclone.conf
      clear_output()
      if Setup_Time_Zone == True:
        !sudo dpkg-reconfigure tzdata
        clear_output()
      return True
    else:
      return False
  except:
    clear_output()
    return False

if os.path.isfile("/usr/bin/rclone") == True:
  if upload_conf() == True:
    display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#00b24c;\">Config has been changed.</h2><br></center>"))
  else:
    display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#ce2121;\">File upload has been cancelled during upload file.</h2><br></center>"))
else:
  if upload_conf() == True:
    !rm -rf /content/sample_data/
    !curl -s https://rclone.org/install.sh | sudo bash
    clear_output()
    display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#446785;\">Installation has been successfully completed.</h2><br></center>"))
  else:
    display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#ce2121;\">File upload has been cancelled during upload file.</h2><br></center>"))
# ============================= FORM ============================= #
Mode = "Config" #@param ["Config", "Copy", "Move", "Sync", "Checker", "Deduplicate", "Remove Empty Directories", "Empty Trash", "qBittorrent", "rTorrent"]
Compare = "Size & Mod-Time" #@param ["Size & Mod-Time", "Size & Checksum", "Only Mod-Time", "Only Size", "Only Checksum"]
Source = "" #@param {type:"string"}
Destination = "" #@param {type:"string"}
Transfers = 10 #@param {type:"slider", min:1, max:20, step:1}
Checkers = 20 #@param {type:"slider", min:1, max:40, step:1}
#@markdown ---

#@markdown <center><h3><font color="#3399ff"><b>⚙️ Global Configuration ⚙️</b></font></h3></center>
Simple_Ouput = True #@param {type:"boolean"}
Skip_files_that_are_newer_on_the_destination = False #@param {type:"boolean"}
Skip_all_files_that_exist = False #@param {type:"boolean"}
Do_not_cross_filesystem_boundaries = False
Do_not_update_modtime_if_files_are_identical = False #@param {type:"boolean"}
Large_amount_of_files_optimization = False
Google_Drive_optimization = False #@param {type:"boolean"}
Dry_Run = False #@param {type:"boolean"}
Output_Log_File = "OFF" #@param ["OFF", "NOTICE", "INFO", "ERROR", "DEBUG"]
Extra_Arguments = "" #@param {type:"string"}

#@markdown <center><h3><font color="#3399ff"><b>↪️ Sync Configuration ↩️</b></font></h3></center>
Sync_Mode = "Delete during transfer" #@param ["Delete during transfer", "Delete before transfering", "Delete after transfering"]
Track_Renames = False #@param {type:"boolean"}

#@markdown <center><h3><font color="#3399ff"><b>💞 Deduplicate Configuration 💞</b></font></h3></center>
Deduplicate_Mode = "Interactive" #@param ["Interactive", "Skip", "First", "Newest", "Oldest", "Largest", "Rename"]
Deduplicate_Use_Trash = True #@param {type:"boolean"}
# ================================================================ #

### Variable Declaration

# Optimized for Google Colaboratory
os.environ["bufferC"] = "--buffer-size 96M"

if Compare == "Size & Checksum":
  os.environ["compareC"] = "-c"
elif Compare == "Only Mod-Time":
  os.environ["compareC"] = "--ignore-size"
elif Compare == "Only Size":
  os.environ["compareC"] = "--size-only"
elif Compare == "Only Checksum":
  os.environ["compareC"] = "-c --ignore-size"
else:
  os.environ["compareC"] = ""

os.environ["sourceC"] = Source
os.environ["destinationC"] = Destination
os.environ["transfersC"] = "--transfers "+str(Transfers)
os.environ["checkersC"] = "--checkers "+str(Checkers)

if Skip_files_that_are_newer_on_the_destination == True:
  os.environ["skipnewC"] = "-u"
else:
  os.environ["skipnewC"] = ""
  
if Skip_all_files_that_exist == True:
  os.environ["skipexistC"] = "--ignore-existing"
else:
  os.environ["skipexistC"] = ""
  
if Do_not_cross_filesystem_boundaries == True:
  os.environ["nocrossfilesystemC"] = "--one-file-system"
else:
  os.environ["nocrossfilesystemC"] = ""
  
if Do_not_update_modtime_if_files_are_identical == True:
  os.environ["noupdatemodtimeC"] = "--no-update-modtime"
else:
  os.environ["noupdatemodtimeC"] = ""

if Large_amount_of_files_optimization == True:
  os.environ["filesoptimizeC"] = "--fast-list"
else:
  os.environ["filesoptimizeC"] = ""
  
if Google_Drive_optimization == True:
  os.environ["driveoptimizeC"] = "--drive-chunk-size 32M --drive-acknowledge-abuse --drive-keep-revision-forever"
else:
  os.environ["driveoptimizeC"] = ""
  
if Dry_Run == True:
  os.environ["dryrunC"] = "-n"
else:
  os.environ["dryrunC"] = ""
  
if Output_Log_File != "OFF":
  os.environ["statsC"] = "--log-file=/root/.rclone_log/rclone_log.txt"
else:
  if Simple_Ouput == True:
    os.environ["statsC"] = "-v --stats-one-line --stats=5s"
  else:
    os.environ["statsC"] = "-v --stats=5s"
  
if Output_Log_File == "INFO":
  os.environ["loglevelC"] = "--log-level INFO"
elif Output_Log_File == "ERROR":
  os.environ["loglevelC"] = "--log-level ERROR"
elif Output_Log_File == "DEBUG":
  os.environ["loglevelC"] = "--log-level DEBUG"
else:
  os.environ["loglevelC"] = ""

os.environ["extraC"] = Extra_Arguments

if Sync_Mode == "Delete during transfer":
  os.environ["syncmodeC"] = "--delete-during"
elif Sync_Mode == "Delete before transfering":
  os.environ["syncmodeC"] = "--delete-before"
elif Sync_Mode == "Delete after transfering":
  os.environ["syncmodeC"] = "--delete-after"
  
if Track_Renames == True:
  os.environ["trackrenamesC"] = "--track-renames"
else:
  os.environ["trackrenamesC"] = ""
  
if Deduplicate_Mode == "Interactive":
  os.environ["deduplicateC"] = "interactive"
elif Deduplicate_Mode == "Skip":
  os.environ["deduplicateC"] = "skip"
elif Deduplicate_Mode == "First":
  os.environ["deduplicateC"] = "first"
elif Deduplicate_Mode == "Newest":
  os.environ["deduplicateC"] = "newest"
elif Deduplicate_Mode == "Oldest":
  os.environ["deduplicateC"] = "oldest"
elif Deduplicate_Mode == "Largest":
  os.environ["deduplicateC"] = "largest"
elif Deduplicate_Mode == "Rename":
  os.environ["deduplicateC"] = "rename"
  
if Deduplicate_Use_Trash == True:
  os.environ["deduplicatetrashC"] = ""
else:
  os.environ["deduplicatetrashC"] = "--drive-use-trash=false"
  
### rclone Execution

if Output_Log_File != "OFF" and Mode != "Config":
  !mkdir -p -m 666 /root/.rclone_log/
  display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#ce2121;\">Logging enables, rclone will not output log through the terminal, please wait until finished.</h2><br></center>"))

if Mode == "Config":
  !rclone --config=/root/.rclone.conf config
elif Mode == "Copy":
  !rclone --config=/root/.rclone.conf copy "$sourceC" "$destinationC" $transfersC $checkersC $statsC $loglevelC $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
elif Mode == "Move":
  !rclone --config=/root/.rclone.conf move "$sourceC" "$destinationC" $transfersC $checkersC $statsC $loglevelC --delete-empty-src-dirs $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
elif Mode == "Sync":
  !rclone --config=/root/.rclone.conf sync "$sourceC" "$destinationC" $transfersC $checkersC $statsC $loglevelC $syncmodeC $trackrenamesC $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
elif Mode == "Checker":
  !rclone --config=/root/.rclone.conf check "$sourceC" "$destinationC" $checkersC $statsC $loglevelC $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
elif Mode == "Deduplicate":
  !rclone --config=/root/.rclone.conf dedupe "$sourceC" $checkersC $statsC $loglevelC --dedupe-mode $deduplicateC $deduplicatetrashC $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
elif Mode == "Remove Empty Directories":
  !rclone --config=/root/.rclone.conf rmdirs "$sourceC" $statsC $loglevelC $dryrunC $extraC
elif Mode == "Empty Trash":
  !rclone --config=/root/.rclone.conf cleanup "$sourceC" $statsC $loglevelC $dryrunC $extraC
elif Mode == "qBittorrent":
  !chmod -R 666 /content/qBittorrent/
  !rclone --config=/root/.rclone.conf move "/content/qBittorrent/" "$destinationC" $transfersC $checkersC $statsC $loglevelC --delete-empty-src-dirs --exclude /favicon.ico $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
elif Mode == "rTorrent":
  !chmod -R 666 /content/rTorrent/
  !rclone --config=/root/.rclone.conf move "/content/rTorrent/" "$destinationC" $transfersC $checkersC $statsC $loglevelC --delete-empty-src-dirs $compareC $skipnewC $skipexistC $nocrossfilesystemC $noupdatemodtimeC $bufferC $filesoptimizeC $driveoptimizeC $dryrunC $extraC
    
### Log Output
  
if Output_Log_File != "OFF" and Mode != "Config":
  ### Rename log file and output settings.
  !mv /root/.rclone_log/rclone_log.txt /root/.rclone_log/rclone_log_$(date +%Y-%m-%d_%H.%M.%S).txt
  with open("/root/.rclone_log/" + Mode + "_settings.txt", "w") as f:
    f.write("Mode: " + Mode + \
            "\nCompare: " + Compare + \
            "\nSource: \"" + Source + \
            "\"\nDestination: \"" + Destination + \
            "\"\nTransfers: " + str(Transfers) + \
            "\nCheckers: " + str(Checkers) + \
            "\nSkip files that are newer on the destination: " + str(Skip_files_that_are_newer_on_the_destination) + \
            "\nSkip all files that exist: " + str(Skip_all_files_that_exist) + \
            "\nDo not cross filesystem boundaries: " + str(Do_not_cross_filesystem_boundaries) + \
            "\nDo not update modtime if files are identical: " + str(Do_not_update_modtime_if_files_are_identical) + \
            "\nDry-Run: " + str(Dry_Run) + \
            "\nOutput Log Level: " + Output_Log_File + \
            "\nExtra Arguments: \"" + Extra_Arguments + \
            "\"\nSync Moden: " + Sync_Mode + \
            "\nTrack Renames: " + str(Track_Renames) + \
            "\nDeduplicate Mode: " + Deduplicate_Mode + \
            "\nDeduplicate Use Trash: " + str(Deduplicate_Use_Trash))
  ### Compressing log file.
  !rm -f /root/rclone_log.zip
  !zip -r -q -j -9 /root/rclone_log.zip /root/.rclone_log/
  !rm -rf /root/.rclone_log/
  !mkdir -p -m 666 /root/.rclone_log/
  ### Send Log
  if os.path.isfile("/root/rclone_log.zip") == True:
    try:
      files.download("/root/rclone_log.zip")
      !rm -f /root/rclone_log.zip
      display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#446785;\">Sending log to your browser...</h2><br></center>"))
    except:
      !mv /root/rclone_log.zip /content/rclone_log_$(date +%Y-%m-%d_%H.%M.%S).zip
      display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#446785;\">You can use file explorer to download the log file.</h2><br><img src=\"https://cyberboysumanjay.github.io/RcloneLab/res/rclonelab/01.png\"><br></center>"))
  else:
    clear_output()
    display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#ce2121;\">There is no log file.</h2><br></center>"))
    

### Operation has been successfully completed.
if Mode != "Config":
  display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#00b24c;\">✅ Operation has been successfully completed.</h2><br></center>"))<jupyter_output><empty_output><jupyter_text>![qBittorrent](https://cyberboysumanjay.github.io/RcloneLab/img/title_qbittorrent.png =x45)<jupyter_code># ============================= FORM ============================= #
#@markdown <h3>📝 Note: Run this cell and relax.</h3>
Install_File_Server = False #@param {type:"boolean"}
# ================================================================ #

import os, string, random, psutil, IPython, uuid
import ipywidgets as widgets

from IPython.display import HTML, clear_output
from google.colab import output

SuccessRun = widgets.Button(
    description='✔ Successfully',
    disabled=True,
    button_style='success'
)

UnsuccessfullyRun = widgets.Button(
    description='✘ Unsuccessfully',
    disabled=True,
    button_style='danger'
)

class MakeButton(object):
  def __init__(self, title, callback):
    self._title = title
    self._callback = callback
  def _repr_html_(self):
    callback_id = 'button-' + str(uuid.uuid4())
    output.register_callback(callback_id, self._callback)
    template = """<button class="p-Widget jupyter-widgets jupyter-button widget-button mod-info" id="{callback_id}">{title}</button>
        <script>
          document.querySelector("#{callback_id}").onclick = (e) => {{
            google.colab.kernel.invokeFunction('{callback_id}', [], {{}})
            e.preventDefault();
          }};
        </script>"""
    html = template.format(title=self._title, callback_id=callback_id)
    return html

def RandomGenerator(size=4, chars=string.digits):
  return "".join(random.choice(chars) for x in range(size))

def CheckProcess(processName):
    for proc in psutil.process_iter():
        try:
            if processName.lower() in proc.name().lower():
                return True
        except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
            pass
    return False;
  
def AutoSSH(name,port):
  get_ipython().system_raw("autossh -l " + name + " -M 0 -fNT -o 'StrictHostKeyChecking=no' -o 'ServerAliveInterval 300' -o 'ServerAliveCountMax 30' -R 80:localhost:" + port + " ssh.localhost.run &")
  get_ipython().system_raw("autossh -M 0 -fNT -o 'StrictHostKeyChecking=no' -o 'ServerAliveInterval 300' -o 'ServerAliveCountMax 30' -R " + name + ":80:localhost:" + port + " serveo.net &")

def File_Server():
  if os.path.isfile("/content/qBittorrent/favicon.ico") == False:
    !wget -q https://cyberboysumanjay.github.io/RcloneLab/res/qbittorrent/favicon.ico -O /content/qBittorrent/favicon.ico
    !chmod 666 /content/qBittorrent/favicon.ico
  if os.path.isdir("/tools/node/lib/node_modules/http-server/") == True:
    get_ipython().system_raw("http-server /content/qBittorrent/ -p 7007 -i false -s -c-1 --no-dotfiles &")
  else:
    !npm install -g http-server
    get_ipython().system_raw("http-server /content/qBittorrent/ -p 7007 -i false -s -c-1 --no-dotfiles &")
    AutoSSH("fs" + Random_Number, "7007")

def Start_Server():
  if CheckProcess("qbittorrent-nox") == False:
    !qbittorrent-nox -d --webui-port=6006
  if Install_File_Server == True:
    File_Server()

try:
  try:
    Random_Number
  except NameError:
    !rm -rf /content/sample_data/
    !apt update -qq -y
    !npm i -g npm
    !yes "" | add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
    !apt install qbittorrent-nox -qq -y
    if os.path.isfile("/usr/bin/autossh") == False:
      !apt install autossh -qq -y
    !mkdir -p -m 666 /{content/qBittorrent,root/{.qBittorrent_temp,.config/qBittorrent}}
    !wget -q https://cyberboysumanjay.github.io/RcloneLab/res/qbittorrent/qBittorrent.conf -O /root/.config/qBittorrent/qBittorrent.conf
    Random_Number = RandomGenerator()
    AutoSSH("qb" + Random_Number, "6006")
  Start_Server()  
  clear_output()
  display(SuccessRun)
  display(MakeButton("Recheck", Start_Server))
  if Install_File_Server == True:
    display(HTML("<h2 style=\"font-family:Trebuchet MS;color:#446785;\">File Server</h2><h4 style=\"font-family:Trebuchet MS;color:#446785;\"><a style=\"font-family:Trebuchet MS;color:#356ebf;\" href=\"https://fs" + Random_Number + ".localhost.run\" target=\"_blank\">Website 1</a><br>" \
               "<a style=\"font-family:Trebuchet MS;color:#356ebf;\" href=\"https://fs" + Random_Number + ".serveo.net\" target=\"_blank\">Website 2</a></h3>"))
  display(HTML("<h2 style=\"font-family:Trebuchet MS;color:#446785;\">qBittorrent</h2><h4 style=\"font-family:Trebuchet MS;color:#446785;\"><a style=\"font-family:Trebuchet MS;color:#356ebf;\" href=\"http://qb" + Random_Number + ".localhost.run\" target=\"_blank\">Website 1</a><br>" \
               "<a style=\"font-family:Trebuchet MS;color:#356ebf;\" href=\"http://qb" + Random_Number + ".serveo.net\" target=\"_blank\">Website 2</a><br>" \
               "Username: rclonelab<br>Password: <PASSWORD></h4><br>"))
except:
  clear_output()
  display(UnsuccessfullyRun)<jupyter_output><empty_output><jupyter_text>![rTorrent](https://cyberboysumanjay.github.io/RcloneLab/img/title_rtorrent_flood.png =x45)<jupyter_code># ============================= FORM ============================= #
#@markdown <h3>📝 Note: Run this cell and relax.</h3>
# ================================================================ #

import os, string, random, psutil, IPython, uuid
import ipywidgets as widgets

from IPython.display import HTML, clear_output
from google.colab import output

SuccessRun = widgets.Button(
    description='✔ Successfully',
    disabled=True,
    button_style='success'
)

UnsuccessfullyRun = widgets.Button(
    description='✘ Unsuccessfully',
    disabled=True,
    button_style='danger'
)

class MakeButton(object):
  def __init__(self, title, callback):
    self._title = title
    self._callback = callback
  def _repr_html_(self):
    callback_id = 'button-' + str(uuid.uuid4())
    output.register_callback(callback_id, self._callback)
    template = """<button class="p-Widget jupyter-widgets jupyter-button widget-button mod-info" id="{callback_id}">{title}</button>
        <script>
          document.querySelector("#{callback_id}").onclick = (e) => {{
            google.colab.kernel.invokeFunction('{callback_id}', [], {{}})
            e.preventDefault();
          }};
        </script>"""
    html = template.format(title=self._title, callback_id=callback_id)
    return html

def random_generator(size=4, chars=string.digits):
  return "".join(random.choice(chars) for x in range(size))

def CheckProcess(processName):
    for proc in psutil.process_iter():
        try:
            if processName.lower() in proc.name().lower():
                return True
        except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
            pass
    return False;
  
def Start_Server():
  if CheckProcess("screen") == False or CheckProcess("rtorrent main") == False:
    !/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
  get_ipython().system_raw("NODE_ENV=production npm start --prefix /root/.Flood/ &")

try:
  if os.path.isfile("/usr/bin/rtorrent") == False:
    !rm -rf /content/sample_data/
    !apt update -qq -y
    !npm i -g npm
    !apt install rtorrent screen -qq -y
    if os.path.isfile("/usr/bin/autossh") == False:
      !apt install autossh -qq -y
    !mkdir -p -m 666 /{content/rTorrent/,root/.rTorrent_session}
    !mkdir -p -m 777 /root/.Flood/
    !wget -q https://cyberboysumanjay.github.io/RcloneLab/res/rtorrent/rtorrent.rc -O /root/.rtorrent.rc
    !chmod 666 /root/.rtorrent.rc
    !git clone https://github.com/cyberboysumanjay/FloodLab.git /root/.Flood/
    rT_Link = "rt" + random_generator()
    get_ipython().system_raw("autossh -M 0 -fNT -o 'StrictHostKeyChecking=no' -o 'ServerAliveInterval 300' -o 'ServerAliveCountMax 30' -R " + rT_Link + ":80:localhost:3000 serveo.net &")
    get_ipython().system_raw("autossh -l " + rT_Link + " -M 0 -fNT -o 'StrictHostKeyChecking=no' -o 'ServerAliveInterval 300' -o 'ServerAliveCountMax 30' -R 80:localhost:3000 ssh.localhost.run &")
  Start_Server()
  clear_output()
  display(SuccessRun)
  display(MakeButton("Recheck", Start_Server))
  display(HTML("<h2 style=\"font-family:Trebuchet MS;color:#446785;\">rTorrent<sup><sup><font size=\"1\">+Flood</font></sup></sup></h2><h4 style=\"font-family:Trebuchet MS;color:#446785;\"><a style=\"font-family:Trebuchet MS;color:#356ebf;\" href=\"https://" + rT_Link + ".localhost.run\" target=\"_blank\">Website 1</a><br>" \
               "<a style=\"font-family:Trebuchet MS;color:#356ebf;\" href=\"https://" + rT_Link + ".serveo.net\" target=\"_blank\">Website 2</a><br>IP: 127.0.0.1<br>Port: 5000</h4><br>"))
except:
  clear_output()
  display(UnsuccessfullyRun)<jupyter_output><empty_output><jupyter_text>![Utility](https://cyberboysumanjay.github.io/RcloneLab/img/title_utility.png =x45)<jupyter_code># ============================= FORM ============================= #
#@markdown <h3>Ubuntu Virtual Machine Updater</h3>
# ================================================================ #

from IPython.display import HTML, clear_output

!apt update -qq -y
!apt upgrade -qq -y
!npm i -g npm

clear_output()
display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#446785;\">An update has been successfully completed.</h2><br></center>"))
# ============================= FORM ============================= #
#@markdown <h3>Check VM's Status</h3>
Loop_Check = False #@param {type:"boolean"}
Loop_Interval = 5 #@param {type:"slider", min:1, max:15, step:1}
# ================================================================ #

import time
from IPython.display import clear_output
Loop = True

try:
  while Loop == True:
    clear_output()
    !top -b -n1
    if Loop_Check == False:
      Loop = False
    else:
      time.sleep(Loop_Interval)
except:
  clear_output()
# ============================= FORM ============================= #
#@markdown <h3>Get VM's Specification</h3>
Output_Format = "TEXT" #@param ["TEXT", "HTML", "XML", "JSON"]
Short_Output = False #@param {type:"boolean"}
# ================================================================ #

import os
from google.colab import files
from IPython.display import HTML, clear_output

try:
  Output_Format_Ext
except NameError:
  !apt install lshw -qq -y
  clear_output()

if Short_Output == True:
  os.environ["outputformatC"] = "txt"
  os.environ["outputformat2C"] = "-short"
  Output_Format_Ext = "txt"
elif Output_Format == "TEXT":
  os.environ["outputformatC"] = "txt"
  os.environ["outputformat2C"] = ""
  Output_Format_Ext = "txt"
else:
  os.environ["outputformatC"] = Output_Format.lower()
  os.environ["outputformat2C"] = "-"+Output_Format.lower()
  Output_Format_Ext = Output_Format.lower()
  
!lshw $outputformat2C > Specification.$outputformatC
files.download("/content/Specification." + Output_Format_Ext)
!rm -f /content/Specification.$outputformatC
display(HTML("<center><h2 style=\"font-family:Trebuchet MS;color:#446785;\">Sending log to your browser...</h2><br></center>"))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19368203003625065, 'fraction_numerical': 0.01432763680303815, 'mean_word_length': 4.480842005676442, 'pattern_counts': {'":': 34, '<': 161, '<?xml version=': 0, '>': 164, 'https://': 15, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '29628', 'license': 'MIT', 'n_tokens_mistral': 8304, 'n_tokens_neox': 8031, 'n_words': 1585, 'path': 'RcloneLab.ipynb', 'repo_name': 'cyberboysumanjay/RcloneLab', 'size': '23171'}