Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
🎯
Focusing

Karthik Sirasanagandla karthiks

🎯
Focusing
View GitHub Profile
@karthiks
karthiks / compile-ooo3.sh
Created November 28, 2011 11:59 — forked from shyam/compile-ooo3.sh
comping OpenOffice.org3 for headless mode operations ( like watermarking, pdf processing, etc., )
# tested on an EL5 based platform
yum -y install perl-Archive-Zip ant bison flex pam-devel cups-devel gperf libxslt-devel openldap-devel gstreamer-devel gstreamer-plugins-base-devel db4-devel unixODBC-devel xalan-j2 boost-devel unixODBC-devel qt-devel subversion autoconf automake gtk2-devel gcc-c++ gnome-vfs2-devel rpm-build expat-devel python-devel curl-devel gcc gcc-c++ java-1.6.0-openjdk-devel libIDL-devel libXaw-devel bison
wget https://raw.github.com/gist/1247669/88133c7c8da53d257c38ff73b161d116aed18c13/dot-screenrc -O ~/.screenrc
wget http://download.services.openoffice.org/files/stable/3.3.0/OOo_3.3.0_src_core.tar.bz2
wget http://download.services.openoffice.org/files/stable/3.3.0/OOo_3.3.0_src_system.tar.bz2
tar xjf OOo_3.3.0_src_core.tar.bz2
tar xjf OOo_3.3.0_src_system.tar.bz2
cd ~/OOO330_m20/
wget http://tools.openoffice.org/unowinreg_prebuild/680/unowinreg.dll -O ./external/unowinreg/unowinreg.dll
@karthiks
karthiks / README.md
Created December 18, 2011 13:58
Steps to creating a Ruby project with RSpec for BDD and Guard for continuous testing

Pre-requisite:

  1. RVM is used
  2. In the version of ruby that is used, bundler gem is installed [ implied that it is global]

Steps:

@karthiks
karthiks / benchmarking_string_allocations_by_length.rb
Created January 7, 2012 13:01
Not all strings are created equal in Ruby 1.9.3
# source: http://patshaughnessy.net/2012/1/4/never-create-ruby-strings-longer-than-23-characters
# Observation:Not all strings are created equal in Ruby 1.9.3.
# Ruby actually uses three different types of string values:
# - Heap Strings,
# - Shared Strings, and
# - Embedded Strings
@karthiks
karthiks / gist:1858132
Created February 18, 2012 08:03 — forked from michaelfeathers/gist:1855765
Five lines that turn Ruby into a different language
class Object
def method_missing m, *args
Object.respond_to?(m, true) ? Object.send(m, self, *args) : super
end
end
@karthiks
karthiks / selenuim_automation_spec_helper.rb
Created April 3, 2012 07:26
Running Automation Scripts - Selenium - without security certificates
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile.assume_untrusted_certificate_issuer = true #false # <-- This is 'The Configuration Line'
end
# Links to untrusted connection issue in different browsers:
# http://code.google.com/p/threadfix/wiki/GettingStartedThreadfixPrivateBeta1
# http://twitpic.com/94zk8t in Chrome Untrusted Connection
# http://twitpic.com/94zl3i in Firefox Untrusted Connection
# http://twitpic.com/94zlje in IE Untrusted Connection
@karthiks
karthiks / ImplementationWithoutStringInquirer.rb
Created May 13, 2012 16:51
Implementation without StringInquirer
class User < ActiveRecord::Base
has_one user_profile, :dependent => :destroy
def admin?
user.user_profile.type.titleize == "Admin"
end
def exhibition_curator?
user.user_profile.type.titleize == "Exhibition Curator"
end
@karthiks
karthiks / ImplementationWithStringInquirer.rb
Created May 13, 2012 17:01
Implementation with StringInquirer
class User < ActiveRecord::Base
has_one user_profile, :dependent => :destroy
delegate :admin?, :artist?, :collector?, :estate?, :exhibition_curator?, :to => :user_profile_type
def user_profile_type
user.user_profile.type.downcase.inquiry
end
end
@karthiks
karthiks / ideal ops.md
Created June 14, 2012 11:57 — forked from elmer/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

@karthiks
karthiks / gist:3009692
Created June 28, 2012 07:34 — forked from michaeldauria/gist:2048022
Migrating from Copycopter to your own instance
Once you have your own instance of copycopter-server running, you need to do the following:
1. Create a new project and take note of its hostname and api key
2. Make sure you are on the latest version of the copycopter_client gem, at the time of this writing it is 2.0.0
3. Export the latest version of your published drafts:
$ RAILS_ENV=production bundle exec rake copycopter:export
@karthiks
karthiks / gist:3012662
Created June 28, 2012 17:24 — forked from dblack/gist:3012525
Behavior of take_while and drop_while without a block
I'm puzzled by the behavior of take_while and drop_while when called without
a block. They return enumerators -- that part I understand -- but I'm not
understanding how those enumerators behave.
Here's what I mean:
>> enum = [1,2,3,4,5].take_while
=> #<Enumerator: [1, 2, 3, 4, 5]:take_while>
>> enum.next
=> 1