Skip to content

Instantly share code, notes, and snippets.

View johntdyer's full-sized avatar

John Dyer johntdyer

View GitHub Profile
@johntdyer
johntdyer / gist:1596557
Created January 11, 2012 20:17 — forked from grantr/gist:1105416
Chef mysql master/slave recipes
## mysql::master
ruby_block "store_mysql_master_status" do
block do
node.set[:mysql][:master] = true
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password])
m.query("show master status") do |row|
row.each_hash do |h|
node.set[:mysql][:master_file] = h['File']
node.set[:mysql][:master_position] = h['Position']
end
%w(net/http uri).each{|lib| require lib}
# server to send my request to
uri = URI.parse("http://myserver.com/catch_msg")
#create http object
http = Net::HTTP.new(uri.host, uri.port)
#send request
request = Net::HTTP::Get.new(uri.request_uri)
@johntdyer
johntdyer / vpc.rb
Created February 21, 2012 18:24
VPC Ohai Plugin
provides "vpc_data"
require 'ohai/mixin/ec2_metadata'
require_plugin "hostname"
require_plugin "kernel"
require_plugin "network"
vpc_data Mash.new
@network = network || 'SMS'
message $msg, {
:to => $to,
:network => @network
}
@johntdyer
johntdyer / devops.md
Last active October 4, 2015 01:57
DevOps Job Posting

Looking for full-time Operations Ninja's ( Senior & Junior )

We're Tropo - a team of entrepreneurial types changing the face of telecommunications. We build software that lets developers control the phone system - making calls, recording calls, sending and receiving text messages, etc and beyond. Our customers include startups, hobbyists, Fortune 100 companies, as well as the Telcos themselves. We're big enough to have offices worldwide, but small enough you won't be a faceless cog in the corporate machine.

Why work with us?

  • We're solving interesting problems. Tired of clients with yet another social network for cats?
  • We have awesome benefits. Mind-blowing in fact. Medical, dental, the works, 100% paid for by us for you and your family. We even provide a loaded flex card for use to pay deductibles and copays!
#!/bin/sh
# /etc/init.d/unicorn
# To install: update-rc.d unicorn defaults
# @version 2011-07-29
# @author Adam Dunson
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
sessionid = currentCall.sessionId
log("The Session ID is " + sessionid)
say("http://uploads3.mp3songurls.com/1348489.mp3", [
allowSignals: "exit"
])
say("You are now off hold.")
if $action.eql?('create')
call $numberToDial
end
sessionid = $currentCall.sessionId
log "======> The Session ID is " + sessionid
say "https://dl.dropbox.com/u/177285/ATT/zombo.mp3", {
:allowSignals => "exit"
}
15.times do
@johntdyer
johntdyer / deployer.rake
Created September 27, 2012 04:16
Rake task to copy local files to remote server via FTP
# Rake task to copy local files to remote server via FTP
# required credentials.yml file, that contains keys:
# server, username, password
require "net/ftp"
require "yaml"
class FTPClient
attr_reader :remote_path
ask "", :choices => "[ANY]"
event = ask "When did Alexander Graham Bell patent the telephone? Was it A - January 30, 1877, B - March 10, 1876, or C - May 2, 1880?", {
:choices => "A(A, a), B(B, b), C(C, c)",
:attempts => 2,
:timeout => 60,
:onChoice => lambda { |event|
say "You chose " + event.value
if (event.value == "A")
say "That's right!"
else