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
15:01 ~/src/datacentred/stronghold 2.1.2 (testing) | |
$ cap staging deploy | |
DEBUG[676eda95] Running /usr/bin/env [ ! -d ~/.rbenv/versions/2.1.2 ] on rails01.sal01.datacentred.co.uk | |
DEBUG[676eda95] Command: [ ! -d ~/.rbenv/versions/2.1.2 ] | |
DEBUG[676eda95] Finished in 0.317 seconds with exit status 1 (failed). | |
INFO[1ad89142] Running /usr/bin/env mkdir -p /tmp/stronghold/ on rails01.sal01.datacentred.co.uk | |
DEBUG[1ad89142] Command: ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.2 /usr/bin/env mkdir -p /tmp/stronghold/ ) | |
INFO[1ad89142] Finished in 0.015 seconds with exit status 0 (successful). | |
DEBUGUploading /tmp/stronghold/git-ssh.sh 0.0% | |
INFOUploading /tmp/stronghold/git-ssh.sh 100.0% |
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 'redcarpet' | |
module TicketsHelper | |
def markdown(text) | |
render_options = { | |
# will remove from the output HTML tags inputted by user | |
filter_html: true, | |
# will insert <br /> tags in paragraphs where are newlines | |
# (ignored by default) | |
hard_wrap: true, |
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 = (robot) -> | |
robot.hear /bork/i, (msg) -> | |
msg.send "bork bork bork!" |
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
robot.respond /icinga status/i, (msg) -> | |
nagios_api_state(msg) |
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
nagios_api_state = (msg) -> | |
reply = [] | |
headers = { | |
'Content-Type': 'application/json', | |
'Content-Length': 0 | |
} | |
options = { |
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
robot.respond /icinga downtime (\S+)$/i, (msg) -> | |
name = msg.message.user.name.toLowerCase() | |
host = msg.match[1].trim().toLowerCase() | |
nagios_api_call 'on', {host: host, duration: 7200, author: name}, msg |
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
cronJob = require('cron').CronJob | |
tz = 'Europe/London' | |
new cronJob('0 30 9 * * 1-5', (() -> workdaysNineThirtyAm(robot)), null, true, tz) | |
workdaysNineThirtyAm = (robot) -> | |
nagios_api_state({ | |
reply: (text) -> | |
robot.messageRoom 'room@conf.hipchat.com', "Good morning! Time for an Icinga update." | |
robot.messageRoom 'room@conf.hipchat.com', text | |
}) |
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
things.each do |thing| | |
Thread.new do | |
SlowApi.send(thing) | |
end | |
end.each(&:join) |
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
DATES = [ | |
"May 15", "May 16", "May 19", | |
"June 17", "June 18", | |
"July 14", "July 16", | |
"August 14", "August 15", "August 17" | |
] | |
def month(date); date.split[0]; end | |
def day(date); date.split[1]; 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
$ ping google.com | |
PING google.com (216.58.210.14): 56 data bytes | |
64 bytes from 216.58.210.14: icmp_seq=0 ttl=56 time=32.953 ms | |
64 bytes from 216.58.210.14: icmp_seq=1 ttl=56 time=24.376 ms | |
Request timeout for icmp_seq 2 | |
64 bytes from 216.58.210.14: icmp_seq=3 ttl=56 time=134.158 ms | |
64 bytes from 216.58.210.14: icmp_seq=4 ttl=56 time=746.034 ms | |
64 bytes from 216.58.210.14: icmp_seq=5 ttl=56 time=186.765 ms | |
64 bytes from 216.58.210.14: icmp_seq=6 ttl=56 time=197.410 ms | |
64 bytes from 216.58.210.14: icmp_seq=7 ttl=56 time=291.883 ms |