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
def next_id(arr) | |
return 0 if arr && arr.size == 0 | |
return 1 if arr.inject(&:+) == 0 | |
arr = arr.uniq.sort | |
arr.each_with_index do |n, i| | |
return i unless n == i | |
end | |
arr.last + 1 |
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
sudo aptitude install curl git-core ruby build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf |
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/expect | |
spawn passwd [lindex $argv 0] | |
set password [lindex $argv 1] | |
expect "password:" | |
send "$password\r" | |
expect "password:" | |
send "$password\r" | |
expect eof |
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
echo -e "linuxpassword\nlinuxpassword" | passwd linuxuser |
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 'random_data' | |
require 'spec' | |
describe "random data" do | |
it "should be unique" do | |
prev = RandomUtils.random_email | |
(1..100000).each do |n| | |
email = RandomUtils.random_email |
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
cat /etc/issue |
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/bash | |
apt-get update | |
apt-get -y install curl git-core | |
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) | |
apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion | |
source /root/.bashrc | |
rvm install 1.9.3 | |
rvm use 1.9.3 --default |
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/bash | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A | |
gpg -a --export CD2EFD2A | sudo apt-key add - | |
echo 'deb http://repo.percona.com/apt lucid main' >> /etc/apt/sources.list | |
echo 'deb-src http://repo.percona.com/apt lucid main' >> /etc/apt/sources.list | |
apt-get update | |
apt-get -y install percona-server-server-5.5 | |
apt-get install -y apache2-prefork-dev libapr1-dev apache2 | |
apt-get install -y libcurl4-openssl-dev |
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
source 'http://rubygems.org' | |
RAILS_VERSION = '3.2.1' | |
gem 'actionpack', RAILS_VERSION | |
gem 'activesupport', RAILS_VERSION | |
gem 'railties', RAILS_VERSION | |
gem 'rails', RAILS_VERSION # Unfortunately, needed for `heroku run console` | |
# For attributes in non-dm models (will be a dependency of future DM versions) |
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
rails new webdb -m http://railswizard.org/77171980b8637239194c.rb -J -O -T |