Skip to content

Instantly share code, notes, and snippets.

View mo6020's full-sized avatar
🐐
Shaving all of the yaks.

Ed Morgan mo6020

🐐
Shaving all of the yaks.
View GitHub Profile
@mo6020
mo6020 / generate_files.py
Last active February 25, 2020 04:02
file_gopher wrapper
import os
import random
import math
from math import exp, expm1
num_files_total = 1000000
width = 7
num_files_per_p = int(num_files_total/width)
count = 0
@mo6020
mo6020 / ucs_serialcollector.ps1
Created April 2, 2014 15:27
Pull UCS serial numbers
##################################################
# Joe Martin
# Cisco Systems, Inc.
# UCS Serial Number Collector v0.8
# 3/10/13
#
# Code provided as-is. No warranty implied or included.
# This code is for example use only and not for production
#
# This script will create an excel file of all UCSM based
#
# This scripts measures the amount of disk change on VMs each time it is run.
# It measures all VM virtual disks for which CBT has been enabled.
#
# The first time it is run, it creatse a file containing baseline data (CBT change IDs and times).
# Each subsequent run measures changes since the baseline was set.
# It supports multiple virtual disks per VM, but not addition of new virtual disks after the baseline is established.
# Note that every run creates a short-lived snapshot on every VM that has CBT enabed.
#
# Time to run will vary in each environment. In my case, it took about 20 seconds per VM for the 1st run,
# README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# Terminal.app - it has significantly better color fidelity.
@mo6020
mo6020 / Convert-ASUP.sh
Last active February 9, 2016 11:14
Convert Netapp body.7z to old style ASUP for ConfigAdvisor offline - Credit to @JK-47 for this, not my work..
# Make all text type file names upper case
perl -e 'for(@ARGV){rename$_,uc}' *.txt
perl -e 'for(@ARGV){rename$_,uc}' *.xml
# Replace underscores with DASHES
perl -e 'do { (my $f = $_) =~ tr/_/-/; rename $_, $f } for glob "@ARGV"' *.XML
perl -e 'do { (my $f = $_) =~ tr/_/-/; rename $_, $f } for glob "@ARGV"' *.TXT
# Save @JK-47's asupsections.txt to the directory. (This is just
# headers and helps me call to the other files)
@mo6020
mo6020 / speedtest_cli.py
Created January 4, 2016 13:53
Runs Speedtest.net tests from the CLI - not my Gist, just here for posterity...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2014 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@mo6020
mo6020 / vcentre_setup_db.sql
Last active January 3, 2016 11:09
Setup vCentre DB & Schema...
/*
Change DB name, location, and vpxuser password to whatever you wish.
Ed Morgan [ed.morgan@ansgroup.co.uk] - 16/01/2013
*/
use [master]
go
CREATE DATABASE [vCentre_Server] ON PRIMARY
(NAME = N'vCentre_Server', FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\vCentre_Server.mdf' , SIZE = 3000KB , FILEGROWTH = 10% )
LOG ON
@mo6020
mo6020 / gist:7889813
Last active December 30, 2015 21:49
Quick bash script to find and move any files older than 2 years into an archive folder...
# Ed Morgan [ed.morgan@ansgroup.co.uk]
# v 0.1 - DIRTY HACKS
FROMDIR="/Volumes/HITACHI"
TODIR="/Volumes/HITACHI/archive"
tmp="~/movelist.$$"
cd "$FROMDIR"
find . -depth -mtime +730 -printf "%Y %p\n" >$tmp
sed 's/^. //' < $tmp | cpio --quiet -pdm "$TODIR"
@mo6020
mo6020 / vmware_cfg_check.ps1
Last active December 23, 2015 14:29
Check VMware settings across hosts in a cluster
######################################################################################################################################
#VMware config checking script, originally written by http://www.peetersonline.nl/2009/01/check-vmware-configuration-with-powershell/
#Updates by CH September 2012.
#Updates by Ed Morgan [ed.morgan@ansgroup.co.uk] - September 2013
#
#Use this script to check VMware deployments that all datastores and all networking is the same across all hosts in a cluster.
#Uses VMware PowerCLI to use which is available on VMware website.
######################################################################################################################################
#Change this variable to the output location.
$outputFile = 'C:\output.html'
@mo6020
mo6020 / halt_on_power_fail.ps1
Created September 21, 2013 10:56
Shuts down controllers when UPS failure detected..
<#
.DESCRIPTION
To be run from UPS monitoring server via Windows NT triggers
.EXAMPLE
.\halt_on_power_fail.ps1
.DATE
08-08-2013
.VERSION
0.1
.AUTHOR