Skip to content

Instantly share code, notes, and snippets.

View hartsock's full-sized avatar

Shawn Hartsock hartsock

View GitHub Profile
@hartsock
hartsock / gist:9199a1382423fa46305d92d74b0d5838
Created August 14, 2019 16:42 — forked from devinodaniel/gist:8f9b8a4f31573f428f29ec0e884e6673
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
@devinodaniel
devinodaniel / gist:8f9b8a4f31573f428f29ec0e884e6673
Created November 21, 2017 20:18
Generate SSH RSA Private/Public Key pair with Golang
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"golang.org/x/crypto/ssh"
@michaelrice
michaelrice / pyvmomi.spec
Created August 21, 2014 21:22
pyvmomi rpm spec
%if 0%{?fedora}
%global _with_python3 1
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
// Create the updated device spec
VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec()
nicSpec.device = nic
nicSpec.operation = VirtualDeviceConfigSpecOperation.edit
// Create the VM update spec
VirtualMachineConfigSpec spec = new VirtualMachineConfigSpec()
spec.deviceChange = [nicSpec]
// Do the update
@michaelrice
michaelrice / response.yaml
Created August 4, 2014 18:26
betamax recording from vijava
!tape
name: getVm_tape
interactions:
- recorded: 2014-08-03T02:14:17.955Z
request:
method: POST
uri: https://vs00-winutil.home.lab/sdk
headers:
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
@complexsplit
complexsplit / alarms-unset-status.py
Created June 16, 2014 19:17
Get vCenter alarms with Trigger events that have an "Unset" status
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim, vmodl
# this script is intended to be run against all vcenters daily in order to
# guard against a possible vcenter crash due to alarms with an unset status.
# it prints all alarms with Trigger events w/ an "Unset" status.
# this bug is detailed at http://kb.vmware.com/kb/2062989
user = "username"
pwd = "password"
#!/usr/bin/env python
import os
import sys
import platform
import requests
import requests.utils
import certifi
@hartsock
hartsock / vmware_cache_wsdl.py
Last active March 16, 2022 23:04
A tool to help you create a local cache of vSphere WSDLs. This tool is only necessary if you are running vSphere 4.1 or 5.0 and need to fix the malformed XML in the WSDL for your local python parser. This script will fill in the missing XML files and create a cache that the OpenStack nova-compute driver for vSphere can use. The last line of the …
#!/usr/bin/python
import collections
import optparse
import os
import sys
import urllib
ROOT_WSDL_FILE = 'vimService.wsdl'
WSDL_FILES = frozenset([
@hartsock
hartsock / tools.sh
Created December 1, 2011 12:30
automatically add the tool to your path
#!/bin/bash
# which programs do you want to install into your path?
programs=( groovy grails gradle scala )
# relies on the conventions:
# 1. all tools go into ~/tools
# 2. all tools are configured with a 'current' symlink for
# the currently in-use version
# 3. all tools have a 'bin' directory
@benpickles
benpickles / ding.sh
Created November 25, 2010 14:33
Make a "ding" sound on your Mac!
# .___.__
# __| _/|__| ____ ____
# / __ | | |/ \ / ___\
# / /_/ | | | | \/ /_/ >
# \____ | |__|___| /\___ /
# \/ \//_____/
#
# Make a "ding" sound on your Mac! Useful for notifying you when a command
# line script has finished.
#