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 ...

Drupal crons run script

This is the script I use to run cronjobs on all the sites in a given Drupal installation:

#!/bin/bash

#
# Drupal sites cronjob runner. Useful to be put into crontab.
# samu 2009-12-06
#

## --- Configuration ---
CONF_SITES="/usr/local/etc/drupal-sites" # sites list
CONF_LOGDIR="/var/log/drupal-cron" # logs dir
## --- End Config ---

# load sites list, stripping lines that are empty or starting by #
SITES="$(cat "$CONF_SITES" |grep -ve "^$\|^[^A-Za-z0-9]*#")"

# create log directory if not exists
if [ ! -e "$CONF_LOGDIR" ] ; then
  echo " * Creating log directory: $CONF_LOGDIR"
  mkdir -p "$CONF_LOGDIR"
fi

# prepare logfile name
LOGFILE="$CONF_LOGDIR/drupal-cron_$( date "+%Y-%m-%d" ).log"

# Run all cronjobs
echo "--- Drupal ...

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