Amazon S3 and ruby with fog

This little script lists all keys of directories (buckets in S3) and files (objects). Just to get a grip with fog (https://github.com/geemus/fog)…

connection = Fog::Storage.new(
  :provider                 => 'AWS',
  :aws_secret_access_key    => "",
  :aws_access_key_id        => ""
)

dirs = connection.directories
dirs.each do |dir|
  puts "+ " + dirname = dir.key
  files = dirs.get(dirname).files
  files.each do |file|
    puts "  - " + file.key
  end
end
Advertisements

ZSH and versioning systems

Since oh-my-zsh didn’t work properly with ruby I had do remove it and all the nifty stuff went with it… So i was looking for a quick fix:

First I wanted to have the directory visible, i wrote this to the left:
PROMPT=”%n@%m:%F{6}%~ %F{11}%# “

Then I loaded vcs_info to get the information from git and put it to the right, that’s all I need:
autoload -Uz vcs_info
setopt PROMPT_SUBST
precmd() { vcs_info }
RPROMPT=’%F{4}${vcs_info_msg_0_} ${vcs_info_msg_1_}’
setopt AUTO_CD

It’s enough for me to work.