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
| PARENS = { | |
| "(" => ")", | |
| "{" => "}", | |
| "[" => "]" | |
| } | |
| OPENING_PARENS = PARENS.keys | |
| CLOSING_PARENS = PARENS.values | |
| def valid_parentheses(string) | |
| stack = [] | |
| string.each_char do |ch| |
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
| # Completely remove any previous config | |
| sudo apt remove --purge mysql* | |
| sudo apt autoremove | |
| sudo find / -iname mysql | |
| # install the server | |
| sudo apt update | |
| sudo apt install mysql-server | |
| # run the wizard | |
| sudo mysql_secure_installation |
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
| str = "aabbbaa" | |
| count = Hash.new(0) | |
| str.each_char { |c| count[c] += 1 } | |
| puts count |
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
| # generate and edit env-specific encrypted credentials | |
| EDITOR=nano bin/rails encrypted:edit config/development.yml.enc --key config/development.key | |
| # override credentials in application.rb | |
| def credentials | |
| encrypted( | |
| "config/#{Rails.env.downcase}.yml.enc", | |
| key_path: "config/#{Rails.env.downcase}.key" | |
| ) | |
| end |
OlderNewer