Wednesday, June 21, 2017

setting up your road to data science via python, numpy, scipy

so if you want to do start your journey to data science or just explore what all the fuss about and then get terrorized by math (math always hated me, even though i loved it, it was just one way love, sigh....no one loves me back if i love them..lol) and back off.
So scipy, numpy, panda and many other packages depend heavily on C, cython, fortran and that is why they are so fast too. so before you just install these packages via pip you might want to set the stage right.
install python 3.6.1 (in my case)
https://www.python.org/downloads/
install pip
https://packaging.python.org/tutorials/installing-packages/#id14
install wheel
pip install wheel (optional but you better do it)
then install specific wheels for numpy and scipy
download the relevant wheels from http://www.lfd.uci.edu/~gohlke/pythonlibs/
install as below
pip install numpy-1.13.0+mkl-cp36-cp36m-win32
pip install scipy-0.19.1-cp36-cp36m-win32
 
Now go to your favorite python IDE or console and run
import scipy, numpy and they both should not throw error.
Remember that if you just import numpy or scipy it might work but if you import both it might not. If you have followed this it should not be a problem to you.

Wednesday, May 31, 2017

Powershell : Auto Intialize, Add, Format disks at log in

There are many scenarios where you have mass deployed VMs or present disks to users in a cloud environment where it is necessary for users to initialize, add, format the drives but it won't be wise to ask all users to do this. nobody wants to. Hence this.


Get-Disk | Where partitionstyle -eq ‘raw’ | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "$env:UserName" -Confirm:$false

  1. Create your .ps1 script and place it in a folder.  The path would look something like this:
C:\script.ps1
  1. Create a .cmd file and place it in
C:\Users\<user_name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\startup.cmd
 In this startup.cmd file
PowerShell -Command "Set-ExecutionPolicy Unrestricted" >> "%TEMP%\StartupLog.txt" 2>&1 
PowerShell C:\script.ps1 >> "%TEMP%\StartupLog.txt" 2>&1

Thursday, April 13, 2017

Dealing with snapshots on Enterprise Hybrid Cloud; selectively remove/create snapshots

So I had a situation with one of my colleague dayakar today where he was implementing an EMC EHC and we had some trouble with our standard EHC script. we had to take snapshots. We had to first remove all the snapshots on these VMs.

get-vm | Get-Snapshot | Remove-Snapshot -RunAsync -Confirm:$false

 Now we needed to create snapshots only on those VMs with certain domain name.


$cluster = "" #cluster name(put * to include all clusters)
$domainname = "" #name domain of the vms
$snapshotName = "" #name of the snapshot
get-cluster $cluster | get-vm | where name -Match $domainname | New-Snapshot -RunAsync -Name $snapshotName -Confirm:$false
 

Now we needed to get the snapshots under vapps.


$cluster = "" #cluster name(put * to include all clusters)
$vapp = "" #name of the vapp
$snapshotName = "" #name of the snapshot
get-cluster $cluster | get-vapp -Name $vapp | get-vm | New-Snapshot -RunAsync -Name $snapshotName -Confirm:$false
 In case if you are wondering what is EHC, EHC is Enterprise Hybrid Cloud which is a cloud offering build with the following
compute : Cisco
Network : Cisco
Storage : EMC
Hypervisor: VMware vSphere
Cloud/Automation/Managment layer: vRealize Automation.
If you are in the market for a top of the notch cloud platform then have a look at it. We build it and it is awesome.