Skip to content

Instantly share code, notes, and snippets.

View base10's full-sized avatar

Nathan L. Walls base10

View GitHub Profile
#!/usr/bin/env ruby
#
# Find bloating passengers and kill them gracefully. Run from cron every minute.
#
# required for passenger since cron has no environment
ENV['HTTPD'] = 'httpd'
MEM_LIMIT = ARGV[0] || 500
diff --git a/lib/fleakr.rb b/lib/fleakr.rb
index 8e222c8..26ac96a 100644
--- a/lib/fleakr.rb
+++ b/lib/fleakr.rb
@@ -9,7 +9,7 @@ require 'forwardable'
# Require only what we need from ActiveSupport
require 'active_support/core_ext/array'
require 'active_support/core_ext/module'
-require 'active_support/core_ext/blank'
+require 'active_support/core_ext/object/blank'
#!/usr/bin/php
<?php
function bottle (&$i) {
$bottle;
switch ($i) {
case ($i == 1):
$bottle = 'bottle';
break;
default:
INFO: Setting the run_list to ["system"] from JSON
INFO: Starting Chef Run
ERROR: Running exception handlers
ERROR: Exception handlers complete
ERROR: Re-raising exception: NameError - wrong constant name Mysql.Database
/usr/lib/ruby/gems/1.8/gems/chef-0.9.4/bin/../lib/chef/provider.rb:89:in `const_defined?'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.4/bin/../lib/chef/provider.rb:89:in `build_from_file'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.4/bin/../lib/chef/run_context.rb:65:in `load'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.4/bin/../lib/chef/run_context.rb:103:in `call'
/usr/lib/ruby/gems/1.8/gems/chef-0.9.4/bin/../lib/chef/run_context.rb:103:in `foreach_cookbook_load_segment'
# Validates whether the value of the specified attribute matches the format of an URL,
# as defined by RFC 2396. See URI#parse for more information on URI decompositon and parsing.
#
# This method doesn't validate the existence of the domain, nor it validates the domain itself.
#
# Allowed values include http://foo.bar, http://www.foo.bar and even http://foo.
# Please note that http://foo is a valid URL, as well http://localhost.
# It's up to you to extend the validation with additional constraints.
#
# class Site < ActiveRecord::Base
@base10
base10 / url_save.rb
Created September 9, 2012 00:13
Simple script to list the urls of all open Safari tabs in a datestamped YAML file
#!/usr/bin/env ruby
require 'appscript'
require 'yaml'
include Appscript
safari = app 'Safari'
url_list = safari.windows.tabs.URL.get
@base10
base10 / freebsd.json
Created May 21, 2013 20:39
Ansible setup module differences between Ubuntu 12.04 LTS and FreeBSD 8.0
# ansible appservers -m setup -i playbooks/ansible_hosts -u vagrant
{
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"10.0.2.15",
"172.16.2.12"
],
"ansible_all_ipv6_addresses": [],
"ansible_architecture": "amd64",
"ansible_date_time": {
@base10
base10 / playbook.yml
Created July 19, 2013 02:25
Need help with testing definedness using 'when_unset' The key question. Why does when_unset not catch a variable as defined if it begins with a '$'?
---
- name: webserver plays
hosts: all
user: nathan
sudo: no
gather_facts: false
vars:
foo: onetwothree
bar: fourfivesix
@base10
base10 / playbook.yml
Last active December 20, 2015 03:49
when_unset does not appear to behave as documented or expected. This change appears to have been introduced in Ansible devel 62b39d3d. I expect $bippy to fai. I don't expect $foo and $bar to fail. Unseen is 'fake-inventory' that is just "localhost".
---
- name: webserver plays
hosts: all
user: nathan
sudo: no
gather_facts: false
vars:
foo: "onetwothree"
bar: "fourfivesix"
@base10
base10 / playbook.yml
Created July 25, 2013 15:39
Related to Michael's suggestions: (https://github.com/ansible/ansible/issues/3658#issuecomment-21535516), I've updated my playbook.yml to match suggestions. Unfortunately, I'm still not seeing the expected results. I expect to see bippy fail. fake-inventory is just localhost
---
- name: webserver plays
hosts: all
user: nathan
sudo: no
gather_facts: false
vars:
foo: "onetwothree"
bar: "fourfivesix"