Skip to content

Instantly share code, notes, and snippets.

@skarm61
skarm61 / authentication_with_bcrypt_in_rails_4.md
Created January 23, 2018 12:31 — forked from thebucknerlife/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@skarm61
skarm61 / install-comodo-ssl-cert-for-nginx.rst
Created January 17, 2017 11:17 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@skarm61
skarm61 / validate_all_objects.rake
Created May 6, 2014 11:33
Rake task: validate all objects in database
namespace :test_db do
task validate_all_objects: :environment do
Dir[Rails.root.to_s + '/app/models/**/*.rb'].each do |file|
begin
require file
rescue
end
end
ActiveRecord::Base.descendants.each do |model|
@skarm61
skarm61 / basic_installation.md
Last active September 17, 2015 11:31
Some instructions

GIT:

sudo apt-get install curl git

Subime 3:

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update && sudo apt-get install sublime-text-installer

https://packagecontrol.io/installation

@skarm61
skarm61 / sublime_config
Created February 3, 2014 21:06
Sublime configs
"color_scheme": "Packages/Github Color Theme/GitHub.tmTheme",
"font_size": 10,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"enable_tab_scrolling": false,
"theme": "Soda Light 3.sublime-theme",
"word_separators": "./\\()\"'-:,.;<>~!#$%^&*|+=[]{}`~?",
@skarm61
skarm61 / vim_install.sh
Created January 24, 2014 09:06
Install vim with other
sudo apt-get install vim
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
cd ~
@skarm61
skarm61 / new_gist_file_0
Created December 13, 2013 10:15
Ssh configuring
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
sudo vim /etc/ssh/sshd_config
PermitRootLogin yes -> no
Port 22 -> other port
Protocol 2
sudo /etc/init.d/ssh restarts
http://help.ubuntu.ru/wiki/ssh
@skarm61
skarm61 / .bashrc
Created December 2, 2013 13:06 — forked from marioBonales/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@skarm61
skarm61 / .bash_aliases
Last active February 10, 2026 21:27
bash aliases
alias aliases='vim ~/.bash_aliases'
# Rails db's:
# alias db='rake db:migrate && rake db:migrate RAILS_ENV=test'
# alias db_dance='rake db:dance && rake db:migrate RAILS_ENV=test'
# alias reset_db='rake db:drop && rake db:create && rake db:migrate && rake db:seed'
# alias reset_test_db='rake db:drop RAILS_ENV=test && rake db:create RAILS_ENV=test && rake db:migrate RAILS_ENV=test'
alias be='bundle exec'
# alias c='clear'
@skarm61
skarm61 / VIM configs
Last active December 28, 2015 16:09
~/.vimrc
execute pathogen#infect()
syntax on
set ruler
set nu
" пробелы вместо табов
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2