пятница, 18 мая 2012 г.

How to install readline for python ?

Some time ago I needed to run 'sudo easy_install readline' on my Ubuntu 11.04 machine.
But I had an error message.

For resolving that problem you should install the following packages:
- python2.7-dev (if python 2.7 is installed)
- libncurses5-dev

and try to run again the command:
sudo easy_install readline

пятница, 11 мая 2012 г.

Как узнать в git, на какой тег у вас сейчас переключена рабочая копия ?


На помощь приходит команда:
git log --decorate

Результатом будет что-то похожее на это:

commit a8662ef8bf021ea349dbf56970fd9f62f97093fb (HEAD, tag: test-live-0.0.2, tag: live-0.0.2)
Author: Vasya Pupkin <v.pupkin@gmail.com>
Date:   Fri May 11 09:25:15 2012 +0300

    Some message

commit 43a6228d4bf5839aa934b541c35d19b897b35056 (tag: live-0.0.1)
Author: Vasya Pupkin <v.pupkin@gmail.com>
Date:   Thu May 10 17:47:23 2012 +0300

    Some message



Если же вы сейчас свичнуты на один из коммитов ветки мастер, то вы увидите что-то такое:

commit ab39d94c48d4ef31bb2dbe16bce77c389c2c3c4d (HEAD, origin/master, origin/HEAD, master)
Author: Vasya Pupkin <v.pupkin@gmail.com>
Date:   Fri May 11 10:46:55 2012 +0300

    Some message

commit a8662ef8bf021ea349dbf56970fd9f62f97093fb (tag: test-live-0.0.2, tag: live-0.0.2)
Author: Vasya Pupkin <v.pupkin@gmail.com>
Date:   Fri May 11 09:25:15 2012 +0300

    Some message

commit 43a6228d4bf5839aa934b541c35d19b897b35056 (tag: live-0.0.1)
Author: Vasya Pupkin <v.pupkin@gmail.com>
Date:   Thu May 10 17:47:23 2012 +0300

    Some message

среда, 25 апреля 2012 г.

Как заархивировать файлы в Linux с сохранением прав доступа к файлам ?


Команда tar умеет архивировать файлы с сохранением прав доступа к файлам.


Нужно вместо
tar -czf archive.tar.gz directory
написать
tar -cpzf archive.tar.gz directory

А при распаковке тоже указать параметр "p":
tar -xzpf archive.tar.gz

http://www.aota.net/forums/showthread.php?t=21329

среда, 21 марта 2012 г.

Как скопировать группу файлов в определенном порядке ?

Я являюсь счастливым обладателем mp3-плеера iRiver T60.
А у него, как оказалось (несколько лет пользовался и не знал!) есть такая особенность, что он воспроизводит файлы в том порядке, в котором они были записаны, а не как-либо еще.
Это важно, если вы слушаете аудио-книги.

Решением проблема стала команда подобного типа:

find . -type f |sort|xargs -L 1 cp --parents --target-directory=/media/T60/Music/Books/ErikBern

В данном примере я копирую рекурсивно все файлы из текущей директории в директорию /media/T60/Music/Books/ErikBern строго в порядке, в котором файлы были отсортированы с помощью команды sort.

P.S.: I like Linux.

пятница, 9 марта 2012 г.

Very useful "core.sharedRepository" property in config file of Git repository for sharing repository with another users

The quote from 'git help config':


core.sharedRepository
When group (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable). When all (or world or everybody), the repository will be readable by all users, additionally to being group-shareable. When umask (or false), git will use permissions reported by umask(2). When 0xxx, where 0xxx is an octal number, files in the repository will have this mode value.  0xxx will override user’s umask value (whereas the other options will only override requested parts of the user’s umask value). Examples: 0660 will make the repo read/write-able for the owner and group, but inaccessible to others (equivalent to group unless umask is e.g.  0022). 0640 is a repository that is group-readable but not group-writable. See git-init(1). False by default.