Friday, May 26, 2017

How to finding what methods Python object has

[method for method in dir(Python_Object) if callable(getattr(Python_Object, method))

Saturday, May 20, 2017

Create a bootable USB flash media drive from Mac OSX

First download your desired .img / iso file to be written on the drive.
Open a Terminal (under Utilities)
Run the following command to get the current list of devices
diskutil list
Insert your flash media
Run the diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
Run
diskutil unmountDisk /dev/diskN
then execute
sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m
finally run
diskutil eject /dev/diskN
and remove your flash media when the command completes


Monday, May 1, 2017

Validate your download

On many sites that offer some type of downloadable file you can often find a very long number sometimes labeled as SHA1Sum.... what is it and how do you use it?
SHA1Sum is basically a hash taken of the file... the hash is not an encryption or anything of that sorts, but what its purpose is to provide a way to generate hash representation of the file. For example, if you have a text file and you take a hash of it, and then change even one comma in that file, the hash that would be produced would be totally different!
This way you can always validate if two files are identical or not.

So how do you do it?
First, download the file (your_file)

Secondly, generate its hash on you system and save it to the hashstring file
sha1sum your_file > hashstring

Then copy the hash of the file from the website that lists it

Finally, use grep to compare the hash that you produced to that from the site (unless you want to compare it one character at the time)
cat hashstring | grep hash_copied_from_site