:::: MENU ::::

Monthly Archives / January 2017

  • Jan 26 / 2017
  • 0

Some Apache servers do activate the DirectoryIndex so you can easily go through the directories listing over HTTP and download some files. It’ s often used for giving possibility to people to download multiple releases for a package/software.
But in some cases, it can be useful to download the content of a full tree view.

This can be done by using a simple tool available by default on Linux (can be downloaded on Windows/Mac): wget

Let’s take an example!

Without proxy

We want to download all the files on https://pkg.mywebsite.eu/releases/ which contains all the latest releases of our preferred soft.

wget -r -np -nH --cut-dirs=1 -l 15 -R index.html https://pkg.mywebsite.eu/releases/

Here, we are using many options to say to wget what we want to do:

  • -rTurn on recursive retrieving (max 5)
  • -np : Do not ever ascend to the parent directory when retrieving recursively
  • -nH –cut-dirs=1 : Disable generation of host-prefixed directories, and remove 1 level (here, remove “pkg.mywebsite.eu” and create a “releases” dir)
  • -l 15 Change default depth for downloading to 15 levels (default is 5)
  • -R index.html : Specify comma-separated lists of file name suffixes or patterns to reject

With proxy

Let’s now add a complexity, this server is only available through a proxy to protect the content. The proxy is available on your localhost ( on port 3128 (default port for Squid Proxy):

wget -r -np -nH --cut-dirs=1 -l 15 -R index.html  -e use_proxy=yes -e http_proxy= https://pkg.mywebsite.eu/releases/

Here, we just added 2 options to be able to send exactly the same request but using proxy:

  • -e use_proxy=yesExecute command to enable proxy
  • -e http_proxy= command to give URL to use for HTTP proxy


  • Jan 02 / 2017
  • 0

iTerm – Automatic mutliple panes with AppleScript

It’s often very useful to automate opening of multi panes with iTerm to execute many commands or getting access to many servers at the same time. This can be done through AppleScript.

You can copy this script and save it as multi-panes.scpt

#! /usr/bin/osascript

-- List actions to perform
set actions to {¬
	{action:"echo 'I am the window 1'"}, ¬
	{action:"echo 'I am the window 2'"}, ¬
	{action:"echo 'I am the window 3'"}, ¬
	{action:"echo 'I am the window 4'"}, ¬
	{action:"echo 'I am the window 5'"}, ¬
	{action:"echo 'I am the window 6'"}, ¬
	{action:"echo 'I am the window 7'"}, ¬
	{action:"echo 'I am the window 8'"} ¬
-- Count number of actions
set num_actions to count of actions

-- Set cols and lines
set num_cols to round (num_actions ^ 0.5)
set num_lines to round (num_actions / num_cols) rounding up

-- Start iTerm
tell application "iTerm"
	# Create new tab
	tell current window
		create tab with default profile
	end tell
	-- Prepare horizontal panes
	repeat with i from 1 to num_lines
		tell session 1 of current tab of current window
			if i < num_lines then
				split horizontally with default profile
			end if
		end tell
	end repeat
	-- Prepare vertical panes
	set sessid to 1
	repeat with i from 1 to num_lines
		if i is not 1 then set sessid to sessid + num_cols
		if i is not num_lines or num_actions is num_cols * num_lines then
			set cols to num_cols - 1
			set cols to (num_actions - ((num_lines - 1) * num_cols)) - 1
		end if
		repeat with j from 1 to (cols)
			tell session sessid of current tab of current window
				split vertically with default profile
			end tell
		end repeat
	end repeat
	-- Execute actions
	repeat with i from 1 to num_actions
		tell session i of current tab of current window
			write text (action of item i of actions)
		end tell
	end repeat
end tell

Then, you just have to call the script directly:

# osascript multi-panes.scpt

And here is what you’re getting:

Feel free to add/remove/update the actions as needed!

Question ? Contact