Skip to content

Instantly share code, notes, and snippets.

@sankage
sankage / function.coffee
Created April 3, 2012 18:07
CoffeeScript: self executing anonymous functions
# Is there a coffeescript way of doing this?
(function($, exports){
# doing random stuff here
})(jQuery, window);
# Other than this:
( ($, exports) ->
# doing random stuff here
@sankage
sankage / Answer.rb
Created December 15, 2011 16:50
Question & Answers associations
class Answer < ActiveRecord::Base
belongs_to :respondent
belongs_to :question
end
@sankage
sankage / answer.rb
Created November 29, 2011 02:26
Collection Sub-Selection
# Answer model
class Answer < ActiveRecord::Base
belongs_to :respondent
belongs_to :question
end
@sankage
sankage / Respondent.rb
Created November 29, 2011 01:07
Collection Problem
# Respondent model
class Respondent < ActiveRecord::Base
belongs_to :office
has_many :comments
has_many :answers
end
@sankage
sankage / two_factor_ssh.md
Created September 23, 2011 14:29
Two Factor Authentication for ssh

Simple Two-Factor SSH Authentication

Posted on September 23 2011 by Richard Taylor (@moomerman)

In a two-part post I'm going to show you some tricks you can do with SSH logins. This post covers setting up two-factor SSH authentication with the Google Authenticator app.

I was recently getting some servers in shape so I can pass the Payment Card Industry standards questionnaire and one requirement was two-factor authentication access to the server. I queried whether SSH key + passphrase was acceptable but didn't get a clear answer so I figured I'd explore setting up another authentication factor myself, plus it piqued my interest.

After a bit of research I found it was possible using a PAM module but it doesn't work along with SSH key authentication (only password authentication) and I only use SSH key logins for my servers.

The magic