Skip to content

Instantly share code, notes, and snippets.

View wonjun27's full-sized avatar
🎯
Focusing

Won Jun Bae wonjun27

🎯
Focusing
View GitHub Profile
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@zooniverse
zooniverse / aws_boot_script.rb
Created January 24, 2011 14:23
Have this file run when your machine boots
#!/home/ec2-user/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
require 'rubygems'
require 'aws/s3'
require 'fileutils'
AWS::S3::Base.establish_connection!(
:access_key_id => 'access_key',
:secret_access_key => 'secret_key'
)
@karmi
karmi / tophashes-sliding-window-redis.sh
Created December 7, 2010 10:06
Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
# Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
redis-cli del tophashes:2010-12-07-08-00
redis-cli del tophashes:2010-12-07-09-00
redis-cli del tophashes:current
echo '=== 8:00 AM ==='
@zooniverse
zooniverse / aws_bundle.rb
Created November 10, 2010 13:45
Git archive and bundle to S3
Capistrano::Configuration.instance(:must_exist).load do
# example execution 'cap bundle_app -s version=HEAD'
desc "Bundle code and push to S3"
task :bundle_app do
puts "Starting Git archive of #{version}"
`git archive -o oldweather.tar #{version}`
`gzip oldweather.tar`
s3_upload
clean_up