Skip to content

Instantly share code, notes, and snippets.

When /^I connect to smtp on (.+)$/ do |server|
@smtp = Net::SMTP.start(server, 25)
end
When /^the sender is (\S+)$/ do |from|
@from = from
end
Then /^it should accept email to (\S+)$/ do |to|
message = "a test message from cucumber-nagios"
def check(conf, what)
if c = conf[what]
if block_given?
yield c
else
false
end
else
puts "missing: #{what}"
true
<script src="http://code.angularjs.org/angular-0.9.16.min.js" ng:autobind></script>
<script>
var SERVICE_URL = "http://blockexplorer.com/q/getdifficulty";
function CalculatorController($xhr) {
this.integer = /^\d+$/;
this.fraction = /^\d+\.*\d*$/;
this.fetch = function() {
var self = this;
$xhr('', SERVICE_URL, function(code, response) {
self.difficulty = response;
@pmenglund
pmenglund / gist:3906090
Created October 17, 2012 15:17
Sample spec file
require "spec_helper"
describe "foo" do
before(:all) do
requirement release
requirement stemcell
end
after(:all) do
cleanup release
@pmenglund
pmenglund / gist:4034820
Created November 7, 2012 22:08
show slow require:s
module Kernel
alias_method :require_orig, :require
def require(name)
$indent ||= 0
t1 = Time.now.to_f
$indent += 2
puts "#{" " * $indent}> #{name}"
require_orig name
t2 = Time.now.to_f
@pmenglund
pmenglund / gist:5000861
Created February 21, 2013 00:07
elb stuff in aws cpi
diff --git a/bosh_aws_cpi/lib/cloud/aws/cloud.rb b/bosh_aws_cpi/lib/cloud/aws/cloud.rb
index 6e2bfab..6a66b0a 100644
--- a/bosh_aws_cpi/lib/cloud/aws/cloud.rb
+++ b/bosh_aws_cpi/lib/cloud/aws/cloud.rb
@@ -56,7 +56,9 @@ module Bosh::AwsCloud
# AWS Ruby SDK is threadsafe but Ruby autoload isn't,
# so we need to trigger eager autoload while constructing CPI
AWS.eager_autoload!
- @ec2 = AWS::EC2.new(aws_params)
+
@pmenglund
pmenglund / keybase.md
Last active January 31, 2018 15:57
keybase.md

Keybase proof

I hereby claim:

  • I am pmenglund on github.
  • I am pmenglund (https://keybase.io/pmenglund) on keybase.
  • I have a public key ASCSGLlZ8XJDQsST1ixqtpqE1B6aFbP2RBF72Mvg-8COcQo

To claim this, I am signing this object:

@pmenglund
pmenglund / gist:d318abde96defb2f2b6b79b9842fa4d8
Created September 27, 2018 17:50
thing to leave behind in /etc/profile.d
_ls() {
if [[ $[$RANDOM % 4] == 0 ]]; then
sleep 1
echo "Segmentation fault"
return 139
else
# run ls with randon sorting option
command ls -$(opts="frStu"; echo ${opts:$((RANDOM % ${#opts})):1}) "$@";
fi
}
@pmenglund
pmenglund / rockset.tfout
Created November 14, 2022 21:58
terraform plan output
$ terraform plan
data.rockset_account.current: Reading...
data.rockset_account.current: Read complete after 0s [id=318212636800]
data.aws_iam_policy_document.rockset-trust-policy: Reading...
data.aws_iam_policy_document.rockset-trust-policy: Read complete after 0s [id=2982727827]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
@pmenglund
pmenglund / rockset.apply.tfout
Created November 14, 2022 23:49
rockset terraform apply output
$ terraform apply
data.rockset_account.current: Reading...
data.rockset_account.current: Read complete after 1s [id=318212636800]
data.aws_iam_policy_document.rockset-trust-policy: Reading...
data.aws_iam_policy_document.rockset-trust-policy: Read complete after 0s [id=2982727827]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions: