how to search in google cache

How to avoid the problem with XmlHTTPrequest headers

set $cors "";
if ($http_origin ~* (.*\ { 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@  '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