Показаны сообщения с ярлыком linux. Показать все сообщения
Показаны сообщения с ярлыком linux. Показать все сообщения
вторник, 23 июля 2013 г.
суббота, 13 июля 2013 г.
install mysql on raspberry pi and connect from laptop
$ sudo apt-get update
$ sudo apt-get install apache2 php5 mysql-server
$ sudo apt-get install phpmyadmin
to enable remote connection replace 127.0.0.1 in /etc/mysql/my.conf to real ip
the working application is at http://your_rpi_host/phpmyadmin
or download any application and look at db from it
to add user
$ mysql -u root -p mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'%' IDENTIFIED BY 'dbpassword';
mysql> FLUSH PRIVILEGES;
mysql> CREATE DATABASE foo;
mysql> GRANT ALL ON foo.* TO 'foouser'@'%' IDENTIFIED BY 'PASSWORD';
$ sudo apt-get install apache2 php5 mysql-server
$ sudo apt-get install phpmyadmin
to enable remote connection replace 127.0.0.1 in /etc/mysql/my.conf to real ip
the working application is at http://your_rpi_host/phpmyadmin
or download any application and look at db from it
to add user
$ mysql -u root -p mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'%' IDENTIFIED BY 'dbpassword';
mysql> FLUSH PRIVILEGES;
mysql> CREATE DATABASE foo;
mysql> GRANT ALL ON foo.* TO 'foouser'@'%' IDENTIFIED BY 'PASSWORD';
понедельник, 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
понедельник, 25 февраля 2013 г.
rpm how-to
List all installed packages
# rpm -qa
How do I uninstall rpm packages?
#rpm -e <package name>
How do I install rpm packages?
#rpm -i <package name>
Examples - extract files from rpm
#rpm2cpio php-5.1.4-1.esp1.x86_64.rpm | cpio -idmv
пятница, 7 декабря 2012 г.
RaspberryPi && SDR
1. prepare
#prepare os (there was an old raspbian)
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
sudo raspi-config
#overclock to medium
#don't load DM on start
#minimize video memory
#without this step there were gaps in sound for a half a second every second
#prepare soft
sudo apt-get install git libusb-dev libusb-1.0 libtool cmake pkg-config
git clone git://git.osmocom.org/rtl-sdr.git
2. compile rtl-sdr
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
sudo make install-udev-rules
3. run
rtl_tcp -a 192.168.1.3
4. listen to music
#i've used sdr# (http://sdrsharp.com/) from my laptop
#but it is possible to use rtl_fm and aplay directly from raspi
rtl_fm -f 103700000 -s 48000 -g 9 -l 10 - | aplay -t raw -r 48000 -c 1 -f S16_LE
понедельник, 2 июля 2012 г.
Getting started with Raspberry Pi...
Hardware:
1. Raspberry Pi Model B (+ delivery from element14.com) - 2000RUR
2. Hama кабель HDMI M-M - 310RUR
3. Transcend SDHC Class 10 32GB - 1275RUR
4. Onext universal charger 1000mA - 300RUR
5. HDMI-DVI-D VC-004G - 270RUR
6. USB 2.0 А - microUSB B - 75RUR
---
Total: 4230RUR
Software:
http://distribution.hexxeh.net/raspbian/raspbian-r3.zip
Doesn't work yet. The red pwr lights on, green ok lights then flashes some times then again lights. But no any output on the monitor (Samsung SyncMaster 930BF).
--
UP:
To make the monitor works change confix.txt to
hdmi_force_hotplug=1
hdmi_drive=1
hdmi_group=2
hdmi_mode=35
config_hdmi_boost=1
test_mode=1
--
For no-monitor configuration:
Set config.txt to empty
Find r-pi with Advanced Port Scanner v1.3
connect to ssh with putty
to login use root:hexxeh
If there is no DNS resolvings (fixed in later distribution versions):
the default dns records in /etc/resolv.conf is 8.8.8.4 (google)
I use akado internet provider,
so i need to add DNS-servers of akado:
ns01.comcor-tv.ru (217.10.32.5)
ns02.comcor-tv.ru (217.10.35.5)
dns01.catv.ext.ru (217.10.44.35)
dns02.catv.ext.ru (217.10.36.5)
dns03.catv.ext.ru (217.10.32.4)
dns04.catv.ext.ru (217.10.39.4)
then install some software for development with apt-get
sudo apt-get install mc
среда, 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
вторник, 24 апреля 2012 г.
CryptoPP hang on linux
After porting some code that use cryptopp from windows to slackware linux it hangs.
The hang code:
AutoSeededRandomPool rng(true);
The reason was that AutoSeededRandomPool use /dev/random which blocks until the data become available.
The problem was resolved using default constructor, which use /dev/urandom:
AutoSeededRandomPool rng;
The hang code:
AutoSeededRandomPool rng(true);
The reason was that AutoSeededRandomPool use /dev/random which blocks until the data become available.
The problem was resolved using default constructor, which use /dev/urandom:
AutoSeededRandomPool rng;
понедельник, 9 апреля 2012 г.
Build 2.6.38.8 kernel for Slackware 13.37
extract kernel to /usr/src/linux-2.6.38.8
copy your .config to /usr/src/linux-2.6.38.8
cd to /usr/src/linux-2.6.38.8
make prepare
make scripts
make -j4 modules
make -j4 bzImage
make modules_install
make install
reboot
copy your .config to /usr/src/linux-2.6.38.8
cd to /usr/src/linux-2.6.38.8
make prepare
make scripts
make -j4 modules
make -j4 bzImage
make modules_install
make install
reboot
среда, 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
пятница, 18 ноября 2011 г.
bash howto's 3
#This will remove leading spaces...
echo " 1233 test " | sed 's/^ *//g'
#This will remove trailing spaces...
echo " test 543453 " | sed 's/ *$//g'
#Make the following XML file available under http://127.0.0.1:5555/
(printf "HTTP/1.1 200 OK\\r\\nContent-Type: text/xml\\r\\n"; \
printf "Content-Length: $(cat "response.xml"|wc -c)\\r\\n\\r\\n"; \
cat response.xml") | nc -l -p 5555 >/dev/zero 2>&1 &
понедельник, 14 ноября 2011 г.
Howto make patch
#create patch
diff -Naur ./a ./b >patch.diff#test patch
patch --dry-run -p1 -i patch.diff
#run patch
patch -p1 -i patch.diff
work with usb hid device in slackware
- use libusb to find the device with "lsusb" command
- use libhid to find path to the device report with "lshid"
or detach device with "libhid-detach-device vendorid:productid"
and then call "lsusb -vvv".
- get or set data with
hid_get_input_report
hid_set_output_report
воскресенье, 6 ноября 2011 г.
nginx mp4 streaming with audio stream selection
Tips:
compile nginx with nginx_mod_h254_streaming-2.2.7 module
nginx module debug tips:
-add to nginx.conf
worker_processes 1;
daemon off;
master_process off;
error_log /tmp/were/i/want/see/error.log debug;
-to improove rebuild time modify Makefile in nginx sources
change "rm -rf Makefile objs"
to "rm -rf objs/addon/src/* objs/nginx"
the magic is in mp4_reader.c
вторник, 18 октября 2011 г.
Как установить monodevelop на slackware 13.37
1. установить slapt-get
http://software.jaos.org/slackpacks/13.37/slapt-get/slapt-get-0.10.2l-i386-1.tgz
2. настроить прокси для slapt-get
для этого установить переменные окружения
export http_proxy=http://user:password@host:port
export ftp_proxy=http://user:password@host:port
3. Добавить репозитории для slapt-get
SOURCE=http://repository.slacky.eu/slackware-13.37/:OFFICIAL
SOURCE=http://download.salixos.org/i486/13.37/:PREFERRED
3. Обновить данные из репозиториев
slapt-get --update
4. Убедиться, что monodevelop есть в списке пакетов:
slapt-get --available | grep monodevelop
5. Установить
slapt-get -i monodevelop-2.8-i686-1sl
пятница, 23 сентября 2011 г.
bash howto's 2
#extract from tar.xz
tar -xpJf archive.tar.xz
#setup environment variable
export VAR_NAME="value"
#somewhere use it
VAR_NAME=${VAR_NAME:-"default value"}
echo "$VAR_NAME"
#Запуск команд от имени системных пользователей
#Иногда требуется запустить некую команду, программу или просто проверить права #доступа от имени системных пользователей nobody, apache, и т.д. Простой запуск через
#su - nobody
#Даёт
#This account is currently not available.
#Это происходит из-за того, что у этих пользователей в качестве шела указан /sbin/nologin. #Можно воспользоваться параметром -s для указания другого шела:
su - nobody -s /bin/sh
#И получить нужный результат.
#how to list all disk drives ?
fdisk -l
#Copy a directory (and subdirectories) without .svn files.
rsync -a --exclude=.svn source destination
#Copy directory structure (without files)
find /where/to/search -type d | cpio -pvdm /where/to/copy
#find string in files
grep -lir "qwe"
grep -lir "mod.*" ./log*
find ./ -name log* -exec grep -l qwe {} \;
#bash filename extraction
FILENAME="/some/path/my.file.ext"
echo "Path: ${FILENAME%/*}"
echo "Filename: ${FILENAME##*/}"
echo "Extension: ${FILENAME##*.}"
BASENAME=${FILENAME##*/}
echo "Filename w/o extension: ${BASENAME%.*}"
#find the ten biggest files on your file system linux command
du -a /var | sort -n -r | head -n 10
#Show disk usage under Linux for folder
du -h -s /some/folder/path/*
# delete empty lines
sed "/^$/d" input
# remove spaces
sed 's/ //g'
# remove newline chars
sed 's/\n//g'
# search and replace
sed "s/searchpattern/replacepattern/" input
# find commandline options using sed and grep
URL=$(echo $@ | sed 's:\ :\n:g' | grep "url" | sed 's:\-\-url=::')
#Random string
openssl rand -base64 30
#Returns a list of the number of connections by IP.
netstat -an | grep :80 | awk '{print $5}' | cut -f1 -d":" | sort | uniq -c | sort -n
#Print out a list of open connections on your box and sorts them by according to IP address
netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n
#Print the number of established and listening connections to your server on port 80 per each IP address
netstat -plan|grep :80|grep -E "(EST|LIST)"|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
#Get Public IP and copy it to Clipboard
#!/bin/bash
MYIP=`curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.\.]*\).*/\1/g'`
echo $MYIP | pbcopy
/usr/local/bin/growlnotify 'IP address copied' -m "Address was: $MYIP"
#backup
sudo su
cd /
tar cvpjf /tmp/backup.tar.bz2 --exclude=/proc --exclude=/tmp --exclude=/dev --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/sys /
#http://www.catonmat.net/blog/sed-one-liners-explained-part-one/
#http://sed.sourceforge.net/sedfaq4.html
#http://sed.sourceforge.net/sed1line.txt
#http://tdistler.com/2009/04/17/sed-regular-expression-find-lines-not-matching-a-string
#Substitute (find and replace) only the last occurrence of "foo" with "bar".
sed 's/\(.*\)foo/\1bar/'
#Substitute all occurrences of "foo" with "bar" on all lines that DO NOT contain "baz".
sed '/baz/!s/foo/bar/g'
#Substitute all occurrences of "foo" with "bar" on all lines that contain "baz".
sed '/baz/s/foo/bar/g'
#extract language
cat $F | grep "Stream" | sed "s/ //g" | cut -f 1 -d ":" | sed "/.*(.*).*/!s/.*/und/g" | sed "s/^.*(\(.*\))$/\1/"
#echo full path to command
echo $0
echo "$0" | sed "s|^./|$(pwd)/|"
which ffmpeg
which ffmpeg | sed "s|^./|$(pwd)/|"
#/usr/local/bin/get-ip-address
/sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }'
среда, 7 сентября 2011 г.
services in slackware
service scripts located at:
/etc/rc.d
/etc/init.d
add start call at /etc/rc.d/rc.M or /etc/rc.d/rc.local
for example:
if [ -x /etc/rc.d/rc.nginx ]; then
. /etc/rc.d/rc.nginx start
fi
Подписаться на:
Комментарии (Atom)