The Ransack gem provides us with a powerful, flexible, easy-to-integrate search/filter form.
In your Gemfile, include
gem 'ransack'
| require 'etc' | |
| TCP_STATES = { # /usr/src/linux/include/net/tcp_states.h | |
| '00': 'UNKNOWN', | |
| 'FF': 'UNKNOWN', | |
| '01': 'ESTABLISHED', | |
| '02': 'SYN_SENT', | |
| '03': 'SYN_RECV', | |
| '04': 'FIN_WAIT1', | |
| '05': 'FIN_WAIT2', |
| -- Table information like sortkeys, unsorted percentage | |
| -- see http://docs.aws.amazon.com/redshift/latest/dg/r_SVV_TABLE_INFO.html | |
| SELECT * FROM svv_table_info; | |
| -- Table sizes in GB | |
| SELECT t.name, COUNT(tbl) / 1000.0 AS gb | |
| FROM ( | |
| SELECT DISTINCT datname, id, name | |
| FROM stv_tbl_perm | |
| JOIN pg_database ON pg_database.oid = db_id |
| <!doctype html> | |
| <title>Site Maintenance</title> | |
| <style> | |
| body { text-align: center; padding: 150px; } | |
| h1 { font-size: 50px; } | |
| body { font: 20px Helvetica, sans-serif; color: #333; } | |
| article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
| a { color: #dc8100; text-decoration: none; } | |
| a:hover { color: #333; text-decoration: none; } | |
| </style> |
| #!/usr/bin/env ruby | |
| # Evaluates a sample of keys/values from each redis database, computing statistics for each key pattern: | |
| # keys: number of keys matching the given pattern | |
| # size: approximation of the associated memory occupied (based on size/length of value) | |
| # percent: the proportion of this 'size' relative to the sample's total | |
| # | |
| # Copyright Weplay, Inc. 2010. Available for use under the MIT license. | |