gem install vagrant
vagrant box add precise64 http://dl.dropbox.com/u/1537815/precise64.box
vagrant up && vagrant ssh
sudo apt-get -y update && sudo apt-get -y install curl git-core python-software-properties
Custom Apt-Get repo
%table#id_tabla | |
%thead | |
%th Columna 1 | |
%th Columna 2 | |
%tbody | |
%tr | |
%td | |
%label Hola | |
%td | |
%label World |
[color] | |
diff = auto | |
status = auto | |
branch = auto | |
[color "status"] | |
changed = yellow | |
added = green | |
untracked = red |
require 'open3' | |
class PythonRegex | |
extend Open3 | |
def self.calculate_intersection(first_regex, second_regex) | |
popen3('python', 'lib/services/greenery/main.py', first_regex, second_regex) do |stdin, stdout, stderr| | |
if block_given? | |
stdout.read.split("\n").select { |line| line.start_with? yield } | |
else | |
stdout.read.split("\n").each { |line| p line } | |
end |
# simple ruby code example for running python script | |
path_to_script = File.dirname(__FILE__) | |
puts "It's a ruby script" | |
puts "Run python script with backticks" | |
puts "Result is available in caller.ru" | |
puts `python #{path_to_script}/processing.py UserName 37` |
//Access root | |
sudo su - postgres | |
psql postgres | |
//Create user | |
create user el_usuario with password ''; | |
//Giving user permission to create databases | |
ALLTER USER el_usuario CREATEDB; |
These commands are good as of 2011-07-27.
The download/install takes a while so start it first. When it finishes downloading you will still need to run it to complete installation.
Really the nicest choice for a terminal on OSX right now, especially with Lion style full screen support.
Setup the Benchmark | |
[1] pry(main)> require 'benchmark' | |
=> true | |
[2] pry(main)> test_string = "/foo/bar/bah/bing" | |
=> "/foo/bar/bah/bing" | |
String#starts_with? | |
[3] pry(main)> Benchmark.realtime { (1..10000).to_a.each { %r{^/foo}.match(test_string) } } | |
=> 0.009987447 |
# check the comments for @billmann's awesome solution to the same problem | |
def make_hash_one_dimensional(input = {}, output = {}, options = {}) | |
input.each do |key, value| | |
key = options[:prefix].nil? ? "#{key}" : "#{options[:prefix]}#{options[:delimiter]||"_"}#{key}" | |
if value.is_a? Hash | |
make_hash_one_dimensional(value, output, :prefix => key, :delimiter => "_") | |
else | |
output[key] = value | |
end |
##Install elinks | |
##brew install elinks | |
alias fact="elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|" | |
##Jobs that take too long | |
alias funspork="fact && spork" |