Skip to content

Instantly share code, notes, and snippets.

View jmeridth's full-sized avatar
:shipit:
ship to learn

JM (Jason Meridth) jmeridth

:shipit:
ship to learn
View GitHub Profile
@jmeridth
jmeridth / Capfile
Created January 29, 2009 01:58
Capfile for capistrano
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
set :application, "mydomain.com"
set :domain, "mydomain.com"
set :repository, "TBD"
set :deploy_to, "/home/myuser/public_html/#{domain}"
set :scm, :git
set :deploy_via, :copy
#ssh_options[:keys] = "~#{ENV['USER']}/.ssh/id_rsa"
ssh_options[:port] = 314
#ssh_option[:paranoid] = false
@jmeridth
jmeridth / IntegrityApp_git_post_receive.rb
Created May 28, 2009 13:33
integrity ci githook post-receive
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'net/https'
require 'json'
# EDIT POST_RECEIVE_URL
POST_RECEIVE_URL = 'https://my.domain.com/application_name/push'
@jmeridth
jmeridth / rijndael_test.cs
Created December 14, 2009 12:43
C# rijdael test
[Test]
public void rijndael_test()
{
var rijndaelAlg = Rijndael.Create();
byte[] data = Encoding.UTF8.GetBytes("1234567890abcdef");
rijndaelAlg.Key = new ASCIIEncoding().GetBytes("pass123pass123pass123pass123pass");
rijndaelAlg.IV = new ASCIIEncoding().GetBytes("1234567890abcdef");
using (var memoryStream = new MemoryStream())
using (var cryptoStream = new CryptoStream(memoryStream, rijndaelAlg.CreateEncryptor(), CryptoStreamMode.Write))
{
@jmeridth
jmeridth / crypt_rijndael_add_iv.rb
Created December 14, 2009 12:43
ruby rijndael encryption - add IV
module Crypt
class Rijndael
def vector() @vector; end
alias orig_initialize initialize
def initialize(key, vector, keyBits = 256, blockBits = 128)
@vector = vector
orig_initialize(key, keyBits, blockBits)
end
@jmeridth
jmeridth / rijndael_test
Created December 14, 2009 12:44
ruby crypt/rijndael encryption gem test
>> require 'crypt/rijndael'
=> []
>> require 'crypt'
=> []
>> r = Crypt::Rijndael.new("pass123pass123pass123pass123pass","1234567890abcdef")
=> #<Crypt::Rijndael:0x2650fd4 @rounds=14, @round_keys=[[[112, 49, 97, 50], [97, 50, 115, 51], [115, 51, 115, 112], [115, 112, 49, 97]], [[115, 51, 115, 112], [115, 112, 49, 97], [49, 97, 50, 115], [50, 115, 51, 115]], [[158, 175, 206, 252], [238, 220, 175, 156], [252, 207, 188, 204], [34, 82, 99, 2]], [[195, 240, 131, 243], [173, 221, 236, 141], [122, 27, 41, 90], [69, 54, 5, 118]], [[193, 110, 160, 92], [80, 140, 35, 191], [196, 11, 183, 123], [47, 125, 30, 28]], [[137, 121, 250, 9], [165, 120, 148, 25], [91, 64, 105, 51], [217, 239, 234, 156]], [[17, 127, 223, 131], [147, 31, 60, 131], [26, 17, 166, 221], [46, 83, 77, 81]], [[101, 28, 230, 239], [73, 49, 165, 188], [154, 218, 179, 128], [8, 231, 13, 145]], [[124, 3, 220, 95], [94, 65, 125, 254], [155, 138, 44, 241], [241, 162, 239, 190]], [[170, 182, 80, 191], [242, 195, 102, 218], [59, 225, 82, 210], [166, 65, 76, 2
@jmeridth
jmeridth / nested_object_initialization_in_module.rb
Created December 17, 2009 08:47
nested ruby object initialization in module
module MA
class B
attr_accessor :var_1, :var_2
def initialize
@var_1 = "initialized"
@var_2 = "initialized"
end
end
end
@jmeridth
jmeridth / access_object_from_module_via_include.rb
Created December 17, 2009 09:19
access ruby object from module via include
module MA
class B
attr_accessor :var_1, :var_2
def initialize
@var_1 = "initialized"
@var_2 = "initialized"
end
end
end
@jmeridth
jmeridth / access_object_from_module_via_extend.rb
Created December 17, 2009 09:19
access ruby object from modules via extend
module MA
class B
attr_accessor :var_1, :var_2
def initialize
@var_1 = "initialized"
@var_2 = "initialized"
end
end
end
@jmeridth
jmeridth / post-merge.rb
Created December 23, 2009 04:59
rails migrations post merge
#!/usr/bin/env ruby
`rake db:migrate && rake db:test:prepare` if `git diff HEAD^`.index("db/migrations")