Some description how is awesome the project.
- Follow installation instructions in doc/INSTALLATION
- Follow deployment instructions in doc/DEPLOYMENT
- Follow workflow process in doc/WORKFLOW
| current_date=`date +%Y-%m-%d-%H:%M` | |
| file_name="db.$current_date.sql.gz" | |
| file_path="/mnt/backup/$file_name" | |
| mysqldump --single-transaction --quick -u*** -p*** DB | gzip -c > $file_name | |
| echo `ls -la $file_path` | mail -s "[backup] DB" [email protected] |
| # Returns a number rounded to the desired multiple 0.5, | |
| # analog of excel's MROUND(A1, 0.05). | |
| def mround(number) | |
| (number * 20).round.to_f / 20 | |
| end |
| # Test script to profile requests with GC options in case you have only access into the console. | |
| # | |
| # Invoke the script in the staging/production console: | |
| # | |
| # RAILS_ENV=production rails console | |
| # [1] pry(main)> load '/path/to/the-file/requests.rb' | |
| # | |
| # You will see benchmark results per link for analyzing. | |
| # | |
| # You should run it before and after changing GC options for comparison. |
See the current amount of free and used memory in the system:
free -m
What actual time we have (in the console):
time = Benchmark.measure do
app.get '/needed-page'
end
puts time
| # Example for http://rungist.com/ | |
| about = ".xobdnas ybur eht ni tsig s'buhtig a nur ot uoy swolla tI .ybuR yrT rehtonA teY eht si sihT" | |
| "Hi, #{about.reverse}" |
| # Monitor some background process on execution | |
| watch -n 1 "ps aux | grep php" |
| # Problem 1 of 3: Math | |
| # ==================== | |
| # | |
| # n! means n * (n - 1) * ... * 3 * 2 * 1 | |
| # For example, 10! = 10 * 9 * ... * 3 * 2 * 1 = 3628800 | |
| # Let R(n) equal the sum of the digits in the number n! | |
| # For example, R(10) is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. | |
| # Find the lowest value for n where R(n) is 8001. | |
| # | |
| # Result: 787. |
| # Change mass-assignment protection strategy to black-list to allow updates of virtual attributes | |
| Delayed::Job.attr_protected nil |