Tuesday, September 13, 2022

AI/ML Google Collab - Prompting for file upload

from google.colab import files

uploaded = files.upload()


This shows up prompt like this 

Once uploaded, the file by default resides under the root of the Collab file system 



AI/ML Google Collab - Mounting Google Drive onto Google Collab

 To mount the Google drive on to Collab, 

from google.colab import drive

drive.mount('/content/drive')


Now after this the file can be accessed like this below 
In this case below, The MyDrive is the folder 

from os.path import exists
project_folder='/content/drive/MyDrive/TestFiles/Project_data.zip'

import zipfile
file_exists = exists(project_folder)
print("File Exists ", file_exists)
with zipfile.ZipFile(project_folder, 'r') as zip_ref:
    zip_ref.extractall('Project_data')

In this case, 
MyDrive was the root folder name that was displayed on the Google Collab file browser after mounting. 
TestFiles folder contains the zip file which is tried to unzip. Unzipped files contain by default at the root folder in the default file system in Collab ( not drive) 


What is a TFTP Server

 TFTP (Trivial File Transfer Protocol) is a simplified version of FTP (File Transfer Protocol). It was designed to be easy and simple. TFTP leaves out many authentication features of FTP and it runs on UDP port 69. As it is very lightweight, it is still used for different purposes.

TFTP is used in places where you don’t need much security. Instead, you need a way to easily upload files to and download files from the server. CISCO devices use TFTP protocol to store configuration files and CISCO IOS images for backup purposes. The network boot protocols such as BOOTP, PXE etc uses TFTP to boot operating systems over the network. Thin clients also use TFTP protocol for booting operating systems. Many electronics circuit boards, microprocessors also use TFTP to download firmware into the chip. Overall, TFTP has many uses even today.

references:

https://linuxhint.com/install_tftp_server_ubuntu/ 

git list branches with creator names

 this seems to be a useful command 

git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' --sort=committerdate

references:

https://stackoverflow.com/questions/12055198/find-out-a-git-branch-creator/19135644#19135644 

IP Address - convert to decimal from dotted notation

 This is a pretty useful site to convert from dotted notation to decimal notation 

for e.g. decimal notation for 10.10.10.10 is 

168430090 


references:

https://www.ipaddressguide.com/ip


Mongo - Online editors

 For Mongo, to experiment various Mongo related queries etc. Below page can be used

https://mongoplayground.net/

The docs are available at the above same link. We can even share the documents and queries that are kept in the page and share to people.

references:

https://mongoplayground.net/