1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/bash # samu 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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/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 [ ! |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/bin/bash # # Send to twitter a message. # # Copyright (C) 2009 - Samuele ~redShadow~ Santi - Under GPL v3 # Please visit : http://www.hackzine.org # # Just run this script to be asked for a message to publish on your twitter. # Twitter login informations are asked at the first run of the script, and # then saved into ~/.twitter-login for future use. # if [ -e ~/.twitter-login ]; then TWITTLOGIN="$( cat ~/.twitter-login )" else TWITTLOGIN="$( Xdialog --stdout --title "Twittit" --inputbox "Insert twitter login:" 0 0 "login:pass" )" echo "$TWITTLOGIN" > ~/.twitter-lo |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/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-agend and have the key registered # else, 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 |
Ecco qua uno scriptino bash che ho realizzato per "ritagliare" comodamente delle immagini da un file SVG e convertirle automaticamente in PNG.
Il tutto in BashScript, appoggiandomi su Inkscape..
Il funzionamento è molto semplice: vengono definite le dimensioni della "griglia", altezza e larghezza delle tile e numero in verticale e orizzontale. quindi, definiti gli id delle tile interessanti (specificati come righe/colonne) lo script procede chiamando inkscape per esportare le parti utili dell'immagine in un dato percorso di destinazione.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/bash # # SVG Image Tiler - transform SVG images into PNG tiles # Copyright (C) 2009 Samuele ~redShadow~ Santi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/bash # # FileName cleaner - v0.1 # Replaces all special chars from filenames, allowing only use of: # letters, numbers, underscore, dash, dot. # Converts also UTF-8 characters to their "similar" ASCII-128 char. # # (c)2009 Samuele ~redShadow~ Santi - <redshadow@hackzine.org> - Under GPL # # TODO find a way to remove in-name extra dots. # We don't just need to leave the last dot, since there are files # such as .tar.gz and .tar.bz2 with "double-extension" # # TODO make it work recursively on dirs (..a bit dangerous..) # # ATTENTION: Do NOT use on complex p |
Quante volte capita di avere a che fare con file di varia provenienza a cui l'autore si è sbizzarrito a dare nomi assurdi contenenti, oltre a spazi, perfino caratteri in utf-8 ecc..?
Questo script serve per cercare di rimettere un po' a posto le cose, sostituendo spazi con underscore, lettere accentate con lettere "normali", ecc..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/bin/bash # # Script to create Drupal Modules # by Samuele ~redShadow~ Santi # http://hackzine.org # if [ "$1" != "" ]; then modname="$1" else echo "Usage: $0 <modulename> [<core>]"; exit 0 fi if [ "$2" != "" ]; then dcore="$2" else dcore="6.x" fi gpl=" /* * $modname - A Drupal $dcore module * Copyright (C) `date +%Y` ${USER}@${HOSTNAME} * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of th |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #!/bin/bash # # archive.sh - A fast archiver, useful for making snapshots # Copyright (C) 2008 Samuele ~redShadow~ Santi # http://hackzine.org # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY |
Pubblico anche altri due script comodi che ho realizzato:
archive.sh
Scriptino bash per creare velocemente archivi di backup di una cartella, includendo nel nome del file data e ora
http://doku.hackzine.org/scripts/archive
bulkchmod.sh
Script per cambiare velocemente e ricorsivamente i permessi su file/cartelle con un comando del tipo
bulkchmod 755 644 /path/to/files
http://doku.hackzine.org/scripts/bulkchmod