How To

"Prevent required .rb files from executing all contained SRC"

puts "outside clause 1"
if __FILE__ == $0
  puts "inside clause"
puts "outside clause 2"

On normal run all three outputs are written. On require ’...’ only first and last outputs are written, i.e. the ones not in the clause.

:: RSYNC ::

sudo rsync -ahrv --progress fgysin@bender:/home/fgysin/bender /media/Totz/save/

Syncs the remote folder /home/fgysin/bender to local /media/Totz/save. Props: archive, human readable output, recursive, verbose, progress output.

:: WGET ::

wget -b -a wget.log --mirror -np
  • -b start in Background
  • -a ... append output to log
  • - -mirror mirror page (recursively, infinite depth)
  • -np dont go up to parents in hierarchy

> Works fine, but Wget is slow and not capable of opening multiple connections, so one is restricted to the (small) bandwith provided from the server to a client.

wget -e robots=off -c --mirror --random-wait -np -U"Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2008092416 Firefox/3.0.3"

+ Disguise as browser, ignore robots.txt, wait randomly...

 wget -e robots=off -c --mirror --random-wait -np -U"Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2008092416 Firefox/3.0.3" -t 5 -P /home/fgysin/sources/web/
+ specify destination folder, limit retries to 5

:: GIT ::

git clone <url>

Clones a git repo into a new directory. Very fast.

git cvsimport -v -d ettercap -C ettercap
  • -v verbose
  • -d set CVSROOT
  • -C set target dit
git svn clone <url>

Grab a remote svn repo and mirror it locally with git.

:: AXEL ::

Get a file really quick with axel... (Multiple connections and stuff.)

 axel -n 20 <url>
get a file from url with 20 parallel connections...

:: GEM ::

Install a ruby lib with:

gem install <name-of-the-gem>

Mind the proxy configuration! (http_proxy and/or HTTP_PROXY should work...)

For installing the nokogiri-Gem one does need some extra libraries:

sudo apt-get install libxml2 libxml2-dev libxslt1-dev
sudo gem install nokogiri

How to install rubygems-1.3.1 on debian based systems:

$ wget
$ tar xzf rubygems-1.3.1.tgz
$ cd rubygems-1.3.1
$ sudo ruby setup.rb

:: WIRBLE ::

Enables tab completion and syntax highlighting for irb.

If you haven’t got tab-completion and syntax coloring in your irb, you owe it to ;yourself to follow these instructions right away (should work for Linux, OS X, ;and Cygwin users). First, install the Wirble gem:
sudo gem install -y wirble
Next, create or edit a file called .irbrc in your home folder (~/.irbrc), and ;make sure these lines are included there:
require 'rubygems'
require 'wirble'

link to instructions

Last changed by admin on 21 April 2009