This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = async message => { | |
/* Custom resources have timeouts on the order of hours. If a resource fails | |
* to deploy, we can look at the logs to at least be able to manually fail the | |
* resource action so we can try again quickly. */ | |
const failureResponse = { | |
Status: 'FAILED', | |
Reason: 'Manually cancelled', | |
PhysicalResourceId: message.PhysicalResourceId || 'resource', | |
StackId: message.StackId, | |
RequestId: message.RequestId, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# recompile all rbenv versions of ruby to avoid CVE-2013-6393 pwnage | |
# https://groups.google.com/forum/#!topic/rubysec-announce/3sx25iR7yHQ | |
# | |
# curl https://gist.github.com/samg/9098647/raw | bash | |
set -x | |
cd ~/.rbenv/plugins/ruby-build/ | |
git pull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Earth | |
extend self | |
def meters_between_two_points(p1, p2) | |
( 6378.0 * Math.acos([ | |
Math.cos(p1.lat_in_radians) * Math.cos(p2.lat_in_radians) * | |
Math.cos(p2.lng_in_radians - p1.lng_in_radians) + | |
Math.sin(p1.lat_in_radians) * Math.sin(p2.lat_in_radians), | |
1 | |
].min)) * 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jerry D'Antonio | |
github.com/jdantonio (all code, slides, and notes in a repo on github) | |
@jerrydantonio | |
From Ohio | |
Works at a Ruby and Erlang shop. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
raise 'example' | |
rescue Exception => exception | |
if defined? ::NewRelic | |
::NewRelic::Agent.notice_error(exception) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with useful tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2263406/osx.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Try ^C, or any kill signal, but I'll survive." | |
puts "You're going to have to kill -9 me. (Unlike other signals the kernal handles kill -9)" | |
loop do | |
begin | |
sleep 1e6 | |
rescue Exception => e | |
puts "Caught #{[e.class.name, e].join}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SteelController < ActionController::Metal | |
include ActionController::Rendering | |
def show | |
render :text => { :data => 1 }.to_json | |
end | |
include NewRelic::Agent::Instrumentation::ControllerInstrumentation | |
add_transaction_tracer :show | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
begin | |
path_to_lock_file = '/tmp/lock.lock' | |
File.new(path_to_lock_file, File::CREAT|File::EXCL) # raise if file already exits | |
begin | |
system *ARGV | |
ensure | |
FileUtils.rm path_to_lock_file | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.class.trace_execution_scoped(['External/servicename/all', 'External/allWeb']) do | |
#your service call code here | |
end | |
# "External/allWeb" will cause the calls to be included in the | |
# green "Web External" stripe of your response time graph. | |
# "External/servicename/all" will enable you to see specific | |
# metrics in the "External services" tab, such as calls per minute and average call time. |
NewerOlder