Friday, November 29, 2024

Doing a git clone within a LAN without Internet

On the laptop where the repo to be clone is hosted, we run the command git daemon from the terminal.

Sample command on the HOST:

 $ git daemon --base-path=<path_to_folder_containing_project_folder> --export-all --verbose  

<path_to_folder_containing_project> is the folder containing your projects folders, it will provide all projects under that folder. You're basically looking for the project folder containing the .git folder.

The client:

 $ git clone git://<local ip>/<project name>  

It's that easy but do note that the cloned repo's origin will be pointing to the HOST IP, so you need to use git remote set-url origin to point it to a different IP or origin. 

We might want to run git daemon with the --verbose option to get more details in case we run into problems.

If we are getting connection problems, you might have to check Firewall settings to allow the connection.


Reference

* https://stackoverflow.com/questions/5200181/how-to-git-clone-a-repo-in-windows-from-other-pc-within-the-lan


Saturday, September 7, 2024

Figuring out if that USB drive is legit

So you just bought USB drives off Temu or some other e-commerce site because it was cheap. You like what you see, 32GB for 99 bucks + shipping, I guess I'll buy five.

But are you really getting a deal?

Mayhaps. But unlike the common folk I don't take such things on face value and  see if we are really getting the real deal. Thankfully, Linux - in this case, PopOS - has the command line tools to check.

So get 1 USB drive to test and we install, F3

$ sudo apt install f3

F3 comes with a command line utility named f3probe, which is used to test USB flash drives for capacity.

But before we run f3probe, we need to figure what block device name the USB drive was given.

$ lsblk

 

As you can see, mine is sdb/sdb1

so

$ sudo f3probe --destructive --time-ops /dev/sdb

Wait for it. BTW, back up if you files in the USB before you do this.

And then be disappointed because your 99 bucks 32GB USB drive is "counterfeit". It's only an 8GB.

Oh well. I hope you didn't buy five. 

 

Ref

  • https://www.linuxbabe.com/command-line/f3-usb-capacity-fake-usb-test-linux