Skip to content

Instantly share code, notes, and snippets.

View sclinede's full-sized avatar

Sara Dolganov sclinede

View GitHub Profile
http://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file
Если конкретно по разработке Марса:
1) Со стороны сервиса:
1.1), 1.2), 1.3), 1.4)
Не сразу все взлетело, повозился с обновлением rvm, postgres'ом, тут и новые гемы и
пришлось по гему отчетов немного дописывать чтоб все работало как надо и
подключать ранее нигде не использовавшийся у нас гем Mechanize
+2 д
1.5) так и вышло около +2 дней, сейчас еще уйдет время на отладку с resque, по последним проверкам там есть неясные проблемы с загрузкой записей разговоров
id | company_id | date | pages | visits | yml_hits
-----------+------------+------------+-------+--------+----------
145789326 | 9909536 | 2014-10-01 | 0 | 1 | 0
145789327 | 10741255 | 2014-10-01 | 0 | 1 | 0
145789328 | 10876233 | 2014-10-01 | 0 | 1 | 0
145789329 | 11357345 | 2014-10-01 | 0 | 2 | 0
145789330 | 12699146 | 2014-10-01 | 0 | 1 | 0
145789331 | 12087730 | 2014-10-01 | 0 | 1 | 0
145789332 | 12753551 | 2014-10-01 | 0 | 2 | 0
145789333 | 12753457 | 2014-10-01 | 0 | 1 | 0
c1 = Company.find(10740942)
c2 = Company.find(10809508)
Benchmark.measure do
RebindProductRegions.new(c2).add_regions_new([149, 256], 5000)
end
=> ... in progress ...
## 79.190000 0.270000 79.460000 (150.049631) - without Sphinx :( ##
Benchmark.measure do
# USEFULL!
user@server $ find ./ -name 20140907125436* | xargs less
# blizko@k4121-bz-job /home/blizko/current $ less log/index.log
sphinx_h = Sphinx::Integration::Helper.new
sphinx_h.send(:dump_delta_index, Product, Product.sphinx_indexes.first)
# OR
Sphinx::Integration::Helper.new.send(:catch_up_indexes, :truncate => false)
https://github.com/abak-press/pulscen/commit/e0207f19050ec3a2393883af6aac0bbb5147fc96
https://github.com/abak-press/pulscen/commit/bbdb2d8801114f45061c71fdffa052e218896bec#diff-53683965352b4a773f1e23a5996855c7R40
https://github.com/abak-press/pulscen/commit/22c322aff027cf0ae0e0a0ae4889d4c1a13e5dae
Resque.queues.each { |q| p "#{q}: #{Resque.size(q)}" }
# less log/companies_packet_manager.log
def calc_continuously_paid_months(company)
nodes = []
company.packet_history.where(packet_id: Company::PACKET_PAID_WITH_TEST).each do |packet_history_record|
start_node = {type: :start, value: packet_history_record.valid_from.to_date}
end_node = {type: :end, value: [packet_history_record.valid_to.to_date, Date.today].min}
nodes << start_node << end_node
end
nodes.sort! { |node_1, node_2| node_2[:value] <=> node_1[:value] }
select sum(coalesce(least(valid_to::date, now()::date) - valid_from::date, 0))/30.0 as diff_sum, company_id from company_packet_history where packet_id <> 0 and company_id in (select company_id from company_billings where ind_packet <> 0) group by company_id order by company_id desc limit 10;