вторник, 24 мая 2011 г.

bamf problem with gcc 4.6

by default in gcc 4.6 -Werror=unused-but-set-variable

and the build error appeared


bamf-view.c In the function ‘bamf_view_set_property’:
bamf-view.c:543:13: error: variable self is definet but not used



workaround for  archlinux
open  pkgbuild.sh
and add following string  before configure
sed -i 's/CFLAGS="$CFLAGS -Wall -Werror -lm"/CFLAGS="$CFLAGS -Wall -lm"/' configure



понедельник, 16 мая 2011 г.

using ssh-agent

ssh-agent очень удобная штука когда надо работать с ssh  на куче машин, особенно если ваши приватные ключи закрыты паролем.

запускается просто на локальной машине
ssh-agent
на выводе будет что-то  типа
SSH_AUTH_SOCK=/tmp/ssh-aKKXoDyN1761/agent.1761; export SSH_AUTH_SOCK;
SSH_AGENT_PID=1762; export SSH_AGENT_PID;


копируем все это в  .profile или в любой ваш подгружаемый при логине сценарий

далее добавляем ключи

ssh-add  ~/.ssh/id_dsa
вводим пароль на ключ

и все можно передвигаться между серверами не набирая каждый раз пароль на ключ

некоторые примечания что бы "магия" работала:



в файле /etc/ssh/ssh_config
должна быть опция
ForwardAgent yes

на промежуточных серверах используемых как точки доступа, должны быть приватные  ключи  для переходов дальше.



среда, 20 апреля 2011 г.

command line hints

one line magic ;)

loop command

while true; do sleep 3 ; ls -Flh|grep -v total;  done

make a lot of files with random input

while true; do    dd if=/dev/urandom of=tmp.$RANDOM.txt  count=200;  done



check md5
MD5=`md5 -q blabla ` && if [ $MD5 = 66f1a2dc15218b64023fc566fe51f39a ];  then;  echo ok ; else; echo false; fi

check open port
echo -n "GET / HTTP/1.0\r\n\r\n" | nc localhost 80 
or
echo -n "\r\n" | nc  localhost 80 > /dev/null  && echo ok || echo false

воскресенье, 20 февраля 2011 г.

суббота, 12 февраля 2011 г.

some awk magic

по мотивам http://bashshell.net/stream-filtering-utilities/exercise-1-learning-awk-basics/

записать вывод  в файл

ps aux > processes

вывести весь файл
awk ‘{ print }’ processes

вывести первый столбец
awk ‘{ print $1}’ processes


вывести столбец 3 и 5 в строках соответствующих шаблону httpd
awk ‘/httpd/  {print $3,$5}’ processes


найти строки где в 11  столбце слова(в нашем случае процессы) начинаются с "s" или "с"
awk ‘$11 ~ /^[sc]/’  processes


пример:

root     13880  0.0  0.2   1816   612 ?        Ss   Feb08   0:00 syslogd -m 0
root     13977  0.0  0.6   9300  1680 ?        Ss   Feb08   0:00 sendmail: accepting connections
root     14031  0.0  0.4   4492  1104 ?        Ss   Feb08   0:00 crond
root     15857  0.0  1.1  10032  2900 ?        Ss   12:02   0:00 sshd: 




вторник, 25 января 2011 г.

autoconf error

при сборке пакетов php5-extension вылезла ошибка

autoconf: required version 2.68 not found

далее список пакетов на обновление что бы она исчезла


libtool
libltdl
autoconf
automake
automake-wrapper
autoconfig-wrapper


воскресенье, 23 января 2011 г.

mysql hints


проблема:
mysqldump: Got error: 23: Out of resources when opening file './bigtest/table_4543646.MYD' (Errcode: 24) when using LOCK TABLES

решение:
mysqldump --single-transaction

проблема репликации:
Slave SQL: Error 'Duplicate entry '11902' for key 'PRIMARY'' on query. Default database: 'bigtest'. Query: 'INSERT INTO table_1000061 set num=592121', Error_code: 1062

решение:
пока из решений только валить таблицу и заливать заново.

----

заливка данных из binary log
mysqlbinlog hostname-bin.001 | mysql news_database 
данные из базы test
mysqlbinlog --database=test   hostname-bin.001 | mysql news_database


----
repair всех таблиц
mysqlcheck -r dbname -uuser -ppass

----
MyISAM repair
myisamchk --silent --force --fast --update-state /var/db/mysql/dbname/*.MYI
 
----
MyISAM "is not a MyISAM-table"  error
REPAIR TABLE tablename  USE_FRM

понедельник, 17 января 2011 г.

git tips

git push

error message
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.


solution:
git config --bool core.bare true