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
| # One liner for counting unique IP addresses from nginx logs | |
| # Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!) | |
| # | |
| # Sample output: | |
| # | |
| # $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' | |
| # 66.65.145.220 49 | |
| # 92.63.28.68 126 | |
| cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' |
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
| def save_and_open_page | |
| dir = "#{Rails.root}/tmp/cache/capybara" | |
| file = "#{dir}/#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}.png" | |
| FileUtils.mkdir_p dir | |
| page.driver.render file | |
| wait_until { File.exists?(file) } | |
| system "open #{file}" | |
| 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
| # app/controllers/users/password_controller.rb | |
| class Users::PasswordsController < Devise::PasswordsController | |
| def resource_params | |
| params.require(:user).permit(:email, :password, :password_confirmation) | |
| end | |
| private :resource_params | |
| 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
| # Change to the project directory | |
| cd $FORGE_SITE_PATH | |
| # Turn on maintenance mode | |
| php artisan down || true | |
| # Pull the latest changes from the git repository | |
| # git reset --hard | |
| # git clean -df | |
| git pull origin $FORGE_SITE_BRANCH |
OlderNewer