štvrtok 23. decembra 2010
piatok 10. decembra 2010
Rizling Rynsky polosladke - Malik 2009
piatok 3. decembra 2010
MP3 stream to local mp3 file.
cvlc http://listen.di.fm/public3/djmixes.pls --sout "#duplicate{dst=std{access=file,mux=raw,dst=/moj/mp3/di_20101203.mp3}"
streda 26. mája 2010
Gmail checker > LPT diode indicator
cat ./check.sh
#!/bin/bash
gmail_login="********"
gmail_password="********"
mails="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ "$mails" -gt "0" ];
then
for ((i = 0; i < 10; i++)) do
/tmp/lpt/lpt_advance 1;
sleep 0.8;
/tmp/lpt/lpt_advance 0;
sleep 0.5;
done
/tmp/lpt/lpt_advance 1
else
/tmp/lpt/lpt_advance 0
fi
exit
##################
Where /tmp/lpt/lpt_advance is binary compiled from source:
cat lpt_advance.c
/*
* * Simple parallel port output control program for Linux
* * Written and copyright by Tomi Engdahl 1998
* * (e-mail: tomi.engdahl@hut.fi)
* *
* * The program output the data value to PC parallel port data pins
* * (default lpt1 I/O address 0x378). The data values are given as the
* * command line parameter to the program. The number can be
* * in decimal (0..255) or hexadecimal format (0x00..0xFF).
* *
* */
#include
#include
#include
#include
#define base 0x378 /* printer port base address */
main(int argc, char **argv)
{
int value;
if (argc!=2)
fprintf(stderr, "Error: Wrong number of arguments. This program needs one argument which is number between 0 and 255.For example running ./lptout 0xFF will turn all data pins to 1 and running ./lptout 0x00 will turn all data pins to 0.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
if ((value<0)>255))
fprintf(stderr, "Error: Invalid numeric value. The parameter number must be between 0 and 255\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Error: Couldn't get the port at %x\n", base), exit(1);
outb((unsigned char)value, base);
}
#!/bin/bash
gmail_login="********"
gmail_password="********"
mails="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*
if [ "$mails" -gt "0" ];
then
for ((i = 0; i < 10; i++)) do
/tmp/lpt/lpt_advance 1;
sleep 0.8;
/tmp/lpt/lpt_advance 0;
sleep 0.5;
done
/tmp/lpt/lpt_advance 1
else
/tmp/lpt/lpt_advance 0
fi
exit
##################
Where /tmp/lpt/lpt_advance is binary compiled from source:
cat lpt_advance.c
/*
* * Simple parallel port output control program for Linux
* * Written and copyright by Tomi Engdahl 1998
* * (e-mail: tomi.engdahl@hut.fi)
* *
* * The program output the data value to PC parallel port data pins
* * (default lpt1 I/O address 0x378). The data values are given as the
* * command line parameter to the program. The number can be
* * in decimal (0..255) or hexadecimal format (0x00..0xFF).
* *
* */
#include
#include
#include
#include
#define base 0x378 /* printer port base address */
main(int argc, char **argv)
{
int value;
if (argc!=2)
fprintf(stderr, "Error: Wrong number of arguments. This program needs one argument which is number between 0 and 255.For example running ./lptout 0xFF will turn all data pins to 1 and running ./lptout 0x00 will turn all data pins to 0.\n"), exit(1);
if (sscanf(argv[1],"%i",&value)!=1)
fprintf(stderr, "Error: Parameter is not a number.\n"), exit(1);
if ((value<0)>255))
fprintf(stderr, "Error: Invalid numeric value. The parameter number must be between 0 and 255\n"), exit(1);
if (ioperm(base,1,1))
fprintf(stderr, "Error: Couldn't get the port at %x\n", base), exit(1);
outb((unsigned char)value, base);
}
sobota 13. marca 2010
nedeľa 24. januára 2010
change year timestamp on all files in dir
#!/bin/bash
#change year on files
#created by Rado
ls -l |grep -v total |while read prava malecislo user grupa cislo datum cas subor; do
#echo $datum
YY=`echo $datum|cut -d - -f 1`
MM=`echo $datum|cut -d - -f 2`
DD=`echo $datum|cut -d - -f 3`
HH=`echo $cas|cut -d : -f 1`
min=`echo $cas|cut -d : -f 2`
# change only files from year 2008
if [ "$YY" = 2008 ]; then
# Change 09 to year wich is requested, where 09 is 2009
touch -t 09$MM$DD$HH$min $subor
echo "changed file:" $subor $YY
else
echo "not valid file" $subor $YY
fi
done
#change year on files
#created by Rado
ls -l |grep -v total |while read prava malecislo user grupa cislo datum cas subor; do
#echo $datum
YY=`echo $datum|cut -d - -f 1`
MM=`echo $datum|cut -d - -f 2`
DD=`echo $datum|cut -d - -f 3`
HH=`echo $cas|cut -d : -f 1`
min=`echo $cas|cut -d : -f 2`
# change only files from year 2008
if [ "$YY" = 2008 ]; then
# Change 09 to year wich is requested, where 09 is 2009
touch -t 09$MM$DD$HH$min $subor
echo "changed file:" $subor $YY
else
echo "not valid file" $subor $YY
fi
done
Prihlásiť na odber:
Príspevky (Atom)