Skip to content

Instantly share code, notes, and snippets.

View mazocode's full-sized avatar

Marcus Zoller mazocode

View GitHub Profile
@mazocode
mazocode / pip_upgrade_reinstall.sh
Created January 29, 2018 07:48
Full reinstallation with upgrade of python packages
#!/bin/bash
sudo pip install --upgrade -force-reinstall `pip freeze --local | tr '\n' ' ' | sed 's/==[0-9,.]* / /g'`
@mazocode
mazocode / Hyper-V-Perf-Counters.cs
Created February 10, 2018 20:16
Get performance counters for hyper-v VMs
public static ManagementObject GetObject(ManagementScope scope, string serviceName)
{
return GetObjects(scope, serviceName).FirstOrDefault();
}
public static IEnumerable<ManagementObject> GetObjects(ManagementScope scope, string serviceName)
{
return new ManagementClass(scope, new ManagementPath(serviceName), null)
.GetInstances()
.OfType<ManagementObject>();