Skip to content

Instantly share code, notes, and snippets.

#!/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
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
@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
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 / 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
(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)})
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}
(where (service #"^disk")
(with {:service "scaled disk"}
(scale (* 100)) index))
# Check for bios messages in dmesg
# BUG: Checking dmesg is the best we can do in userspace at this time.
# Ideally, the kernel would improve it's reporting by setting a
# flag such as svm_disabled|vmx_disabled in /proc/cpuinfo's flags.
if dmesg | grep -qs "kvm: disabled by bios"; then
echo "INFO: KVM is disabled by your BIOS"
echo "HINT: Enter your BIOS setup and enable Virtualization Technology (
VT),"
echo " and then hard poweroff/poweron your system"
verdict 1