How to make http/https requests yourself with nc/telnet/openssl

Send raw HTTP or HTTPS requests from the command line when curl is unavailable or unsuitable, using nc, telnet, or openssl s_client.

ActionMailer sometimes breaks e-mails with multiple recipients in Rails 2

Rails 2 mail sending can produce malformed headers for multiple recipients because a buggy TMail version inserts a blank line. A maintained fork fixes the issue when no MTA repairs it.

See which Rails applications are being served by your Passenger

passenger-memory-stats lists Passenger processes with application directories and memory usage, making it easy to identify which Rails apps are currently served.

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.

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.

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.

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.