Skip to content

Instantly share code, notes, and snippets.

@neilbartley
neilbartley / cve_2016_6316_workaround.rb
Last active November 17, 2017 20:42
Temporary (upgrade to Rails 4.2.7.1 / 5.0.0.1) workaround for CVE-2016-6316 (see: https://groups.google.com/forum/#!topic/rubyonrails-security/I-VWr034ouk). Only tested with Rails 4.1. Place in config/initializers.
if Rails::VERSION::MINOR < 2 && Rails::VERSION::MAJOR >= 4
module ActionView
module Helpers
module TagHelper
private
def tag_option(key, value, escape)
value = value.join(" ") if value.is_a?(Array)
value = ERB::Util.h(value) if escape
%(#{key}="#{value.gsub(/"/, '&quot;'.freeze)}")
@neilbartley
neilbartley / bespoke_slackbot_service.rb
Last active August 26, 2019 07:32
Implementation of a simple Slack integration for sending bespoke notifications
class BespokeSlackbotService
NAME_AND_ICON = {
username: 'Bespoke Bot',
icon_emoji: ':bat:'
}
GOOD = 'good'
WARNING = 'warning'
DANGER = 'danger'
@neilbartley
neilbartley / slack-rails-application.yml
Last active November 11, 2018 12:04
Excerpt of Slack configuration in application.yml
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/BLAH/BLAH/BLAH"
SLACK_WEBHOOK_CHANNEL: "#events_test"
#!/bin/bash
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
#

Keybase proof

I hereby claim:

  • I am neilbartley on github.
  • I am neilbartley (https://keybase.io/neilbartley) on keybase.
  • I have a public key whose fingerprint is 2041 40FF BD8F 36BB 8349 1C6A B056 C472 21FA 83CE

To claim this, I am signing this object: