Tmux default key bindings

Shell Script (Bash) posted 10 days ago by christian

Tmux key bindings:

   1  Ctrl-b c Create new window
   2  Ctrl-b d Detach current client
   3  Ctrl-b l Move to previously selected window
   4  Ctrl-b n Move to the next window
   5  Ctrl-b p Move to the previous window
   6  Ctrl-b & Kill the current window
   7  Ctrl-b , Rename the current window
   8  Ctrl-b % Split the current window into two panes
   9  Ctrl-b q Show pane numbers (used to switch between panes)
  10  Ctrl-b o Switch to the next pane
  11  Ctrl-b ? List all keybindings
  12  
  13  Ctrl-b n (Move to the next window)
  14  Ctrl-b p (Move to the previous window)
  15  Ctrl-b l (Move to the previously selected window)
  16  Ctrl-b w (List all windows / window numbers)
  17  Ctrl-b (Move to the specified window number, the default bindings are from 0 – 9)
  18  
  19  Ctrl-b % (Split the window vertically)
  20  Ctrl-b : “split-window” (Split window horizontally)
  21  Ctrl-b : “break-pane” (Make pane its own window)
  22  Ctrl-b o (Goto next pane)
  23  Ctrl-b q (Show pane numbers, when the numbers show up type the key to goto that pane)
  24  Ctrl-b { (Move the current pane left)
  25  Ctrl-b } (Move the current pane right)
  26  
  27  Ctrl-b : resize-pane (By default it resizes the current pane down)
  28  Ctrl-b : resize-pane -U (Resizes the current pane upward)
  29  Ctrl-b : resize-pane -L (Resizes the current pane left)
  30  Ctrl-b : resize-pane -R (Resizes the current pane right)
  31  Ctrl-b : resize-pane 20 (Resizes the current pane down by 20 cells)
  32  Ctrl-b : resize-pane -U 20 (Resizes the current pane upward by 20 cells)
  33  Ctrl-b : resize-pane -L 20 (Resizes the current pane left by 20 cells)
  34  Ctrl-b : resize-pane -R 20 (Resizes the current pane right by 20 cells)
  35  Ctrl-b : resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells)
  36  Ctrl-b : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells)

From here

Tagged tmux

How to prevent Capistrano from asking for password when deploying

Ruby on Rails posted about 1 month ago by christian

Capistrano might ask for a password when:

   1  # Capistrano is using sudo, so set it to false
   2  set :use_sudo, false
   3  
   4  # Your remote server is trying to checkout an SSH protected Git repository
   5  set :repository, '/var/git/repositories/xxx.git' # Remote server also holds the git repository
   6  set :local_repository, 'ssh://xxx/var/git/repositories/xxx.git' # Your development machine points to the remote machine 
   7  
   8  # SSH settings, also see ~/.ssh/config
   9  set :user, "jebus"
  10  set :domain, 'xxx.com'
  11  set :port, 666
  12  
  13  # Other settings worth checking
  14  ssh_options[:forward_agent] = true
  15  ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")]
  16  default_run_options[:pty] = true # see http://www.mail-archive.com/capistrano@googlegroups.com/msg07323.html for details

Reference

How to setup a password-less “cap deploy” with Capistrano

Tagged capistrano, ssh, password

Grouping with group_by

Ruby posted about 1 month ago by christian

   1  @groups = @products.group_by { |product| product.name.mb_chars[0].downcase.to_s }.sort

If you’re using mb_chars, remember to call “to_s” or you won’t get what you expect.

Tagged group_by

Git: "fatal: protocol error: bad line length character:"

Shell Script (Bash) posted about 1 month ago by christian

Git might give you this fine error

   1  fatal: protocol error: bad line length character:

Looks like git didn’t receive the response it expected from your server.

Possible causes:

  • Did you put some echo commands in e.g. ~/.bashrc on the remote server?
Tagged git, bash

Recursive find and delete on OSX

Shell Script (Bash) posted about 1 month ago by christian

Sed will croak on OSX. Use Perl instead.

Replace HoptoadNotifier with Airbreak:

   1  perl -e "s/HoptoadNotifier/Airbreak/g;" -pi $(find . -type f)

On Linux sed might work:

   1  # Find, backup and replace
   2  find . -name "*.rb" -print | xargs sed -i.bak 's/HoptoadNotifier/Airbreak/g'
   3  # Delete backup files
   4  find . -name '*.bak' -type f -delete

Reference.

Tagged search, replace, sed, osx