Just my blog
Blog about everything, mostly about tech stuff I made. Here is the list of stuff I'm using at my blog. Feel free to ask me about implementations.
- Mobaxterm SSH RDP FTP...
- Thunderbird Email client
- Filezilla FTP client/server
- Nirsoft Win utils
- Sysinternals Win utils
- Pi-Hole AD block by DNS
- NUT UPS manager
- Rpi MON Raspberry monitoring
- Free CAD 3D modelling
- Free Commander Far-like filemanager
- Bitwarden Password manager
- Django web framework
- celery multi-tasking
- celery-beat Celery + Django
- celery-results Celery + Django
- Pillow Python image lib
- wsgi mod Apache + Python
- requests best in WEB requests
- openpyxl make Excell docs
- p4python Perforce + Python
- paramiko SSH + Python
- pyvmomi ESXi Vcenter + Python
I'm using these libraries so you can ask me about them.
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...Allow Apache run python scripts
This is a simple ex. to allow apache run .py
# Python site at /var/www/py_site LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so <VirtualHost *:80> ServerName test.www.trianglesis.org.ua ServerAlias www.www.trianglesis.org.ua ServerAdmin test@test.com DocumentRoot /var/www/py_site/ <Directory /var/www/py_site> Order allow,deny Require all granted Allow from all </Directory> <Directory /var/www/py_site/cgi-bin> Options +ExecCGI Require all granted Allow from all Options +ExecCGI AddHandler cgi-script .cgi .pl .py AddHandler cgi-script .py </Directory> </VirtualHost>
Read...
Август - это вечер воскресенья?
Чего-чего? - Последняя пятница лета? - Осень через 4 дня? - Август - это вечер воскресенья? Да насрать в общем-то, я осенью также получаю зарплату, хожу на тренировку, занимаюсь любимым делом, гуляю и убиваю время всякой хуетой, как и в любое другое время года. Честно? Достали ваши сраные сопли про окончание лета. Печально было, когда лето кончалось, если тебе надо было идти в школу-институт-академию и заниматься скучными вещами со скучными людьми. А когда ты взрослый, самостоятельный человек и ноешь про то, что лето кончается - задумайся о двух вещах:
- ты или не вышел из детства до сих пор
- твоя жизнь настолько уныла, что времена года единственная отрада
Единственное, что я не люблю во временах года, это пору, когда на улице говно из снега и грязи, чисто из эстетических соображений.
Read...MySQL How to Reset the Root Password
https://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html Added to bookmarks:
- Log on to your system as the Unix user that the MySQL server runs as (for example, mysql).
- Stop the MySQL server if it is running. Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution, host name, and configuration. Common locations are/var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the file name has an extension of .pid and begins with either mysqld or your system's host name.Stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process. Use the actual path name of the .pid file in the following command:
shell; kill `cat /mysql-data-directory/host_name.pid`
Use backticks (not forward quotation marks) with the cat command. These cause the output of cat to be substituted into the kill command. - Create a text file containing the following statement on a single line. Replace the …
PostgreSQL first run
This is the most common issue for PostgreSQL first run in Linux env: configure the server to allow TCP/IP connections postgresql server it can produce PostgeSQL cannot connect to database host Here I'll show how to fix it before you struggle with firewall and ports: I've found ot here: 17.3. Starting the Database Server and How Do I Enable remote access to PostgreSQL database server? My situation:
vi /var/lib/pgsql/data/pg_hba.conf
add the string:
host all all 10.10.29.0/24 trust
with my range and next config:
vi /var/lib/pgsql/data/postgresql.conf
add the string:
listen_addresses='*'
After that restart the service:
systemctl restart postgresql.service
also you can use an old 'service postgresql restart'
[root@centst010 ~]# service postgresql restart Redirecting to /bin/systemctl restart postgresql.service
And here it is:
[root@centst010 ~]# netstat -anp | grep 5432 tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN tcp 0 0 192.168.1.40:5432 192.168.1.22:65369 ESTABLISHED tcp6 0 0 :::5432 :::* LISTEN
Read...
Can't create plan: Table 'bamboo_db.NOTIFICATIONS' doesn't exist RESOLVED
An issue with clean install Bamboo + MySQL
Can't create plan: Table 'bamboo_db.NOTIFICATIONS' doesn't exist RESOLVED This is log cut:
2015-06-12 15:21:37,985 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-3-thread-8] [JDBCExceptionReporter] Table 'bamboo_db.NOTIFICATIONS' doesn't exist. 2015-06-12 15:21:38,030 ERROR [http-bio-8085-exec-2] [JDBCExceptionReporter] Table 'bamboo_db.NOTIFICATIONS' doesn't exist 2015-06-12 15:21:38,046 ERROR [http-bio-8085-exec-2] [ExceptionMappingInterceptor] org.springframework.dao.InvalidDataAccessResourceUsageException: could not initialize a collection: [com.atlassian.bamboo.notification.NotificationSetImpl.notificationRules#425985]; SQL [select notificati0_.NOTIFICATION_SET as NOTIFICA4_36_1_, notificati0_.NOTIFICATION_RULE_ID as NOTIFICA1_1_, notificati0_.NOTIFICATION_RULE_ID as NOTIFICA1_37_0_, notificati0_.RECIPIENT_TYPE as RECIPIENT2_37_0_, notificati0_.RECIPIENT as RECIPIENT37_0_, notificati0_.NOTIFICATION_SET as NOTIFICA4_37_0_, notificati0_.CONDITION_KEY as CONDITION5_37_0_, notificati0_.CONDITION_DATA as CONDITION6_37_0_ from NOTIFICATIONS notificati0_ where notificati0_.NOTIFICATION_SET=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.atlassian.bamboo.notification.NotificationSetImpl.notificationRules#425985] Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException: could not initialize a collection: [com.atlassian.bamboo.notification.NotificationSetImpl.notificationRules#425985]; SQL [select notificati0_.NOTIFICATION_SET as NOTIFICA4_36_1_, notificati0_.NOTIFICATION_RULE_ID as NOTIFICA1_1_, notificati0_.NOTIFICATION_RULE_ID as NOTIFICA1_37_0_, notificati0_.RECIPIENT_TYPE as RECIPIENT2_37_0_, notificati0_.RECIPIENT as RECIPIENT37_0_, notificati0_.NOTIFICATION_SET as NOTIFICA4_37_0_, notificati0_.CONDITION_KEY as CONDITION5_37_0_, notificati0_.CONDITION_DATA as CONDITION6_37_0_ from NOTIFICATIONS notificati0_ where notificati0_.NOTIFICATION_SET=?]; nested exception is org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.atlassian.bamboo.notification.NotificationSetImpl.notificationRules#425985]
Too complex log, but all I understand from it …
Read...Вначале ты...
Вначале, ты решаешь поучить Python, начинаешь немного углубляться... ... и приходишь в себя в тот момент, когда читаешь о фреймворках.
Read...Going deeper with Python or HTMLParser and Vkontakte randomizer comes back!
Hello, for anybody who read this blog. Last time I'm trying to parse saved HTML page to get Vkontakte ids and randomly select one of them each time: here and here. Now I'll try to go deeper and use different way to extract data from life webpage without sawing it to the folder with python script. For my opinion, using some googling I should use this:
- http://docs.python-guide.org/en/latest/scenarios/scrape/
- http://stackoverflow.com/questions/2081586/web-scraping-with-python
- later I will add some more KB
The small plan:
- Add URL of parsed page:
- to txt file - and them get it from file to python
- to console, after python request to user
- Get all found ids and save it list to file ids.csv
- optionally with Name+id
- or just id if names will produce many encoding errors
- Get one id from the list by random choice
- optionally save it to winner.txt
- or just show in console result
Some inconvenience with this way:
- Additional …
Python HTMLParser and Vkontakte randomizer
Finally I've finish my first "program" on Python. The task is to parse people's id from web page where reposter's id stores. Main problems were:
- web-page code is loading dynamically so there is no simple way to get ids from it, the best solution was - save section where id stores in .html file
- I wanted to catch id + nickname but list of pairs was not a good decision when random works
- I can't create a list which stores all found ids, it wiped every iteration
- I have some unsupported chars in nicknames and they'd broke iteration
- I've get a lot of junk while scan .html so I used regex to avoid them
- I can't add various ids in list without adding one id to list recursively - and guess what? Yes, it's broke the iteration
What I've learned: Here will be a huge list of different things for indexing for further …
Read...Который по счету "блог"
Такое себе интересное чувство, когда ты завел в своей жизни уже дюжину блогов, и то и дело таскал туда-сюда все свои посты, когда в реальной жизни у тебя также ни один десяток различных тетрадей и блокнотов куда ты записывал свои мысли, и в итоге вся твоя личность размазана ровным слоем по интернету и немного по бумаге. Хер пойми, с чего мне СНОВА начать вести свой блог, и что мне в него записывать из своих мыслей, коих у меня роятся тысячи?
Read...