How to avoid the problem with XmlHTTPrequest headers

server_name yoursweetdomain.com;
set $cors "";
if ($http_origin ~* (.*\.yoursweetdomain.com)) { set $cors "true"; }
location / {
if ($cors = "true") {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type'; }

if ($request_method = OPTIONS) { return 204; } } }

Change vim default colorscheme

just create ~/.vimrc

" color scheme of the moment:
syntax on
colorscheme koehler

how to find files newer than exact data?

 find ./ -type f -newer somfiles | xargs ls -rtlh

How to transfer data much faster than RSYNC ?

On the server (receiver)

 socat TCP-LISTEN:4444 - | tar xvf - 

On the client (sender)

 tar cvf - /mnt/somefolder | socat - TCP:a0032n1:4444    

mysqldump to another host

 mysqldump dbanme | ssh user@1.1.1.1  'cat > /tmp/dbname.sql'

Shell. negative in FIND

 find . ! -user www

How to get particular database from mysqldump which was made with –all-database option ?

Assume, you made a mysqldump which consists all databases (with –all-database option), how to restore from that mysqldump the necessary database?
Solution is really simple!

mysql --one-database db_name < alldatabases.sql

Linux. How to customize the process output

For example, I’d like to know how long the processes have been running, for that purpose you can use the STIME variable:

ps -eo pid,user,cmd,stime

Some of useful columns:
PPID — pid of parent process;
%CPU — cpu utilization in percent
%MEM — part of RAM(real memory) which consumed by the process
VSZ — Virtual size of process (kilobytes)
RSS — amount of 1K pages
STIME — the process time start
S or STAT — status of process
PRI — priority
NI — nice
TIME — how much time of cpu does the process take
CMD или COMMAND — command

How to delete many millions of files in directory

cd /mnt/folder; find . -type f -exec rm -rf {} \;
cd /mnt/test_dir/ ; ls -f . | xargs -n 100 rm

-f – do not sort of list files

The VMware doesnt work on the kernel 3.10.x What is workaround?

Workaround:

cd /tmp
curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmblock-9.0.2-5.0.2-3.10.patch
curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmnet-9.0.2-5.0.2-3.10.patch
cd /usr/lib/vmware/modules/source
tar -xvf vmblock.tar
tar -xvf vmnet.tar
patch -p0 -i /tmp/vmblock-9.0.2-5.0.2-3.10.patch
patch -p0 -i /tmp/vmnet-9.0.2-5.0.2-3.10.patch
tar -cf vmblock.tar vmblock-only
tar -cf vmnet.tar vmnet-only
rm -rf vmblock-only
rm -rf vmnet-only
vmware-modconfig --console --install-all

It works!