Показаны сообщения с ярлыком debian. Показать все сообщения
Показаны сообщения с ярлыком debian. Показать все сообщения
вторник, 11 июня 2013 г.
GoogleReader replacement with RaspberryPi + rss2email + cron + GMail
1. Install rss2email
sudo apt-get install rss2email
2. Configure rss2email
#It stores things in ~/.rss2email
r2e new email-example@gmail.com
cat <<EOF >~/.rss2email/config.py
HTML_MAIL = 1
DATE_HEADER = 1
DEFAULT_FROM = "email-example@gmail.com"
FORCE_FROM = 1
SMTP_SERVER= "smtp.gmail.com"
AUTHREQUIRED=1
SMTP_SEND = 1
SMTP_USER = "email-example@gmail.com"
SMTP_PASS = 123456
SMTP_SSL = 1
TRUST_GUID=1
EOF
3. Import subscriptions
Use Google Takeaway to get a copy of your Reader subscription data.
#import to rss2email
r2e opmlimport subsciptions.xml
#get list of subsciptions
r2e list
4. Fetch data
#fetch rss data but don't send. we are already had read them
r2e run --no-send
#some time later fetch to get new ones
r2e run
5. Automate
#the better way is to use cron to automaticaly fetch each 2 time in hour
sudo crontab -u user1 -e
#add this line and save
*/30 * * * * r2e run
6. Some useful rss2email commands
r2e add http://www.example.com/feed/
r2e opmlexport > subscriptions.xml
r2e list
r2e delete 123
7. In gmail create filters for you feeds.
понедельник, 8 апреля 2013 г.
Compiling kernel 3.4 on debian wheezy
sudo apt-get install kernel-package fakeroot build-essential
mkdir ~/tmp
cd ~/tmp
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.4.tar.bz2
tar xvf linux-3.4.tar.bz2
cd linux-3.4/
cat /boot/config-`uname -r`>.config
make oldconfig
If your current kernel is 3.3.5 the questions that await are given at the bottom of this post with links to descriptions of the different options. As usual, if in doubt, just hit enter.
make-kpkg clean
Building takes ages (depending on number of cores committed), so don't launch it at 4 pm on a Friday if you need to shut down your computer before going home... As usual, use the -jX switch for parallel builds, where X is the number of cores+1 (i.e. 4 cores => -j5)
The following command goes on a single line
time fakeroot make-kpkg -j5 --initrd --revision=3.4.0 --append-to-version=-amd64 kernel_image kernel_headers
Once the build is done, move the .deb files out of the way and to your linux-3.4 directory for safe-keeping
mv ../*3.4.0*.deb .
sudo dpkg -i *.deb
mkdir ~/tmp
cd ~/tmp
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.4.tar.bz2
tar xvf linux-3.4.tar.bz2
cd linux-3.4/
cat /boot/config-`uname -r`>.config
make oldconfig
If your current kernel is 3.3.5 the questions that await are given at the bottom of this post with links to descriptions of the different options. As usual, if in doubt, just hit enter.
make-kpkg clean
Building takes ages (depending on number of cores committed), so don't launch it at 4 pm on a Friday if you need to shut down your computer before going home... As usual, use the -jX switch for parallel builds, where X is the number of cores+1 (i.e. 4 cores => -j5)
The following command goes on a single line
time fakeroot make-kpkg -j5 --initrd --revision=3.4.0 --append-to-version=-amd64 kernel_image kernel_headers
Once the build is done, move the .deb files out of the way and to your linux-3.4 directory for safe-keeping
mv ../*3.4.0*.deb .
sudo dpkg -i *.deb
(c) from here
среда, 6 июня 2012 г.
LXDE for Astra linux
1. add repository
~#cat >>/etc/apt/sources.list << EOF
deb http://mirror.yandex.ru/debian/ sid contrib non-free
EOF
2. update repository
~#apt-get update
3. install packages
~#apt-get install lxde
~#cat >>/etc/apt/sources.list << EOF
deb http://mirror.yandex.ru/debian/ sid contrib non-free
EOF
2. update repository
~#apt-get update
3. install packages
~#apt-get install lxde
среда, 14 марта 2012 г.
HTML parsing with Perl
#useful libraries
apt-get install libwww-perl
apt-get install libfile-slurp-perl
apt-get install libjson-xs-perl
для работы с базой данных
apt-get install libdbi-perl
apt-get install libdbd-sqlite-perl
#header and link modules
#!/usr/bin/perl -w
use strict;
use warnings;
use utf8;
require JSON::XS;
use HTML::Entities;
require LWP::UserAgent;
use HTML::TreeBuilder;
use File::Slurp;
use URI::Escape;
use Encode;
use DBI qw(:sql_types);
#to get modules versions
print "CGI::VERSION ".$CGI::VERSION."\n";
print "JSON::XS::VERSION ".$JSON::XS::VERSION."\n";
print "HTML::Entities::VERSION ".$HTML::Entities::VERSION."\n";
print "LWP::UserAgent::VERSION ".$LWP::UserAgent::VERSION."\n";
print "HTML::TreeBuilder::VERSION ".$HTML::TreeBuilder::VERSION."\n";
print "File::Slurp::VERSION ".$File::Slurp::VERSION."\n";
print "URI::Escape::VERSION ".$URI::Escape::VERSION."\n";
print "Encode::VERSION ".$Encode::VERSION."\n";
print "DBI::VERSION ".$DBI::VERSION."\n";
#for utf-8
binmode(STDIN, ":encoding(utf-8)");
binmode(STDOUT, ":encoding(utf-8)");
#variables
$theVariable;
@theArray;
%theHash;
#to download the html page
sub get_url
{
my $url = "http://www.ya.ru";
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my @ns_headers =
(
'User-Agent' => "Mozilla/5.0",
'Accept' => '*/*',
'Accept-Charset' => 'utf-8,*',
'Accept-Language' => 'ru-RU',
);
my $response = $ua->get("$url", @ns_headers);
if($response->is_success)
{
my $decoded_content = $response->decoded_content;
return $decoded_content;
}
else
{
return $response->status_line;
}
}
#to search in html tree
sub search_parse($$)
{
die "Wrong number of args" if (scalar(@_) != 2);
my($search_url, $content) = @_;
my $root = HTML::TreeBuilder->new_from_content($content);
print $search_url;
my $search_results = $root->look_down(
'_tag' => 'div',
'class' => qr//,
sub
{
$_[0]->attr('class') =~ /search_results_last/;
}
);
my @items2;
if($search_results)
{
my @elements = $search_results->look_down(
'_tag' => 'div',
'class' => 'element'
);
for my $element (@elements)
{
$element->dump();
print "---------------\n";
}
}
}
#for work with sqlite, the good howto:
# from http://2lx.ru/2009/04/working-with-sqlite-in-perl/
#!/usr/bin/perl -w
# Пример работы с СУБД SQLite в Perl
use DBI;
@user_names = ("Alex", "Arthur", "Boris", "Bred", "Clay", "Caren"); # массив пользователей, которых будем сохранять в базу данных
$db = DBI->connect("dbi:SQLite:dbname=users.db","","",{AutoCommit => 0}); # подключаемся к базе данных. Если файла users.db не существует, то он будет создан автоматически
$db->{unicode} = 1;
$db->do("create table users (user_name text);"); # Создаем новую таблицу в базе данных
foreach my $user (@user_names){
my $query = $db->do("INSERT INTO users VALUES('$user')");
$query > 0 ? print "$user added\n" : print "$user not added\n"; # если в результате запроса затронуто больше 0 рядов, значит запрос выполнен успешно, а если нет, то неудачно.
}
#$db->rollback;
$db->commit;
print "-"x10,"\n";
# Получаем количество записей, которые будут возвращены запросом
#($query) = $db->selectrow_array("SELECT count(*) FROM users WHERE (user_name LIKE 'A%')");
$query = $db->prepare("SELECT count(*) FROM users WHERE (user_name LIKE 'A%')");
$query->execute() or die($db->errstr);
($users_count) = $query->fetchrow_array;
print "Query will return $users_count records\n\n";
# --------------------------------------------------------------
$query = $db->prepare("SELECT * FROM users WHERE (user_name LIKE 'A%')"); # Формируем запрос на выборку
$query->execute() or die($db->errstr); # Выполняем запрос. В случае неаозможности выполнения запроса умираем с выводом причины
#
while (($user) = $query->fetchrow_array()){
print $user."\n";
}
$db->disconnect; # отключаемся от базы данных
apt-get install libwww-perl
apt-get install libfile-slurp-perl
apt-get install libjson-xs-perl
для работы с базой данных
apt-get install libdbi-perl
apt-get install libdbd-sqlite-perl
#header and link modules
#!/usr/bin/perl -w
use strict;
use warnings;
use utf8;
require JSON::XS;
use HTML::Entities;
require LWP::UserAgent;
use HTML::TreeBuilder;
use File::Slurp;
use URI::Escape;
use Encode;
use DBI qw(:sql_types);
#to get modules versions
print "CGI::VERSION ".$CGI::VERSION."\n";
print "JSON::XS::VERSION ".$JSON::XS::VERSION."\n";
print "HTML::Entities::VERSION ".$HTML::Entities::VERSION."\n";
print "LWP::UserAgent::VERSION ".$LWP::UserAgent::VERSION."\n";
print "HTML::TreeBuilder::VERSION ".$HTML::TreeBuilder::VERSION."\n";
print "File::Slurp::VERSION ".$File::Slurp::VERSION."\n";
print "URI::Escape::VERSION ".$URI::Escape::VERSION."\n";
print "Encode::VERSION ".$Encode::VERSION."\n";
print "DBI::VERSION ".$DBI::VERSION."\n";
#for utf-8
binmode(STDIN, ":encoding(utf-8)");
binmode(STDOUT, ":encoding(utf-8)");
#variables
$theVariable;
@theArray;
%theHash;
#to download the html page
sub get_url
{
my $url = "http://www.ya.ru";
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my @ns_headers =
(
'User-Agent' => "Mozilla/5.0",
'Accept' => '*/*',
'Accept-Charset' => 'utf-8,*',
'Accept-Language' => 'ru-RU',
);
my $response = $ua->get("$url", @ns_headers);
if($response->is_success)
{
my $decoded_content = $response->decoded_content;
return $decoded_content;
}
else
{
return $response->status_line;
}
}
#to search in html tree
sub search_parse($$)
{
die "Wrong number of args" if (scalar(@_) != 2);
my($search_url, $content) = @_;
my $root = HTML::TreeBuilder->new_from_content($content);
print $search_url;
my $search_results = $root->look_down(
'_tag' => 'div',
'class' => qr//,
sub
{
$_[0]->attr('class') =~ /search_results_last/;
}
);
my @items2;
if($search_results)
{
my @elements = $search_results->look_down(
'_tag' => 'div',
'class' => 'element'
);
for my $element (@elements)
{
$element->dump();
print "---------------\n";
}
}
}
#for work with sqlite, the good howto:
# from http://2lx.ru/2009/04/working-with-sqlite-in-perl/
#!/usr/bin/perl -w
# Пример работы с СУБД SQLite в Perl
use DBI;
@user_names = ("Alex", "Arthur", "Boris", "Bred", "Clay", "Caren"); # массив пользователей, которых будем сохранять в базу данных
$db = DBI->connect("dbi:SQLite:dbname=users.db","","",{AutoCommit => 0}); # подключаемся к базе данных. Если файла users.db не существует, то он будет создан автоматически
$db->{unicode} = 1;
$db->do("create table users (user_name text);"); # Создаем новую таблицу в базе данных
foreach my $user (@user_names){
my $query = $db->do("INSERT INTO users VALUES('$user')");
$query > 0 ? print "$user added\n" : print "$user not added\n"; # если в результате запроса затронуто больше 0 рядов, значит запрос выполнен успешно, а если нет, то неудачно.
}
#$db->rollback;
$db->commit;
print "-"x10,"\n";
# Получаем количество записей, которые будут возвращены запросом
#($query) = $db->selectrow_array("SELECT count(*) FROM users WHERE (user_name LIKE 'A%')");
$query = $db->prepare("SELECT count(*) FROM users WHERE (user_name LIKE 'A%')");
$query->execute() or die($db->errstr);
($users_count) = $query->fetchrow_array;
print "Query will return $users_count records\n\n";
# --------------------------------------------------------------
$query = $db->prepare("SELECT * FROM users WHERE (user_name LIKE 'A%')"); # Формируем запрос на выборку
$query->execute() or die($db->errstr); # Выполняем запрос. В случае неаозможности выполнения запроса умираем с выводом причины
#
while (($user) = $query->fetchrow_array()){
print $user."\n";
}
$db->disconnect; # отключаемся от базы данных
четверг, 23 февраля 2012 г.
установка и настройка debian 6.0.4
# get the installer
debian-6.0.4-i386-xfce+lxde-CD-1.iso
# add to /etc/apt/sources.list
#main
deb http://ftp.ru.debian.org/debian squeeze main contrib non-free
deb-src http://ftp.ru.debian.org/debian squeeze main
#multimedia
deb http://www.debian-multimedia.org stable main
deb ftp://ftp.debian-multimedia.org stable main
deb http://www.debian-multimedia.org testing main
deb ftp://ftp.debian-multimedia.org testing main
# Main packages
deb http://debian.mirror.vu.lt/debian/ stable main contrib non-free
deb-src http://debian.mirror.vu.lt/debian/ stable main contrib non-free
# Debian Backports
deb http://debian.mirror.vu.lt/debian-backports/ squeeze-backports main contrib non-free
# Debian Updates / ex-volatile
deb http://debian.mirror.vu.lt/debian/ stable-updates main contrib non-free
# Debian Security updates
deb http://debian.mirror.vu.lt/debian-security/ stable/updates main contrib non-free
deb-src http://debian.mirror.vu.lt/debian-security/ stable/updates main contrib non-free
# install soft
apt-get update
apt-get install mc
apt-get install vsftpd
/etc/init.d/vsftpd restart
# configure default editor for mc
update-alternatives --config editor
apt-get install google-chrome-stable
apt-get install mercurial
apt-get install meld
# libraries for perl
apt-get install libwww-perl
apt-get install libfile-slurp-perl
apt-get install libjson-xs-perl
debian-6.0.4-i386-xfce+lxde-CD-1.iso
# add to /etc/apt/sources.list
#main
deb http://ftp.ru.debian.org/debian squeeze main contrib non-free
deb-src http://ftp.ru.debian.org/debian squeeze main
#multimedia
deb http://www.debian-multimedia.org stable main
deb ftp://ftp.debian-multimedia.org stable main
deb http://www.debian-multimedia.org testing main
deb ftp://ftp.debian-multimedia.org testing main
# Main packages
deb http://debian.mirror.vu.lt/debian/ stable main contrib non-free
deb-src http://debian.mirror.vu.lt/debian/ stable main contrib non-free
# Debian Backports
deb http://debian.mirror.vu.lt/debian-backports/ squeeze-backports main contrib non-free
# Debian Updates / ex-volatile
deb http://debian.mirror.vu.lt/debian/ stable-updates main contrib non-free
# Debian Security updates
deb http://debian.mirror.vu.lt/debian-security/ stable/updates main contrib non-free
deb-src http://debian.mirror.vu.lt/debian-security/ stable/updates main contrib non-free
# install soft
apt-get update
apt-get install mc
apt-get install vsftpd
/etc/init.d/vsftpd restart
# configure default editor for mc
update-alternatives --config editor
apt-get install google-chrome-stable
apt-get install mercurial
apt-get install meld
# libraries for perl
apt-get install libwww-perl
apt-get install libfile-slurp-perl
apt-get install libjson-xs-perl
Подписаться на:
Комментарии (Atom)