Skip to content

Instantly share code, notes, and snippets.

View ymek's full-sized avatar

Myke Ahn-Stubbs ymek

  • cyberspace
View GitHub Profile
#!/usr/bin/env ruby
Control_File = '$HOME/.appdata/GroovesharkDesktop.7F9BF17D6D9CB2159C78A6A6AB076EA0B1E0497C.1/Local\ Store/shortcutAction.txt'
if File.directory? "$HOME/documents"
Current_Song = '$HOME/documents/Grooveshark/currentSong.txt'
else if File.directory? "$HOME/Documents"
Current_Song = '$HOME/Documents/Grooveshark/currentSong.txt'
else
# couldn't find the current status. exit gracefully so we don't crash the WM or anything
@ymek
ymek / gist:645073
Created October 25, 2010 14:49
Chef Example Run
[root@test tmp]# sar -u 2 5
-bash: sar: command not found
You have new mail in /var/spool/mail/root
[root@test tmp]# chef-client
[Mon, 25 Oct 2010 10:42:32 -0400] INFO: Starting Chef Run (Version 0.9.8)
[Mon, 25 Oct 2010 10:42:33 -0400] INFO: Storing updated cookbooks/zabbix-test/recipes/default.rb in the cache.
[Mon, 25 Oct 2010 10:42:43 -0400] INFO: Upgrading package[sysstat] version from uninstalled to 7.0.2-3.el5_5.1
[Mon, 25 Oct 2010 10:43:02 -0400] INFO: Chef Run complete in 30.048458 seconds
[Mon, 25 Oct 2010 10:43:02 -0400] INFO: Running report handlers
[Mon, 25 Oct 2010 10:43:02 -0400] INFO: Report handlers complete
#
# Cookbook Name:: chef
# Recipe:: default
#
# Copyright 2010, Escape Media Group, Inc.
#
# All rights reserved - Do Not Redistribute
#
@ymek
ymek / gist:712206
Created November 23, 2010 18:05
A horse is a horse of course...
                      ,%,_          
                     %%%/,\        
                  _.-"%%|//%    
               _.' _.-"  /%%%
           _.-'_.-" O)    \%%%
          /.\.'            \%%%          
          \ /        _,     |%%%  
           `"-----"~`\   _,*'\%%'   _,--""""-,%%,
                      )*^     `""~~`          \%%%,        
                    _/                         \%%%          
root@RHL040:~# ./zbx_trapper.sh
Testing key update with:
/usr/local/sbin/zabbix_sender -vv -z 172.16.0.27 -p 10051 -s "RHL040" -k php.errors.total.memory_test -o 1
zabbix_sender [19462]: DEBUG: Answer [{
"response":"success",
"info":"Processed 0 Failed 1 Total 1 Seconds spent 0.000020"}]
Info from server: "Processed 0 Failed 1 Total 1 Seconds spent 0.000020"
sent: 1; skipped: 0; total: 1
#!/usr/bin/env ruby
SENDER="/usr/local/sbin/zabbix_sender"
#SERVER_IP="172.16.0.27"
#SERVER_PORT=10051
SERVER_CONFIG="/etc/zabbix/zabbix_agentd.conf"
#HOST=%x{hostname -f | cut -d. -f1}
##
# Example, arbitrary key updates for zabbix
#!/usr/bin/env ruby
t = Time.now
logline = (%x{/usr/bin/tail -n12 /var/log/php/api_error_log}).scan(/^\[.*/).last
lhour = logline.match(/(\d{2}):/)[1].to_i
thour = t.strftime("%H").to_i
day = t.strftime("%d").to_i
if (lhour < (t.gmt_offset + 2) and thour > lhour)
root@RHL037:~# yum info mongo-stable
Installed Packages
Name : mongo-stable
Arch : x86_64
Version : 20110131
Release : mongodb_1
Size : 50 M
Repo : installed
root@RHL040:~/logmailer.tmp# ./lmd.rb
update :: /var/log/php :: api_error_log :: file
update :: /var/log/php :: lite_error_log :: file
update :: /var/log/php :: api_error_log :: file
update :: /var/log/php :: api_error_log :: file
update :: /var/log/php :: lite_error_log :: file
update :: /var/log/php :: lite_error_log :: file
update :: /var/log/php :: lite_error_log :: file
update :: /var/log/php :: lite_error_log :: file
update :: /var/log/php :: api_error_log :: file
#!/usr/bin/env ruby
iters = (iters = 1 + rand(25)) + rand(iters)
(1..iters).each do
%x{echo '[09-Feb-2011 14:52:33] !!!ATTACKER BANNED!!!!' >> lite_error_log}
%x{echo '[09-Feb-2011 14:52:33] !!!ATTACKER BANNED!!!!' >> lite_error_log}
%x{echo '[09-Feb-2011 14:52:33] !!!ATTACKER BANNED!!!!' >> lite_error_log}
%x{echo '[09-Feb-2011 14:52:33] !!!ATTACKER BANNED!!!!' >> lite_error_log}
%x{echo '[09-Feb-2011 14:52:33] !!!ATTACKER BANNED!!!!' >> api_error_log}
sleep rand(3)
end