Open the postgresql.conf config file:
$> mate /usr/local/var/postgres/postgresql.conf
Uncomment the line with 'log_destination' and set it to 'syslog'
log_destination = 'syslog'
Open the syslog config:
# Put this in lib/current_controller_and_action.rb | |
module Padrino | |
module Rendering | |
module InstanceMethods | |
private | |
# Override render to store the current template being rendered so we can refer to it in the view | |
# This works with Padrino >= 0.9.10 | |
def render(engine, data=nil, options={}, locals={}, &block) | |
# If engine is a hash then render data converted to json |
Open the postgresql.conf config file:
$> mate /usr/local/var/postgres/postgresql.conf
Uncomment the line with 'log_destination' and set it to 'syslog'
log_destination = 'syslog'
Open the syslog config:
#!/bin/bash | |
shopt -s globstar | |
for file in *.htmln; do | |
mv "$file" "${file%.htmln}.html" | |
echo "$file ${file%.htmln}.html" | |
done |
#!/bin/bash | |
for i in 2 3 4 5 6 7 8 9; do | |
mv ex$i.html ex0$i.html | |
done |
#!/bin/sh | |
PROJECT="" # Fill this in | |
IMAGES="$PROJECT/app/assets/images" | |
VIEWS="$PROJECT/app/views" | |
CSS="$PROJECT/app/assets/stylesheets" | |
for image in `find $IMAGES -type f` | |
do | |
name=`basename $image` |
["/home/wbrent/public_html/rentwb/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'", "/home/wbrent/public_html/rentwb/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `block in execute'", "/home/wbrent/public_html/rentwb/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'", "/home/wbrent/public_html/rentwb/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'", "/home/wbrent/public_html/rentwb/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'", "/home/wbrent/public_html/rentwb/shared/bundle/ruby/1.9.1/gems/newrelic_rpm-3.5.3.25/lib/new_relic/agent/instrumentation/active_record.rb:32:in `block in log_with_newrelic_instrumentation'", "/home/wbrent/publ |
[1] pry(main)> o = Order.last | |
Order Load (0.4ms) SELECT `orders`.* FROM `orders` ORDER BY `orders`.`id` DESC LIMIT 1 | |
=> #<Order id: 2414, user_id: 195, shipping_address_id: nil, created_at: "2013-03-07 22:43:50", updated_at: "2013-03-08 02:31:54", credit_card_id: 611, state: "pending", store_id: 7, total_in_cents: 10235, subtotal_in_cents: 9884, tax_in_cents: 845, shipping_cost_in_cents: 0, currency: "USD", commission_payment_id: nil, discount_id: nil, ext_transaction_id: nil, rental_terms: true, ext_cc_id: nil, school_id: 5548, digital_terms: false> | |
[2] pry(main)> d = OrderDecorator.new(o) | |
=> #<OrderDecorator:0x007f9cf96da900 | |
@model= | |
#<Order id: 2414, user_id: 195, shipping_address_id: nil, created_at: "2013-03-07 22:43:50", updated_at: "2013-03-08 02:31:54", credit_card_id: 611, state: "pending", store_id: 7, total_in_cents: 10235, subtotal_in_cents: 9884, tax_in_cents: 845, shipping_cost_in_cents: 0, currency: "USD", commission_payment_id: nil, discount_id: nil, ext_transaction_id: nil, rental_terms: |
map saving a file | |
comment blocks of code | |
fugitive plugin | |
rails plugin | |
surround plugin |
delimiter | | |
CREATE EVENT purge_sessions_table | |
ON SCHEDULE | |
EVERY 1 HOUR | |
COMMENT 'Purges rails sessions table data that is older than 15 days' | |
DO | |
BEGIN | |
DELETE FROM rentwb.sessions where updated_at < DATE_SUB(NOW(), INTERVAL 15 DAY) LIMIT 100000; | |
END | |