Skip to content

Instantly share code, notes, and snippets.

@avramd
avramd / accounts.rb
Created June 20, 2019 19:41
map missing accounts
user_cutoff = DateTime.parse("Tue, 18 Jun 2019 01:08:20 UTC +00:00").in_time_zone("Eastern Time (US & Canada)")
ul=User.where('created_at > ?', user_cutoff);ul.count
ul.map{|u| mc=u.marketing_contact; flu=mc.firm_level_user; puts [u.id, u.role, u.full_name_csv, u.email, u.practice_name.to_s.gsub(/,/,"-"), mc.id,mc.full_name_csv, mc.email, flu.id,flu.full_name_csv, flu.email].join(',')};:/
gul = ul.group_by{|u| u.marketing_contact.firm_level_user};gul.size
gul.map{|k,v|[v.size,k.full_name,k.email]}.sort_by(&:first).map{|e| printf("%3s: %32s %s\n", *e)};:/
clients = ul.select{|e|e.role == 'user'}.sort_by{|e|[e.marketing_contact.firm_level_user,e.marketing_contact]}; clients.size
File.open('/tmp/accounts.csv', 'w') do |f|
clients.map do |u|
next if u.full_name == 'Unassigned Accounts'
@avramd
avramd / passenger-status.json
Created January 10, 2016 18:57
Phusion passenger-status show=server output
$ passenger-status
Version : 5.0.8
Date : 2016-01-08 08:03:35 -0500
Instance: I7g6DyaW (Apache/2.2.15 (Unix) DAV/2 Phusion_Passenger/5.0.8)
----------- General information -----------
Max pool size : 6
Processes : 6
Requests in top-level queue : 0