Skip to content

Instantly share code, notes, and snippets.

View AlejandroSilva's full-sized avatar
🐰

Alejandro Silva AlejandroSilva

🐰
View GitHub Profile
## Create a SSH key
$ cd ~/.ssh/
$ ssh-keygen -t rsa
## Stop asking for password on remote login
# add the public key to the authorized keys in the remote server
ssh user@server mkdir -p .ssh
# cat ~/.ssh/id_rsa.pub | ssh root@[your.ip.address.here] "cat >> ~/.ssh/authorized_keys"
cat ~/.ssh/id_rsa.pub | ssh user@server 'cat >> ~/.ssh/authorized_keys'
## user_collectionrn (model)
class UserCollection < ActiveRecord::Base
# instead of delete a collection, mark it as archived, the find method will not return it
def archive
self.archived = true
self.save
end
def self.find_unarchived(id)