Skip to content

Instantly share code, notes, and snippets.

View hartsock's full-sized avatar

Shawn Hartsock hartsock

View GitHub Profile
#!/usr/bin/env python
import os
import sys
import platform
import requests
import requests.utils
import certifi
#!/usr/bin/env ruby
#
# Convert blogger (blogspot) posts to jekyll posts
#
# Basic Usage
# -----------
#
# ./blogger_to_jekyll.rb feed_url
#
# where `feed_url` can have the following format:
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"
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
#!/usr/bin/env python
import bz2
import datetime
import os
import sys
import time
import urllib2
import warnings
// 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
%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
@hartsock
hartsock / rdhcpd.rb
Last active August 29, 2015 14:08 — forked from telamon/rdhcpd.rb
' Copyright (c) 2007, Tony Ivanov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
package com.neolitec.examples;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@hartsock
hartsock / ding.sh
Last active August 29, 2015 14:24 — forked from benpickles/ding.sh
# .___.__
# __| _/|__| ____ ____
# / __ | | |/ \ / ___\
# / /_/ | | | | \/ /_/ >
# \____ | |__|___| /\___ /
# \/ \//_____/
#
# Make a "ding" sound on your Mac! Useful for notifying you when a command
# line script has finished.
#