Как создавать дочерние темы в вордпрессе: тут.
Category: tech
PuppetDB + NginX proxy with SSL + auth
On PuppetDB server:
server { server_name puppetdb.example.com; listen 8082; ssl on; ssl_certificate /etc/puppetdb/ssl/public.pem; ssl_certificate_key /etc/puppetdb/ssl/private.pem; ssl_client_certificate /etc/puppetdb/ssl/ca.pem; ssl_verify_client on; ssl_ciphers SSLv2:-LOW:-EXPORT:RC4+RSA; ssl_session_timeout 5m; location / { proxy_pass http://localhost:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
On Puppet server:
[main] server = puppetdb.example.com port = 8082
Split big archive when creating it with tar (multi tape backup)
Create 6 tapes of 500GB:
#Create tar --tape-length=524288000 -cM -f 3/dn1.tar -f 4/dn1.tar -f 5/dn1.tar -f 6/dn1.tar -f 7/dn1.tar -f 8/dn1.tar 1/ #Extract
Supposing we uses split command, then if at least one file corrupted - restore archive will be not possible. If we uses splitting method providing by TAR - they will be extracted, except those who been placed in corrupted tape.
#Create tar czf - ./backup | split -d -b 10m - backup.tar.gz. #Extract cat backup.tar* | tar xzf -
Monitor the progress of dd
kill -USR1 $(pgrep ^dd)
Grep tail flow
tail -f file | grep --line-buffered my_pattern
Сколько сатоши в биткоине?
Чтоб не искать потом.
= 0.00000001 ฿ | ||
= 0.00000010 ฿ | ||
= 0.00000100 ฿ | = 1 Bit / μBTC (you-bit) | |
= 0.00001000 ฿ | ||
= 0.00010000 ฿ | ||
= 0.00100000 ฿ | = 1 mBTC (em-bit) | |
= 0.01000000 ฿ | = 1 cBTC (bitcent) | |
= 0.10000000 ฿ | ||
= 1.00000000 ฿ |
rename files batch in bash
for i in *.pp ; do mv "$i" "${i/ut/ai}" ; done
Рандомный запуск puppet agent
cron { "puppet": ensure => present, command => "/usr/bin/puppet agent --onetime --no-daemonize --logdest syslog > /dev/null 2>&1", user => 'root', minute => [fqdn_rand(30), fqdn_rand(30) + 30] }
Find file and replace content with sed
find . -type f -exec sed -i 's/old/new/g' {} \;
MajorDoMo + nginx
Адаптация правил из .htaccess MajorDoMo для nginx.
server { listen *:80; server_name brain, brain.example.com; index index.html index.htm index.php; access_log /var/log/nginx/brain.example.com_access.log; error_log /var/log/nginx/brain.example.com.ua_error.log; location / { root /var/www/brain; try_files $uri $uri/ @smarthome; } location ~ \.php$ { root /var/www/brain; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; } location @smarthome { fastcgi_pass unix:/var/run/php5-fpm.sock; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/brain/nf.php; fastcgi_param SCRIPT_NAME /nf.php; fastcgi_param QUERY_STRING $args; } }