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
| # Vai até a respectiva branch | |
| git checkout dest-branch | |
| # Puxa todas as alterações do git | |
| git fetch --all | |
| # Reseta a branch para a master | |
| git reset --hard origin/master | |
| # Faz merge com sua branch |
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
| # DUMP | |
| pg_dump dbname > outfile | |
| # RESTORE DUMP | |
| psql dbname < infile | |
| # CREATE DB | |
| createdb [connection-option...] [option...] [dbname] [description] | |
| # DROP DB |
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
| #!/bin/env ruby | |
| # lazy hack from Robert Klemme | |
| module Memory | |
| # sizes are guessed, I was too lazy to look | |
| # them up and then they are also platform | |
| # dependent | |
| REF_SIZE = 4 # ? | |
| OBJ_OVERHEAD = 4 # ? |
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
| # Create groups | |
| sudo groupadd www-data | |
| # Add users to group | |
| sudo usermod -a -G www-data $(whoami) | |
| sudo usermod -a -G www-data root | |
| # Add users to www-data | |
| sudo usermod -a -G www-data root |
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
| # Access crontab -e | |
| crontab -e | |
| # Create a CRON like this | |
| 30 10 * * * ~/autobackup.sh | |
| # Create autobackup file | |
| touch ~/autobackup.sh | |
| # autobackup.sh content |
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
| rake db:drop | |
| git checkout master db/structure.sql | |
| rake db:create | |
| rake db:structure:load | |
| rake db:migrate |
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
| ActiveRecord::Base.connection.tables.each do |table| | |
| indexes = ActiveRecord::Base.connection.indexes(table) | |
| if indexes.length > 0 | |
| puts "====> #{table} <====" | |
| indexes.each do |ind| | |
| puts "----> #{ind.name}" | |
| end | |
| puts "====> #{table} <====" | |
| 2.times{ puts ''} | |
| 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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
| module WithSelfClass | |
| class << self | |
| def my_function | |
| "Presenter" | |
| end | |
| end | |
| end | |
| class MyClassWithSelfClass | |
| extend WithSelfClass |
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
| annotate --show-indexes --exclude tests,fixtures,factories,serializers --show-foreign-keys |