Consoles
 

Archive for the ‘Uncategorized’ Category

Brightercove

by David Czarnecki, July 29th, 2010 at 03:13pm - No Comments »
Tagged As: , ,
Posted in: Engineering, Uncategorized

We’re using Brightcove here at Agora Games for some video platform work. In our group chats, we’ve talked about, “It would be nice if we had a Ruby API for interacting with Brightcove.”

And so I did just that, http://github.com/agoragames/brightcove


sudo gem install brightcove-api

>> require 'brightcove-api'
=> true
>> brightcove = Brightcove::API.new('0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.')
=> #<brightcove ::API:0x114dbc8 @token="0Z2dtxTdJAxtbZ-d0U7Bhio2V1Rhr5Iafl5FFtDPY8E.", @api_url="http://api.brightcove.com/services/library">
>> response = brightcove.get('find_all_videos', {:page_size => 3, :video_fields => 'id,name,linkURL,linkText'})
=> {"items"=>[{"name"=>"Documentarian Skydiving", "id"=>496518762, "linkText"=>nil, "linkURL"=>nil}, {"name"=>"Surface Tricks", "id"=>496518763, "linkText"=>nil, "linkURL"=>nil}, {"name"=>"Free Skiing", "id"=>496518765, "linkText"=>nil, "linkURL"=>nil}], "page_number"=>0, "page_size"=>3, "total_count"=>-1}

  • Reddit
  • Digg
  • del.icio.us
  • Facebook
  • Tumblr
  • Twitter

Party for Misha

by Brian Corrigan, July 29th, 2010 at 12:52pm - 1 Comment »
Posted in: Uncategorized

image

Today is Misha’s last day.  We wished him luck and toasted him off with some local microbrews from the Troy Pub and Brewery.

  • Reddit
  • Digg
  • del.icio.us
  • Facebook
  • Tumblr
  • Twitter

Ruby Reversible Encryption

by Brian Corrigan, May 13th, 2010 at 08:31pm - No Comments »
Posted in: Bending Rails, Engineering, Uncategorized

It’s been awhile since I had to do anything with reversible encryption. Here’s a working sample using AES.

#/usr/bin/ruby
require 'openssl'
require "base64"
require 'uri'

# First lets encrypt the string!
plaintext = 'Super secret message'

# Create the cipher
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
cipher.encrypt # Tell OpenSSL to operate in encrypt mode
puts "Cipher wants a key that is #{cipher.key_len}"
key = '01234567890123456789012345678901'
cipher.key = key

puts "Cipher wants an initialization vector that is #{cipher.iv_len}"
cipher.iv = iv = cipher.random_iv # Create and set a random initialization vector

# Encrypted
encrypted = cipher.update(plaintext) + cipher.final
encrypted = iv + encrypted # Send along the IV

# Lets pretty up the encrypted string
encrypted = Base64.encode64(encrypted)
#encrypted = URI.escape(encrypted, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
encrypted = URI.escape(encrypted)

# Now lets unencrypt it, first start with a new cipher
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
cipher.decrypt # Use SSL in decrypt mode
cipher.key = key
encrypted = URI.unescape(encrypted)
encrypted = Base64.decode64(encrypted)
cipher.iv = encrypted.slice!(0,16) # Remove the IV from the encrypted data
decrypted = cipher.update(encrypted) + cipher.final 

# Test
puts 'The original was '+ plaintext
puts 'Encrypted that was ' + encrypted
puts 'Decrypted we have ' + decrypted
  • Reddit
  • Digg
  • del.icio.us
  • Facebook
  • Tumblr
  • Twitter

It’s My Gem In A Box

by David Czarnecki, April 28th, 2010 at 05:04pm - No Comments »
Tagged As: , , ,
Posted in: Uncategorized

Hey developers, I got something real important to give you. So just sit down, and listen.

(more…)

  • Reddit
  • Digg
  • del.icio.us
  • Facebook
  • Tumblr
  • Twitter

Packaging For Pleasure

by David Czarnecki, April 19th, 2010 at 04:15pm - No Comments »
Tagged As: , ,
Posted in: Bending Rails, Engineering, Uncategorized

Let me be more explicit and say I’m going to be talking about Rails application packaging. Sorry, I needed a good post title for the lulz and the page views.

(more…)

  • Reddit
  • Digg
  • del.icio.us
  • Facebook
  • Tumblr
  • Twitter