This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'axlsx' | |
| def fetch_device_name(code_second_letter) | |
| case code_second_letter | |
| when 'V' then 'Видеокамера' | |
| when 'C' then 'Контроллер' | |
| end | |
| end | |
| TITLE_STYLE = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nginx + lua (ubuntu 18.04 bionic): | |
| 1. Disable nginx: | |
| $ sudo systemctl stop nginx | |
| 2. Install luarocks (lua package manager) | |
| 1.1. $ sudo apt update | |
| 1.2. $ sudo apt install luarocks | |
| 3. Create folder: $ mkdir /tmp/nginx-build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :ns do | |
| desc '' | |
| task collect_docs_data: :environment do | |
| dirname = 'tmp/fb_docs_data' | |
| unless File.directory?(dirname) | |
| FileUtils.mkdir_p(dirname) | |
| end | |
| School.find_each do |school| | |
| p school.id | |
| ['lectures', 'textbooks', 'exams'].each do |type| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # params | |
| # all folders - "/var/www/html/wp-content/uploads" | |
| # the whole year - "/var/www/html/wp-content/uploads/2017" | |
| # the whole month - "/var/www/html/wp-content/uploads/2017/09" | |
| # specific file - "/var/www/html/wp-content/uploads/2017/09/ut-austin-2.jpg" | |
| def optimize_png(path) | |
| puts "Optimizing PNG image URL: #{path}" | |
| system "sudo pngquant --quality=60-80 --force --ext .png #{path}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [2596956, 2596945, 2339954, 1217902, 2331053, 2352900, 2338282, 2337006, 2349314, 2337678, 2538384, 2596956, 2338279, 2538953, 2512952, 2330404, 2331046, 2333633, 2512951, 2329171, 2352896, 2596945, 1060099, 2337394, 2330988, 2329175, 2329150, 2337654, 2335690, 1217902, 2204995, 2528773, 2537146, 2359409, 2359021, 2513345, 2346876, 2349281, 2517339, 2359651, 2333645, 2329728, 2331589, 2334035, 2359636, 2335704, 2338293, 2349358, 2604450, 2329541, 2331590, 2432991, 2329445, 2336792, 2332492, 633613, 2335710, 2519940, 2417193, 2359426, 2510831, 2439640, 2329732, 2347797, 2359142, 2511086, 2144204, 2504585, 2514145, 2359425, 2346877, 2359649, 2510825, 2331450, 2439786, 2440277, 2415916, 2598404, 2330006, 2359642, 2517536, 2604462, 2512787, 2329662, 2359006, 2359424, 2329658, 2204994, 2346872, 2432129, 2510819, 2329660, 2510832, 2510758, 2334298, 2603643, 2329743, 2432874, 2604455, 2359134, 2359143, 2359423, 2346874, 2345057, 2335707, 2601246, 2359411, 2329480, 2529793, 2331587, 2349351, 2439818, 2204996, 2349149 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| CSV.foreach('jan_1_2018_to_april_12_2019_paypal_payments.CSV', headers: true, col_sep: ',') do |row| | |
| next if row['Status'] != 'Completed' || row['Balance Impact'] == 'Debit' | |
| txn_id = row['Reference Txn ID'] | |
| user_email = row['From Email Address'] | |
| if txn_id.nil? && user_email.present? && user_email != 'info@oneclass.com' | |
| user = User.where(["email = ? or email_alt = ?", user_email, user_email]).first | |
| if user && user.subscriptions.present? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 0 remove old course_code_rules from all departments in winsdor school | |
| school = School.find(41) | |
| deps = school.departments | |
| deps.each do |dep| | |
| if dep.course_code_rule.length >= 2 | |
| dep.course_code_rule << dep.course_code_rule.delete_at(0) | |
| dep.save() | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # new_preview_html_bucket | |
| s3 = AWS::S3.new( | |
| access_key_id: Amazon.key_id, | |
| secret_access_key: Amazon.secret_key | |
| ) | |
| prod = s3.buckets[Amazon.new_preview_html_bucket] | |
| dev = s3.buckets['new-preview-html-dev'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # oneclass_doc_bucket | |
| s3 = AWS::S3.new( | |
| access_key_id: Amazon.key_id, | |
| secret_access_key: Amazon.secret_key | |
| ) | |
| prod = s3.buckets[Amazon.oneclass_doc_bucket] | |
| dev = s3.buckets['prealliance_oneclass_dev'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # new_docs_thumbnails_bucket | |
| s3 = AWS::S3.new( | |
| access_key_id: Amazon.key_id, | |
| secret_access_key: Amazon.secret_key | |
| ) | |
| prod = s3.buckets[Amazon.new_docs_thumbnails_bucket] | |
| dev = s3.buckets['new-docs-thumbs-dev.oneclass.com'] |
NewerOlder