Grabbing whole site using wget

Recently, I needed an off-line copy of some documentation, available only as web pages. That's how I managed to clone entire parts of websites using wget.

First of all, the whole command I used:

wget -U "Mozilla/5.0 (X11; U; Linux; en-US; rv:1.9.1.16) Gecko/20110929 Firefox/3.5.16" \
--recursive --level=1 --no-clobber --page-requisites --html-extension \
--convert-links --no-parent \
--wait=3 --random-wait \
http://www.example.com/docs/interesting-part/ --domains=www.example.com

Basic arguments

These are the basic arguments needed to perform the recursive download.

--recursive
Tells wget to recursively download pages, starting from the specified ...

awstatic.sh - Generate static awstats reports

This is the script I use to generate static reports from awstats

#!/bin/bash

## (C)2010 Samuele Santi
## License: GPL v3 or later
## Date: 2010-02-23

STATIC_DEST="/var/www/awstats/static"

cat > "$STATIC_DEST/index.html" << EOF
<html><head><title>AWSTATS - Static</title></head><body>
<h1>AWSTATS - Static Statistics</h1>
<ul>
EOF

for conf in $( ls /etc/awstats/ | grep "^awstats\..*\.conf\$" | sed "s/^awstats\.\(.*\).conf\$/\1/" ); do
    echo "Generating static pages for $conf ..."
    if [ ! -e "${STATIC_DEST}/${conf}" ]; then
        mkdir -p "${STATIC_DEST}/${conf}"
    fi
    /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl \
        -awstatsprog=/usr/lib/cgi-bin/awstats.pl \
        -dir="${STATIC_DEST}/${conf}" \
        -config="$conf" -buildpdf ...

Convert FLV video to MP3 audio

Many times we download a song we like from YouTube, or other sites, as a FLV video. But how to convert it to a regulare audio-only MP3 file? Here is a nice solution I found on the net, using FFMPEG.

The syntax of the command is:

ffmpeg [[infile options][-i infile]]... {[outfile options] outfile}

So, to convert a flv video to mp3, we could use something like:

$ ffmpeg -i filename.flv -acodec mp3 -ac 2 -ab 128 -vn -y filename.mp3

Explanation of options

-i filename
Specifies the input file name
-ac 2
Specifies the number of audio channels to ...

Automatic screenshot + upload

#!/bin/bash

#
# Auto-screenshot taker
#
# Uses xsnap and ssh to take snapshot of a region or window
# and upload it to a remote server to quickly share it.
#
# Copyright (C) 2009  Samuele ~redShadow~ Santi - Under GPL v3
# Please visit : http://www.hackzine.org
#

# TODO find a better way to handle ssh key request
# we assume that you're using ssh-agent and have the key registered,
# otherwise there could be some problems / unknown behaviours

# Also, on Xfce, adding a launcher with "Run in terminal" flag on
# does the job since terminal is launched in background..

# Or, there is some programs that ask ...

SVG Image Tiler

Here it is a small Bash script I wrote in order to easily "cut out" and rasterize to PNG parts from a SVG file.

Download the script here: svgtiler.sh.

It uses Inkscape for all the conversion part.

Usage

  • Define the grid dimensions: tile width/height and amount of vertical/horizontal tiles.
  • For each of the interesting tiles (specified by using row an column number), call Inkscape to cut out and render the selected area from the SVG image, to a given destination file.

Arguments

-f filename.svg
Specify the input file name
-t, --tile rows cols
Specify the selected ...

Page 1 / 1