Guest User

Untitled

a guest
Jun 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1. сколько игп за месяц по вебманям: IgpTransaction.sum :sum, :conditions => {:state => 'success', :created_at => Time.mktime(2009,3,1)..Time.mktime(2009,3,1).end_of_month.end_of_day}
  2.  
  3. сколько рублей за месяц по смс: SmsPay.sum :cost, :conditions => {:status => 1, :created_at => Time.mktime(2009,3,1)..Time.mktime(2009,3,1).end_of_month.end_of_day}
  4.  
  5. начисление кредитов за купленный бездеп:
  6.  
  7. Purchase.find(:all, :conditions => {:item_version_id => 119}).each do |v|
  8. po = PokerroomName.find(:first, :conditions => {:pokerroom_id => 19, :name => v.pokerroom_username})
  9. po.increment!(:credit, 3000) if po
  10. end
  11.  
  12.  
  13.  
  14. статистика по игп в покеррумах:
  15.  
  16. GrabberTransaction.sum(:igp, :group => :pokerroom_id, :conditions => {:check_time => Time.mktime(2009,3,1)..Time.mktime(2009,3).end_of_month.end_of_day, :status => 1})
  17.  
  18. купленных игп:
  19.  
  20. PayedContent.sum :sum, :conditions => {:created_at => Time.mktime(2009,3,1)..Time.mktime(2009,3).end_of_month.end_of_day}
  21.  
  22. файл в base64:
  23. ruby -e 'print [IO.read(File.join(Dir.pwd, ARGV[0]))].pack("m")' 054327277260.kwm
  24.  
  25. Сумма покупок в магазине:
  26. Purchase.sum("item_version.price", :conditions => {:created_at => Time.mktime(2009,3,1)..Time.mktime(2009,3).end_of_month.end_of_day}, :include => :item_version)
  27.  
  28. Отчет по месяцам по всякому:
  29.  
  30. str = ""
  31. [['Декабрь', 2008, 12], ['Январь', 2009, 1], ['Февраль', 2009, 2], ['Март', 2009, 3]].each do |v|
  32. title, year, month = v
  33. str << "\n\nЗа #{title}\n"
  34.  
  35. sms = (SmsPay.sum(:cost, :conditions => {:status => 1, :created_at => Time.mktime(year,month,1)..Time.mktime(year,month,1).end_of_month.end_of_day}).to_f / CurrencyRate::rate(:wmr)).round(2)
  36. str << "Куплено игп по смс: #{sms}\n"
  37. wm = IgpTransaction.sum(:sum, :conditions => {:state => 'success', :created_at => Time.mktime(year,month,1)..Time.mktime(year,month,1).end_of_month.end_of_day}).round(2)
  38. str << "Куплено игп за вебмани: #{wm}\n"
  39. grabbers = GrabberTransaction.sum(:igp, :conditions => {:check_time => Time.mktime(year,month,1)..Time.mktime(year,month).end_of_month.end_of_day, :status => 1}).round(2)
  40. str << "Получено с покеррумов: #{grabbers}\n"
  41. payed = PayedContent.sum(:sum, :conditions => {:created_at => Time.mktime(year,month,1)..Time.mktime(year,month).end_of_month.end_of_day}).round(2)
  42. str << "Купленно видео на сумму: #{payed}\n"
  43.  
  44. pur = Purchase.sum("item_versions.price", :conditions => {:created_at => Time.mktime(year,month,1)..Time.mktime(year,month).end_of_month.end_of_day}, :include => :item_version)
  45. str << "Куплено товаров (включая бездепозитные бонусы): #{pur}\n"
  46. end
  47.  
  48. puts str
  49.  
  50. Выборка по бездепам по месяцам
  51. all_sum = 0
  52. str = ''
  53. [['Декабрь', 2008, 11], ['Январь', 2009, 1], ['Февраль', 2009, 2], ['Март', 2009, 3]].each do |date|
  54. title, year, month = date
  55. str << "За #{title}\n"
  56. po_sum = Item.find(:all, :conditions => ['pokerroom_id is not NULL']).inject(0) do |sum, v|
  57. pokerroom = Pokerroom.find(v.pokerroom_id)
  58.  
  59. str_versions = ''
  60. version_sum = ItemVersion.find(:all, :conditions => {:item_id => v.id}).inject(0) do |sum2, v2|
  61. count = Purchase.count(:conditions => {:item_version_id => v2.id, :created_at => Time.mktime(year,month,1)..Time.mktime(year,month).end_of_month.end_of_day})
  62. r = count * v2.price
  63. if count > 0
  64. str_versions << "Бонус #{v2.title}: #{count} на сумму #{r} igp\n"
  65. end
  66. sum2 + r
  67. end
  68. if version_sum > 0
  69. str << "Покеррум #{pokerroom.title}\n"
  70. str << str_versions
  71. str << "Всего в покерруме #{pokerroom.title}: #{version_sum} igp\n\n"
  72. end
  73. sum + version_sum
  74. end
  75. str << "Всего за месяц: #{po_sum} igp\n\n"
  76. all_sum += po_sum
  77. end
  78. str << "Всего: #{all_sum} igp\n"
  79. puts str
  80.  
  81. Синхронизация видео сервера
  82. 453 export AWS_ACCESS_KEY_ID=0K0VNTMTHGE66N1T6QG2
  83. 454 export AWS_SECRET_ACCESS_KEY=6wgEKG3CGoO+jJwzt846dZO4E4Lp6UkmYrz1cG4N
  84. 455 cd /home/video2/
  85. 456 s3sync -rdv --progress --no-md5 igc-videos: public/
  86.  
  87. Отчет по граббера с разделением на покерруме
  88. str = ""
  89. [['Декабрь', 2008, 12], ['Январь', 2009, 1], ['Февраль', 2009, 2], ['Март', 2009, 3]].each do |v|
  90. title, year, month = v
  91. str << "За #{title}\n"
  92.  
  93. grabbers = GrabberTransaction.sum(:igp, :group => 'pokerroom_id', :conditions => {:check_time => Time.mktime(year,month,1)..Time.mktime(year,month).end_of_month.end_of_day, :status => 1})
  94. all_sum = grabbers.inject(0){|sum, v| sum + v[1]}
  95. grabbers.each{|v| str << "С покеррума #{Pokerroom.find(v[0]).title}: #{v[1].round(2)} igp\n"}
  96. str << "Всего за месяц: #{all_sum.round(2)} igp\n\n"
  97.  
  98. end
  99.  
  100. puts str
  101.  
  102. Конверт в h264
  103. options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \
  104. -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
  105. -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
  106. -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
  107. -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
  108. -qmax 51 -qdiff 4"
  109.  
  110. ffmpeg -y -i "412.avi" -an -pass 1 -threads 2 -vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 "testfile.mp4"
  111.  
  112. ffmpeg -y -i "412.avi" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 -vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 "testfile.mp4"
Add Comment
Please, Sign In to add comment