Skip to content

Instantly share code, notes, and snippets.

View stonith's full-sized avatar

Darren Foo stonith

  • Shopify
  • Vancouver
View GitHub Profile
@stonith
stonith / gist:10014646
Last active August 29, 2015 13:58
/_stats/fielddata/
{
"_shards" : {
"total" : 3162,
"successful" : 3162,
"failed" : 0
},
"_all" : {
"primaries" : {
"fielddata" : {
"memory_size_in_bytes" : 397361900,
# Description:
# This script receives pages in the formats
# /usr/bin/curl -d host="$HOSTALIAS$" -d output="$SERVICEOUTPUT$" -d description="$SERVICEDESC$" -d type=service -d notificationtype="$NOTIFICATIONTYPE$ -d state="$SERVICESTATE$" $CONTACTADDRESS1$
# /usr/bin/curl -d host="$HOSTNAME$" -d output="$HOSTOUTPUT$" -d type=host -d notificationtype="$NOTIFICATIONTYPE$" -d state="$HOSTSTATE$" $CONTACTADDRESS1$
#
# Based on a gist by oremj (https://gist.github.com/oremj/3702073)
#
# Configuration:
# HUBOT_NAGIOS_URL - https://<user>:<password>@nagios.example.com/cgi-bin/nagios3
#
sudo mount -o loop /dev/cdrom /mnt
tar zxf /mnt/VMwareTools-*.tar.gz -C /tmp/
sudo /tmp/vmware-tools-distrib/vmware-install.pl -d
sudo umount /mnt
@stonith
stonith / fog_clonevm.rb
Created June 10, 2014 20:45
Prototype API for vSphere VM Cloning from Template
#!/usr/bin/env ruby
require 'rubygems'
require 'pp'
require 'fog'
require 'highline/import'
require 'sinatra'
set :bind, '0.0.0.0'
This file has been truncated, but you can view the full file.
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/context.rb:262 IRB::Context#set_last_value
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/workspace.rb:85 IRB::WorkSpace#evaluate
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:372 IRB#CurrentContext
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:353 IRB#conf
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb.rb:661 IRB::Irb#output_value
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/context.rb:385 IRB::Context#inspect_last_value
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/inspector.rb:114 IRB::Inspector#inspect_value
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:206 RubyLex#prompt
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/context.rb:252 IRB::Context#prompting?
/home/vagrant/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/irb/context.rb:236 IRB::Context#verbose?
@stonith
stonith / gist:e4979a5fbd732324acd8
Created June 27, 2014 00:10
Change proxy discovery to false
$webConfig = "C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config"
$newConfig = new-item c:\temp\web.config -type file
$doc = new-object System.Xml.XmlDocument
$doc.Load($webConfig)
$doc.get_DocumentElement()."system.net".defaultProxy.proxy.usesystemdefault = "false"
$doc.Save($newConfig)
@stonith
stonith / windows_spec.rb
Last active August 29, 2015 14:03
Example Serverspec Tests
require 'spec_helper'
describe 'windows box' do
it 'should have a vagrant user' do
expect(user 'vagrant').to exist
end
end
describe windows_feature('Web-Webserver') do
it{ should be_installed.by("powershell") }
@stonith
stonith / sentry.rb
Created July 25, 2014 08:25
sentry logstash plugin
require 'logstash/outputs/base'
require 'logstash/namespace'
class LogStash::Outputs::Sentry < LogStash::Outputs::Base
config_name 'sentry'
milestone 1
config :key, :validate => :string, :required => true
config :secret, :validate => :string, :required => true
@stonith
stonith / unattendsysprep_2008r2.xml
Created August 17, 2014 07:28
2008R2 Sysprep unattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="generalize">
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipRearm>1</SkipRearm>
</component>
<component name="Microsoft-Windows-PnpSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<PersistAllDeviceInstalls>false</PersistAllDeviceInstalls>
<DoNotCleanUpNonPresentDevices>false</DoNotCleanUpNonPresentDevices>
</component>
@stonith
stonith / atomic.repo
Created August 31, 2014 01:42
atomic.repo for ossec
# Name: Atomic Rocket Turtle RPM Repository for CentOS / Red Hat Enterprise Linux 6 -
# URL: http://www.atomicrocketturtle.com/
# Note: This isn't covered by ASL support. -Scott
[atomic]
name = CentOS / Red Hat Enterprise Linux $releasever - atomicrocketturtle.com
mirrorlist = http://updates.atomicorp.com/channels/mirrorlist/atomic/centos-$releasever-$basearch
enabled = 1
priority = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt