MAL - Memória Auxiliar do Lutieri

quarta-feira, setembro 30, 2009

Crontab header ou cabeçalho

copied from http://www.velvetcache.org/2008/01/10/easy-crontab-header



1
2
3
4
5
6
7
# +--------- Minute (0-59)                    | Output Dumper: >/dev/null 2>&1
# | +------- Hour (0-23) | Multiple Values Use Commas: 3,12,47
# | | +----- Day Of Month (1-31) | Do every X intervals: */X -> Example: */15 * * * * Is every 15 minutes

# | | | +--- Month (1 -12) | Aliases: @reboot -> Run once at startup; @hourly -> 0 * * * *;
# | | | | +- Day Of Week (0-6) (Sunday = 0) | @daily -> 0 0 * * *; @weekly -> 0 0 * * 0; @monthly ->0 0 1 * *;
# | | | | | | @yearly -> 0 0 1 1 *;

# * * * * * COMMAND |

quinta-feira, setembro 17, 2009

Hylafax - Cups Backend

#!/bin/sh
# constants
SENDMAIL="/usr/sbin/sendmail"
PS2ASCII="/usr/bin/ps2ascii"
AWK="/bin/awk"
SENDFAX="/usr/bin/sendfax"

# make up a temporary file
FAXFILE=/tmp/sambafax.$$

##echo $6 >> /tmp/sambafax.log
##echo "fui executado as " `date` >> /tmp/sambafax.log

# now dump the to-be faxewd data (PS fdormat) to the temp file
cat $6 >${FAXFILE}

# retrieve the faxnumber from the printfile
# the silly three x's are added because some awk strugle with an immediate CR
# we use a PS to ascii pipe to strip (most of) the Postscript controls
FAXNUM=`${PS2ASCII} ${FAXFILE} | ${AWK} '{ IGNORECASE=1 } /FAX-Nr ?: ?[0-9-]*/ \
{ $0=$0 "xxx"; \
gsub(/-/,""); \
anfang=match($0,/ ?: ?/); \
anfang=anfang+match(substr($0,anfang),/[0-9]/)-1; \
ende=match(substr($0,anfang),/[^0-9]/)-1; \
printf ("%s",substr($0,anfang,ende)) \
}' `

# if faxnumber is found fax the tempfile
# we donot check the validity of the faxnumber, let sendfax do this...
if [ -z ${FAXNUM} ] ; then
##echo "Fax Number not found" >> /tmp/sambafax.log
exit 1
else
${SENDFAX} -n -d ${FAXNUM} ${FAXFILE}
## echo "status: " `echo $?` >> /tmp/sambafax.log
## echo "enviou" >> /tmp/sambafax.log
fi

# remove the temp file
rm -f ${FAXFILE}

# end of show



This is the original file used with lp, instead of cups:
http://www.hylafax.org/content/Sambafax

Marcadores: ,

terça-feira, setembro 08, 2009

MySQL Privileges

mysql> grant all privileges on BANCODEDADOS.* to CRIEUMNOMEPARAUMUSUARIO@localhost identified by 'DIGITEUMASENHA';

mysql> flush privileges;

Marcadores:

sexta-feira, setembro 04, 2009

Setting the charset through Apache

By default, apache will ignore the META tags specifying a charset. To avoid this take a look in httpd.conf:

# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default. To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
#AddDefaultCharset UTF-8

Marcadores:

quarta-feira, setembro 02, 2009

WHERE do MySQL case-insensitive

SELECT * FROM pozycje Where UCASE(poz_nazwa) Like UCASE("%greg%")

which effectively makes string comparisons case insensitive despite the
Binary character set chosen.


http://bytes.com/topic/mysql/answers/592865-case-insensitive-search-mysql

Marcadores:



Chat with Lutieri G. B.

Subscribe in a reader