- Install pyenv
- Install pyenv virtualenv
In fee calculator app root dir create a virtual env for a specific version of python (I am using 3.8.3, latest at time of writing), and give it a name.
$ cd .../laa-fee-calcultor
| # place in ~/.pryrc | |
| if defined?(Pry) | |
| Pry.config.color = true | |
| Pry.config.prompt_name = 'Pry:' + File.basename(Dir.pwd) | |
| Pry.commands.alias_command 'wami', 'whereami' | |
| Pry.commands.alias_command 'c', 'continue' | |
| Pry.commands.alias_command 's', 'step' | |
| Pry.commands.alias_command 'n', 'next' |
In fee calculator app root dir create a virtual env for a specific version of python (I am using 3.8.3, latest at time of writing), and give it a name.
$ cd .../laa-fee-calcultor
| read AWS_ACCESS_KEY_ID ARN URL AWS_SECRET_ACCESS_KEY <<<$(kubectl --context <context> -n <namespace> get secret <secret> -o json | jq -r '.data[] | @base64d'); printf "$AWS_ACCESS_KEY_ID\n$ARN\n$URL\n$AWS_SECRET_ACCESS_KEY" |
| # helper to capture certain errors and expectation failures | |
| # and retry until timeout reached. | |
| # Idea taken from: | |
| # https://github.com/makandra/spreewald | |
| # | |
| module PatienceHelper | |
| RETRY_ERRORS = %w[ | |
| Capybara::ElementNotFound | |
| Spec::Expectations::ExpectationNotMetError | |
| RSpec::Expectations::ExpectationNotMetError |
| # find and replace search path in ADP dump file | |
| gunzip -3 -f adp_gamma_dump.psql.gz | |
| fgrep 'search_path' adp_gamma_dump.psql -m1 | |
| sed -i -e "s/SELECT pg_catalog.set_config('search_path', '', false)/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true)/" adp_gamma_dump.psql | |
| fgrep 'search_path' adp_gamma_dump.psql -m1 | |
| gzip adp_gamma_dump.psql |
| #!/bin/bash | |
| # *********************************************************** # | |
| # Ideal path to minimise downtime is: | |
| # - [recommended] perform `VACUUM (VERBOSE, ANALYZE);` on db | |
| # * to improve speed of db generally | |
| # - [recommended] create manual snapshot | |
| # * to improve speed of upgrade process's automated snapshots | |
| # - put site in maintenance mode | |
| # - perform VACUUM; of postgres DB (this can be done before too but may place heavy load on db) |
| module HashExtension | |
| def all_keys | |
| each_with_object([]) do |(k, v), keys| | |
| keys << k | |
| keys.concat(v.select { |el| el.is_a?(Hash) }.flat_map(&:all_keys)) if v.is_a? Array | |
| keys.concat(v.all_keys) if v.is_a? Hash | |
| end | |
| end | |
| def all_values_for(key) |
| [ | |
| { "keys": ["super+shift+["], "command": "prev_view" }, | |
| { "keys": ["super+shift+]"], "command": "next_view" }, | |
| { "keys": ["super+alt+left"], "command": "prev_view" }, | |
| { "keys": ["super+alt+right"], "command": "next_view" }, | |
| { "keys": ["ctrl+y"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "}}, | |
| { "keys": ["super+i"], "command": "copy_path" } | |
| ] |
| if defined?(PryByebug) | |
| Pry.config.color = true | |
| Pry.config.prompt_name = 'Pry:' + File.basename(Dir.pwd) | |
| Pry.commands.alias_command 'c', 'continue' | |
| Pry.commands.alias_command 's', 'step' | |
| Pry.commands.alias_command 'n', 'next' | |
| Pry.commands.alias_command 'f', 'finish' | |
| end |