awstatic.sh - Generate static awstats reports

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

Link sharer on Drupal

I just wanted something like the "share on facebook" button, but to post links on my (this) blog. I thought I would have to write a module to do that but.. no, Drupal itself allows us to do that directly :)

First, the CCK "Bookmark" Content

First of all, I created a CCK content named "bookmark". Here is the exported CCK code.
Download Bookmark CCK here

Second: the "bookmark" button

Yep, I copied this from the facebook "SHARE IT" button.. :)

Natouren New Theme

New theme for the under-development http://natouren.eu!

Convert FLV video to MP3 audio

flv - /> mp3

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:

PowerAdmin for drupal - now on Drupal.org

PowerDNS

I'm proud to announce that the Drupal administration module for PowerDNS I was writing is now available on Drupal.org at the address http://drupal.org/project/poweradmin.

Register APT repository key

Here is an useful script to register APT keys, to avoid the "There are no public key available for the following key IDs" warning message.

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
 
# samu 2010-01-01
# (c) 2010 Samuele ~redShadow~ Santi
# redshadow&hackzine.org - http://www.hackzine.org
# Under Gnu GPL v3
 
KEYID="$1"
 
echo "Registering APT key $1..."
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys "$KEYID"
gpg –export –armor "$KEYID" | apt-key add -

Happy new year!

HAPPY 2010!

drupal-module-from-svn.sh

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
#!/bin/bash
 
# (c)2009 Samuele ~redShadow~ Santi <redshadowAThackzineDOTorg>
# Under GPL v3
# Please visit: http://www.hackzine.org
 
# Download from: http://svn.hackzine.org/misc/scripts/drupal/drupal-module-from-svn.sh
 
# samu 2009-12-30
 
MODNAME="$1"
SVNREPO="$2"
 
if [ "$MODNAME" == ""  ] || [  "$SVNREPO" == "" ]; then
  echo "Usage: $0 <modname> <svnrepo>"
  exit 1
fi
 
CDATE="$( date +%s )"
ORIGPWD="$( pwd )"
 
TEMPDIR="/tmp/.drupal-module-${MODNAME}-${CDATE}"
mkdir -p "$TEMPDIR"
cd "$TEMPDIR"
echo "Exporting $SVNREPO -> $MODNAME"
svn export "$SVNREPO" "./$MODNAME"

Minimal LUKS Guide

NOTE This is a really short guide, to be used only by users with some experience of LUKS
fdisk /dev/sdx
cryptsetup -y --cipher aes-cbc-essiv:sha256 --key-size 256 luksFormat /dev/sdx1
cryptsetup luksOpen /dev/sdx1 crypt_sdx1
mkfs.ext3 -m 0 -j -O dir_index,filetype,sparse_super /dev/mapper/crypt_sdx1
tune2fs -m 0 -c 0 -i 0 -L label /dev/mapper/crypt_sdx1
mount /dev/mapper/crypt_sdx1 /mnt/crypt_sdx1
umount /dev/mapper/crypt_sdx1
cryptsetup luksClose crypt_sdx1

drupal-crons.sh

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 [ !
Condividi contenuti

Who Am I?

~redShadow~ A.K.A. Samuele Santi is an Italian Open Source developer, currently working as a freelance developer, mainly in the web applications sector. Favourite programming languages: PHP and, of course, Python!

como lake rovers (1) cryptography (1) debian (1) apt (1) Drupal Forms (1) database (3) awstats (3) address book (2) contact manager (1) development (11) Drupal (21) archive (1) documentation (2) doku (1) aoe (1) code (3) audio (1) backup (3) curl (1) e-mail (2) algorythms (1) blender (3) circuits (1) apache (1) bash (11) caos (1) 2v (1) debug (1) C++ (2) cocktails (1) blogroll (7) camera mia (1) arduino (1) cars (1) alcool (1) dmcrypt (1) citroen (1) aircrack (1) 3d (3) cartoons (1)