Skip to content

Instantly share code, notes, and snippets.

INFO [2014-01-13 09:53:15,666] pool-1-thread-72 - riemann.config - received event #riemann.codec.Event{:host monitor, :service disk /boot, :state warning, :description 93% used, :metric 0.93, :tags [health], :time 1389628395, :ttl 10.0}
(defn new-message
[options]
(let [conn (rmq/connect {:host (.getHostAddress (get options :hostname)) :username (get options :username) :password (get options :password) :ssl (get options :ssl)})
@ksexton
ksexton / gist:7946184
Last active December 31, 2015 06:18
Setup Vagrant vmware-fusion box on CentOS 6.5
#!/bin/sh
setenforce 0
echo "Bringing up network"
ifup eth0
chkconfig sshd on
chkconfig iptables off
irb(main):002:0> require 'active_support/core_ext'
=> true
irb(main):003:0> p Date.today.end_of_month
Sat, 30 Nov 2013
=> Sat, 30 Nov 2013
irb(main):004:0>
@ksexton
ksexton / trackmac.rb
Created September 15, 2013 14:36 — forked from gerad/trackmac.rb
require 'rubygems'
require 'bundler/setup'
require 'appscript'
# http://stackoverflow.com/questions/480866/get-the-title-of-the-current-active-window-document-in-mac-os-x
while true
frontmost = Appscript.app('System Events').application_processes.get.select{ |a| a.frontmost.get }.first
if frontmost
puts frontmost.name.get
if frontmost.windows.count > 0
2013-09-13 10:01:50,356 pulp.plugins.yum_distributor.distributor:INFO: Publish complete: summary = <{'num_package_units_errors' : 0, 'num_package_categories_published': 14, 'http_publish_dir': u'/var/lib/pulp/published/http/repos/centos/6.4/os/x86_64', 'sk ip_metadata_update': False, 'num_distribution_units_published': 0, 'num_package_groups_published': 210, 'num_package_units_attem pted': 6381, 'num_package_units_published': 6381, 'num_distribution_units_attempted': 1, 'num_distribution_units_errors': 1, 're lative_path': u'centos/6.4/os/x86_64/'}>, details = <{'errors': [(u'/var/lib/pulp/content/distribution/ks-CentOS--6.4-x86_64/../ ../isos/x86_64/CentOS-6.4-x86_64-netinstall.iso', u'/var/lib/pulp/working/repos/centos64/distributors/yum_distributor/../../isos /x86_64/CentOS-6.4-x86_64-netinstall.iso', u'Source path: /var/lib/pulp/content/distribution/ks-CentOS--6.4-x86_64/../../isos/x8 6_64/CentOS-6.4-x86_64-netinstall.iso is missing')], 'time_metadata_sec': 53.70726203918457}>etadata merge on 500 units
#!/usr/bin/env ruby
my_word = "foo"
word = "foo"
if my_word =~ /#{word}/
puts "#{my_word} has #{word} in it"
else
puts "#{my_word} doesn't have #{word} in it"
end
$my_word = "foo"
$word = "foo"
## Pick the if statement
# if $my_word =~ /word/ {
# if $my_word =~ /${word}/ {
# if $my_word =~ /"${word}"/ {
# if $my_word =~ /#{word}/ {
notify { "${my_word} has ${word} in it":}
}
c2950#sh interfaces FastEthernet 0/1 status
Port Name Status Vlan Duplex Speed Type
Fa0/1 --> to end-user wo connect 1000 auto auto 10/100BaseTX
c2950#sh etherchannel 1 summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2