Skip to content

Instantly share code, notes, and snippets.

@complexsplit
complexsplit / pythons-collections-duplicate.py
Created July 28, 2021 17:28
pythons-collections-duplicate
a = [1,2,3,2,1,5,6,5,5,5]
import collections
print([item for item, count in collections.Counter(a).items() if count > 1])
root@gigantic:~ # pkg info
alsa-lib-1.1.2 ALSA compatibility library
asciidoc-8.6.9_5 Text document format for writing short documents and man pages
autoconf-2.69_1 Automatically configure source code on many Un*x platforms
autoconf-wrapper-20131203 Wrapper script for GNU autoconf
automake-1.15_1 GNU Standards-compliant Makefile generator
automake-wrapper-20131203 Wrapper script for GNU automake
bash-4.3.46_1 The GNU Project's Bourne Again SHell
bigreqsproto-1.1.2 BigReqs extension headers
bison-2.7.1,1 Parser generator from FSF, (mostly) compatible with Yacc
#!/usr/bin/python
import netaddr
import json
import DNS # dns-python in ubuntu http://sourceforge.net/projects/pydns/
import urllib
awstotal = 0
gcptotal = 0
AWSURL = 'https://ip-ranges.amazonaws.com/ip-ranges.json'
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
@complexsplit
complexsplit / dl-vmworld-2014-content-v.01.rb
Last active August 29, 2015 14:07
Download VMworld 2014 Content
# replace names and emails with your own.
require 'watir-webdriver'
require 'phantomjs'
require 'open-uri'
require 'progressbar'
b = Watir::Browser.new :phantomjs
b.goto 'http://www.vmworld.com/community/sessions/2014'
# possibly repalce url w/ http://vmware.mediasite.com/mediasite/Catalog/Full/daea26ff56894512a04687ead2afc51821 to escape frames
@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"
@complexsplit
complexsplit / pyvmomi.py
Created April 28, 2014 12:40
Searching datastores w/ pyVmomi
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim, vmodl
import argparse
import atexit
import sys
import pprint
si = SmartConnect(host="192.168.1.7", user="root", pwd="vmware")
servcontent = si.RetrieveServiceContent()

Keybase proof

I hereby claim:

  • I am complexsplit on github.
  • I am complex (https://keybase.io/complex) on keybase.
  • I have a public key whose fingerprint is 1AE7 D3ED F5B4 144D A297 9DB8 DD19 988B 4304 B664

To claim this, I am signing this object:

@complexsplit
complexsplit / dl-vmworld-content-v.01.rb
Last active December 25, 2015 17:59
Downloading VMworld content
require 'rubygems'
require 'watir-webdriver'
require 'open-uri'
$sessionurls = Array.new
browser = Watir::Browser.new
browser.goto 'http://www.vmworld.com/community/sessions/2013/'
browser.link(:text =>"Sign In").when_present.click
browser.text_field(:name => 'username').set 'your_username'
@complexsplit
complexsplit / fog-create-vm.rb
Created September 3, 2013 01:58
Creating a VM with Fog & vSphere
require 'rubygems'
require 'fog'
credentials = {
:provider => "vsphere",
:vsphere_username => "root",
:vsphere_password => "vmware",
:vsphere_server => "vcenter.home",
:vsphere_ssl => true,
:vsphere_expected_pubkey_hash => "661x0bb1bd68fcaa1a6e0k512003fe4b90e7ba41b7f67b495f4a315bd5614dz7",