Centos Python Installation Guide with no Pain

Install Python on Centos 7 with make altinstall and without pain. Read more…

Test design and implementation.

Test design Our test system has a pretty simple configuration, so I do not want to bother you with the detailed description of it. Simply – it’s just a standalone execution of a test.py file with all requirements (test setup and tear down) in local internal test utility. Helper local utility has a usual amount of preparation functions, test data loading and some other configurations. In the very end of test loading, it just compares a node-set result of “real” scan (software and hardware nodes in a database after the scan) with predefined node-set (from test.py). Node set we usually expect at the end of the test should be added by the developer when product discovery pattern is ready orShort Read more…

Python и vk execute = 40 тысяч постов за 3 минуты!

Да, сучка, это Python и vk execute! Собрать 39000 постов за 3 минуты! Закончил очередную партию парсеров, теперь этот парсер умеет делать сбор постов несколько быстрее, чем раньше. В прошлый раз, одними только силами Python while – мне удалось спарсить стену с 39 тысячами постов минимум за 15-20 минут, при этом с вероятностью в 50% поймать timeout error и запускать все заново или дробить сбор постов по дате или кол-ву. Вуаля, упорство и немного логики: Get posts from wall from VK wall.get Posts present: 39143| Runs: 20| Iters: 20| Offset of posts is: 2000 Posts present: 39143| Runs: 20| Iters: 20| Offset of posts is: 4000 Posts present: 39143| Runs: 20| Iters: 20| Offset of posts is: 6000 Posts present:Short Read more…

Django + apache2 + mod_wsgi

This is conf file to allow apache run Django applications. # Web site at /var/www/smm_tools # Python scripts at /var/www/smm_tools/smm_py #LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so <VirtualHost *:80> ServerName smm.www.trianglesis.org.ua ServerAlias www.smm.www.trianglesis.org.ua ServerAdmin it@www.trianglesis.org.ua DocumentRoot /var/www/smm_tools/ ErrorLog “|/usr/sbin/rotatelogs /var/log/smm_tools/cargo.error.%Y-%m-%d.log 86400” CustomLog “|/usr/sbin/rotatelogs /var/log/smm_tools/cargo.access.%Y-%m-%d.log 86400” combined ServerSignature On Alias /css/ “/var/www/smm_tools/site/css” Alias /js/ “/var/www/smm_tools/site/js/” Alias /templates/ “var/www/smm_tools/site/templates/” Alias /fonts/ “/var/www/smm_tools/fonts/” #WSGIScriptAlias / /var/www/smm_tools/smm_tools.wsgi #WSGIPythonPath /var/www/smm_tools <Directory /var/www/smm_tools/smm_py/smm_py> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess smm_tools python-path=/var/www/smm_tools/smm_py:/usr/local/lib/python3.4/site-packages/ WSGIProcessGroup smm_tools WSGIScriptAlias / /var/www/smm_tools/smm_py/smm_py/wsgi.py </VirtualHost> Use these links: https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04 https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ Don’t forget to use correct IPs – domains, and addresses. Especially if proxy pass is used.     Read more…

Plone installation

Will try to use Plone CMS for test cases, interesting to see what and how CMS on Python worked. Start here: https://plone.org/documentation/manual/installing-plone/installation-quick-guide For Python: Guide and I’ve use only one part from it here. I’ve done everything as guided above. [root@web Python-2.7.6]# ls -ltr /usr/bin/python* -rwxr-xr-x. 2 root root 4864 Jan 22 2014 /usr/bin/python2.6 -rwxr-xr-x. 2 root root 4864 Jan 22 2014 /usr/bin/python lrwxrwxrwx. 1 root root 6 Nov 2 15:46 /usr/bin/python2 -> python [root@web Python-2.7.6]# ls -ltr /usr/local/bin/python* -rwxr-xr-x. 1 root root 6214493 Apr 20 11:44 /usr/local/bin/python2.7 -rwxr-xr-x. 1 root root 1674 Apr 20 11:48 /usr/local/bin/python2.7-config [root@web Python-2.7.6]# echo $PATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin [root@web Python-2.7.6]# which python /usr/bin/python [root@web Python-2.7.6]# sudo sh sh-4.1# which python /usr/bin/python sh-4.1# python Python 2.6.6 (r266:84292, Jan 22 2014,Short Read more…

High CPU usage VMWare ESXi 5.5

Использование CPU в определенный момент начинало превышать допустимые нормы, сервер зависал и не отвечал ни на какие команды, виртуальные машины продолжали работать. CPU использовался на 80% самим хостом, быстрая проверка esxtop показала, что все ресурсы съел ProFTPD Выключаем его нафиг в настройках “Security Profile” в “vSphere ” А потом и вовсе удаляем при помощи: esxcli software vib remove -n ProFTPD Все стало на свои места: 8:28:16pm up 12 min, 484 worlds, 4 VMs, 5 vCPUs; CPU load average: 0.04, 0.05, 0.00 PCPU USED(%): 1.6 60 1.7 1.9 AVG: 16 PCPU UTIL(%): 1.1 100 0.0 0.3 AVG: 25 ID GID NAME NWLD %USED %RUN %SYS %WAIT %VMWAIT %RDY %IDLE %OVRLP %CSTP %MLMTD %SWPWT 9278 9278 esxtop.37720 1 129.05 99.93 0.00 0.00 -Short Read more…

Lorem ipsum dolor sit amet

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pharetra nunc id varius tempor. Pellentesque pretium tellus et leo luctus porta. Praesent tristique odio vitae massa ultrices imperdiet. Morbi hendrerit risus in felis aliquet, a volutpat tellus aliquam. Donec commodo sed felis eu faucibus. Fusce et augue tristique, faucibus enim sed, convallis mi. Praesent malesuada vulputate diam, at interdum lacus ultricies quis. Ut porttitor vehicula libero. Sed a est leo. Praesent facilisis pharetra tellus, vitae tincidunt lacus vestibulum non. Mauris quis magna vestibulum, imperdiet enim ac, pulvinar dolor. Ut mollis lobortis mattis. Integer mollis tempor ligula. Aenean feugiat condimentum semper. Vivamus molestie egestas venenatis. Praesent pretium sed enim quis consequat. Nullam dapibus odio felis, sit amet feugiat sem porttitor non.Short Read more…