This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl genrsa -des3 -out server.key 4096 | |
openssl req -new -key server.key -out server.csr | |
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt | |
openssl rsa -in server.key -out server.key.insecure | |
mv server.key server.key.secure | |
mv server.key.insecure server.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install postgresql | |
initdb /usr/local/var/postgres -E utf8 | |
psql -h localhost postgres | |
gem install passenger | |
brew install --env=std nginx --with-passenger | |
# start | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: curl -kL https://raw.github.com/gist/3343750/HASH/install.sh | bash | |
# git dependencies | |
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel | |
# so we can compile git | |
yum install -y gcc gcc-c++ | |
# now download git from github | |
# https://github.com/git/git/downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Editor.ElementView = Em.View.extend({ | |
classNameBindings: ['isSelected'], | |
isSelected: function() { | |
var selectedElement = Editor.selectedElementController.get('content'), | |
content = this.get('content'); | |
if(selectedElement === content) { return true; } | |
}.property('Editor.selectedElementController.content', 'content'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
puts "\npatchlevel: #{RUBY_PATCHLEVEL}, release_date: #{RUBY_RELEASE_DATE}, ruby_version: #{RUBY_VERSION}, ruby_platform: #{RUBY_PLATFORM}\n" | |
n = 1000000 | |
Benchmark.bm do |x| | |
x.report("assign single") { n.times do; c = 'a string'; end} | |
x.report("assign double") { n.times do; c = "a string"; end} | |
x.report("assign interp") { n.times do; c = "a #{n} string"; end} | |
x.report("concat single") { n.times do; 'a string ' + 'b string'; end} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
require 'vagrant' | |
# require 'nokogiri' | |
FileUtils.mkdir_p 'tmp' | |
env = Vagrant::Environment.new(:cwd => File.expand_path('tmp')) | |
Dir.chdir 'tmp' do | |
env.cli 'init', 'CentOS-5.7-build' | |
end | |
env.cli 'up' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
@xml = Nokogiri open 'http://vault.centos.org/5.6/os/x86_64/repodata/comps.xml' | |
def printGroups(default = true) | |
puts "=== #{'Non' unless default}Default Groups ===" | |
@xml.xpath("//default[text()='#{default}']/..").each_with_index do |group, ix| | |
puts "#{ix + 1}.) #{group.at_xpath('name').text}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp .git/hooks/pre-commit.sample .git/hooks/pre-commit && curl https://gist.github.com/raw/799683/9be5fe0b49db3c98886ba93f994d850713e3eab3/pre-commit > .git/hooks/pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Check Ruby syntax and run the test suites | |
files=`git diff --cached --name-only` | |
for file in $files; do | |
if [[ ${file##*.} = 'rb' ]]; then | |
ruby -c $file | |
elif head -1 $file | grep 'ruby$'; then | |
ruby -c $file | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Check Ruby syntax and run the test suites | |
exit 1 unless | |
system('git diff --cached --name-only | grep "\(Rakefile\|\.rb$\)" | xargs ruby -c') && | |
system('rake ci') |