Dec 30, 2013

Unix as IDE. History

Execute last command again:
sudo !!
echo !! > new_script.sh
!! | grep Linux

Execute last command started with ls:
!ls

Arguments:
ls !^  # first arg of prev cmd
ls !$  # last arg of prev cmd
ls !*  # all args of prev cmd
ls !ls:2  # second arg of prev ls cmd

Execute command with given history number:
!2039

Hide command from history (use space before cmd):
 ls ~/eagle

Dec 28, 2013

User-level threads....... with threads. - Paul Turner - Google

How to use git with gnome-keyring integration

sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

Dec 19, 2013

kernel man 9

make mandocs
make installmandocs

Dec 11, 2013

pyopenssl

Use 
pip install pyopenssl==0.12.0

when you got such exception on Centos 5.9:

$ pip install pyopenssl
Downloading/unpacking pyopenssl
  Downloading pyOpenSSL-0.13.1.tar.gz (254kB): 254kB downloaded
  Running setup.py egg_info for package pyopenssl
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Installing collected packages: pyopenssl
  Running setup.py install for pyopenssl
    building 'OpenSSL.crypto' extension

...........

gcc -pthread -shared build/temp.linux-x86_64-2.6/OpenSSL/rand/rand.o build/temp.linux-x86_64-2.6/OpenSSL/util.o -L/usr/lib64 -lssl -lcrypto -lpython2.6 -o build/lib.linux-x86_64-2.6/OpenSSL/rand.so

building 'OpenSSL.SSL' extension

creating build/temp.linux-x86_64-2.6/OpenSSL/ssl

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c OpenSSL/ssl/connection.c -o build/temp.linux-x86_64-2.6/OpenSSL/ssl/connection.o

OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_context’:

OpenSSL/ssl/connection.c:289: warning: implicit declaration of function ‘SSL_set_SSL_CTX’

OpenSSL/ssl/connection.c: In function ‘ssl_Connection_get_servername’:

OpenSSL/ssl/connection.c:313: error: ‘TLSEXT_NAMETYPE_host_name’ undeclared (first use in this function)

OpenSSL/ssl/connection.c:313: error: (Each undeclared identifier is reported only once

OpenSSL/ssl/connection.c:313: error: for each function it appears in.)

OpenSSL/ssl/connection.c:320: warning: implicit declaration of function ‘SSL_get_servername’

OpenSSL/ssl/connection.c:320: warning: assignment makes pointer from integer without a cast

OpenSSL/ssl/connection.c: In function ‘ssl_Connection_set_tlsext_host_name’:

OpenSSL/ssl/connection.c:346: warning: implicit declaration of function ‘SSL_set_tlsext_host_name’

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/.../app/bin/python2.6 -c "import setuptools;__file__='/home/.../app/build/pyopenssl/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-vBzwJt-record/install-record.txt --single-version-externally-managed --install-headers /home/.../app/include/site/python2.6 failed with error code 1 in /home/.../app/build/pyopenssl
Traceback (most recent call last):
  File "/home/.../app/bin/pip", line 8, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/home/.../app/lib/python2.6/site-packages/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/home/.../app/lib/python2.6/site-packages/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

Dec 5, 2013

Linux I/O Scheduler

Selecting a Linux I/O Scheduler
How do I change I/O scheduler?

cat /sys/block/sda/queue/scheduler
echo noop > /sys/block/sda/queue/scheduler
In /etc/default/grub change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
Then run
sudo update-grub2
and restart.