You need to do this if you try this command:
ssh -T [email protected]and you get something that says
[email protected]: Permission denied (public key).You need to do this if you try this command:
ssh -T [email protected]and you get something that says
[email protected]: Permission denied (public key).| namespace :optimization do | |
| desc "Provide DB vacuum for production environment" | |
| task :vacuum => :environment do | |
| begin | |
| tables = ActiveRecord::Base.connection.tables | |
| tables.each do |table| | |
| ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};") | |
| end | |
| rescue Exception => exc | |
| Rails.logger.error("Database VACUUM error: #{exc.message}") |
| # credit: http://stackoverflow.com/questions/4514988/rails-is-there-away-to-get-the-date-object-that-is-the-closest-monday-to-today | |
| # docs: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-c-commercial | |
| # Find the next Monday | |
| Date.commercial(Date.today.year, 1+Date.today.cweek, 1) | |
| # Find the nearest Monday | |
| Date.commercial(Date.today.year, Date.today.cwday.modulo(4)+Date.today.cweek, 1) | |
| # Date of writing was: 2013-12-03 |
| # FOR BUSY JOBS | |
| # take the process_id from the /busy page in sidekiq and kill the longest running one. | |
| workers = Sidekiq::Workers.new | |
| workers.each do |process_id, thread_id, work| | |
| process = Sidekiq::Process.new('identity' => process_id) | |
| process.stop! if process_id == 'integration.3:4:71d1d7f4ef5a' | |
| end | |
| # FOR SCHEDULED JOBS | |
| # you need to know the jid to make this happen |
| class DateRangeSplitter | |
| include Enumerable | |
| def initialize(date_from, date_to, max_days, end_inclusive: true) | |
| @date_from = date_from | |
| @date_to = date_to | |
| @max_days = max_days | |
| @end_inclusive = end_inclusive | |
| generate_split_dates | |
| end |
[email protected]:~$ sudo dd bs=1m if=/Users/jamesmead/Downloads/2015-02-16-raspbian-wheezy.img of=/dev/disk2
pi@raspberrypi ~ $ sudo raspi-config
# Choose option 1 to "Expand Filesystem" - Ensures that all of the SD card storage is available to the OS
# Choose Finish & reboot
pi@raspberrypi ~ $ sudo apt-get update
| module ChargebeeFetcher | |
| class Subscription | |
| attr_reader :response | |
| delegate :has_card?, to: :customer, allow_nil: true | |
| delegate :card_expired?, :card_will_expire_soon?, to: :card | |
| def initialize(response) | |
| @response = response | |
| end |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| Copy whole content of the file gg"+yG | |
| Файл настройки: ~/.vimrc | |
| Можно редактировать файлы через сеть, например | |
| :e <scp|ftp|ftps>://user@host/path/to/the/file.txt | |
| :Ex или :e ./ - файловый менеджер | |
| == Основы == | |
| hjkl перемещение в разные стороны | |
| i режим вставки |