Skip to content

Instantly share code, notes, and snippets.

namespace :db do
namespace :sessions do
desc "Clean up expired Active Record sessions (updated before ENV['EXPIRE_AT'], defaults to 1 month ago)."
task :expire => :environment do
Rails.logger.info "Cleaning up expired sessions..."
puts "Cleaning up expired sessions..."
time = ENV['EXPIRE_AT'] || 1.month.ago.to_s(:db)
rows = ActiveRecord::SessionStore::Session.delete_all ["updated_at < ?", time]
Rails.logger.info "Expired sessions cleanup: #{rows} session row(s) deleted."
puts "Expired sessions cleanup: #{rows} session row(s) deleted."
# an example Monit configuration file for delayed_job
#
# To use:
# 1. copy to /var/www/apps/{app_name}/shared/delayed_job.monitrc
# 2. replace {app_name} and {environment} as appropriate
# 3. add this to your /etc/monit/monitrc
#
# include /var/www/apps/{app_name}/shared/delayed_job.monitrc
check process delayed_job with pidfile /var/www/apps/{app_name}/shared/pids/delayed_job.pid

Keybase proof

I hereby claim:

  • I am johankok on github.
  • I am johankok (https://keybase.io/johankok) on keybase.
  • I have a public key whose fingerprint is B4D1 D25C 72E6 A16F B4F3 AF79 B444 A600 FF5E BFC2

To claim this, I am signing this object:

@johankok
johankok / INSTRUCTIONS.md
Created June 21, 2018 15:16 — forked from alexellis/INSTRUCTIONS.md
A daemonset for the blinkt
  • Turn off RPis and install Blinkt if you haven't already. Rounded edges should point outwards.
  • Power back up
  • Install Kubernetes (hopefully you've already done this)
  • Download the gist to a temporary file i.e. gist.yml
  • kubectl apply -f gist.yml

Let me know what happens. If you see a red animation going backwards and forwards then everything's working right.