How to send a test e-mail from shell

Manually verify outbound e-mail delivery from a machine with mail from the shell, either empty or with a typed message body.

Test the content-type of a response in Cucumber

Check a download or page response by its MIME type in Cucumber, using Webrat or Capybara; the Selenium webdriver does not support this approach.

How to deal with: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type [...] at

Puppet catalog compilation can fail with ArgumentError: Invalid resource type when plugin sync or environments are misconfigured. Missing Ruby files in /var/lib/puppet/lib can trigger the error.

Example .ssh/config file

A reusable ~/.ssh/config template can simplify SSH access with host aliases and keepalive settings, then be adapted to personal needs.

VCR: Inspecting a request

VCR can stub remote API calls in tests while still letting you inspect what was sent, including request payloads, through WebMock.

Rails Env Widget

A small helper adds a dismissible on-screen badge showing the current Rails environment to prevent confusion between development, test, and production.

How to enable MySQL query logging

MySQL can record every received query for debugging at the cost of performance. Enabling the general query log helps inspect database activity on non-production systems.

Openstack: Create a Flavor

Create and list OpenStack Nova flavors by defining RAM, disk, swap, and vCPU resources for instances.

Dual monitors crashing Linux with NVIDIA drivers

Dual-monitor setups with NVIDIA on Linux can crash X when DDC/CI is enabled on Dell displays; disabling DDC/CI avoids the failure.

Apache: Redirect all requests from one host to another

Redirecting all requests from one host to another preserves path and query string while avoiding duplicate hosts and broken links.

Get compiled code of a view template in Rails 4.2

Inspecting the generated Ruby for erb or haml templates helps debug rendering issues and understand what Rails executes. lookup_context.find_template and the template handler return the compiled output code.

ActiveRecord 3+ auto-converts times to UTC by default. Hilarity ensues.

Rails 3 auto-converts ActiveRecord times to UTC by default, which can break code using Time.now or Time.parse; local time and non-aware attributes restore the older behavior.

Fixing "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)"

RubyGems 1.6.0 can break Rails 2.x with ActiveSupport::Dependencies::Mutex NameError during startup; loading thread before boot.rb prevents the failure.

MySQL/MariaDB: Hide all sleeping processes in processlist

Many MySQL or MariaDB connections can make SHOW PROCESSLIST hard to scan; sleeping sessions can be hidden with a pager filter or by querying metadata directly.

SSL/TLS - Typical problems and how to debug them

Common TLS failures can block secure connections and are often hard to diagnose. Typical symptoms point to certificate, protocol, or handshake issues and debugging clues help narrow them down.

List your current Git remotes

git remote -v lists configured repository endpoints and shows which URLs are used for fetching and pushing.

How to fix: "Error Bundler::HTTPError during request to dependency API"

bundle install can fail with Bundler::HTTPError while contacting the dependency API; upgrading Bundler to 1.2.4 or newer removes the misleading error.

Test the status code of a response in Cucumber

Checking response status in Cucumber can verify error handling and redirects during acceptance tests. Webrat and Capybara expose status information for custom step definitions.

PostgreSQL: Show size of all databases

List PostgreSQL database sizes in megabytes with pg_database_size, useful for spotting large databases and planning storage.

Dealing with Solr's "404 Not Found" response

Solr can start normally yet still return 404 Not Found when its log directory is not writable for the runtime user.

How to access your Rails session ID

Accessing the Rails session ID is only possible when a session ID exists; exposing it is risky and should be done carefully.

Passenger booting Rails 3 application in wrong environment

Passenger can start a Rails app in the wrong environment unless Apache is configured with the correct RailsEnv or RackEnv setting.

Install rabbitmq plugins (e.g. management plugin) on Ubuntu 12.04

RabbitMQ plugins on Ubuntu 12.04 require the full rabbitmq-plugins path because the binary is not in the default PATH.

Spreewald 0.6.6 improves the Timezone switch

Time zone mismatches can make Time.now differ from expected local time; upgrading Spreewald to 0.6.6 may correct the timezone switch bug.