Авто удаление комментариев Вконтакте

Автоматически удалять комментарии оставленные НЕ подписчиков группы? Модуль, который проверяет каждый оставленный комментарий в первых 10 и 50-100 постах на предмет того, оставлен ли он участником группы. Логика действий простая: получить все комментарии с айди (словарь вида: айди_коммента, айди_автора, время_коммента) авторов каждого комментария, проверить есть ли айди автора комментария в списке участников группы, если нет – составить список значений из списка словарей выше, далее запустить луп, в котором удалять каждый комментарий ил списка словарей комментариев, которые оставлены не участниками группы. Данная логика не рассматривает использование vk_execute, но в моем модуле он используется. Возможно, я расскажу именно о vk_script когда-нибудь позднее, когда закончу разработку всех мыслимых модулей, которые запланировал внедрить. На основе: http://www.trianglesis.org.ua/vk-execute-args-python-requests Последнее время работаю над системой, которая выполняет рутинноеShort Read more…

Всегда делайте БЕКАПЫ! ВСЕГДА! ДЕЛАЙТЕ! БЕКАПЫ!

Сука, истина в последней инстанции! Только что полтора часа провозился с MySql после Power Failure –  слетела база юзеров, чинил, флашил – нихуя не помогало, ровным счетом нихуяшечки! Спасибо, блять, дебиану с его ебаной старой как мир Mysql 5.5… Так вот, я вдруг вспомнил, что делал когда-то бекапы по расписанию, и О БОЖЕ ЧТО ЭТО!!!!Адин-адин111 Полный бекап базочки даже с таблицей юзеров, гугель 30 сек, первая команда рестора – ЗАРАБОТАЛО! Сученька, спасибочки тебе, прошлый я, что поставил бекапы делаться еженедельно, каждый понедельник. Изменил расписание на ежедневно в полночь! Мало бекапов не бывает! Делайте бекапы! Read more…

Django + Python3.4 + Mysql(MariaDB)

Just hint for future me: [root@test smm_py]# vim settings.py [root@test smm_py]# python manage.py makemigrations import MySQLdb as Database ImportError: No module named ‘MySQLdb’ django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named ‘MySQLdb’ [root@test smm_py]# pip install mysql-python3 Collecting mysql-python Downloading MySQL-python-1.2.5.zip (108kB) 100% || 110kB 812kB/s ImportError: No module named ‘ConfigParser’ —————————————- Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-t64nwwtb/mysql-python [root@test smm_py]# easy_install mysql-python ImportError: No module named ‘ConfigParser’ ImportError: No module named ‘ConfigParser’ [root@test smm_py]# pip3 install ConfigParser Collecting ConfigParser _KEYCRE = re.compile(ur”%\(([^)]+)\)s”) SyntaxError: invalid syntax —————————————- [root@test smm_py]# pip3.4 install –allow-external mysql-connector-python mysql-connector-python Collecting mysql-connector-python Downloading http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip (277kB) 100% || 278kB 3.7MB/s Successfully built mysql-connector-python Successfully installed mysql-connector-python-2.0.4 [root@test smm_py]# vim /smm_py/settings.py 76 77 DATABASESShort Read more…

MySQL How to Reset the Root Password

Mysql

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) withShort Read more…

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@centst010Short Read more…

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_,Short Read more…

MySQL how to Alter multiple schema tables

To MyISAM from all InnoDB: SET @DATABASE_NAME = ‘db_name’; SELECT CONCAT(‘ALTER TABLE `’, table_name, ‘` ENGINE=MyISAM;’) AS sql_statements FROM information_schema.tables AS tb WHERE table_schema = @DATABASE_NAME AND `ENGINE` = ‘InnoDB’ AND `TABLE_TYPE` = ‘BASE TABLE’ ORDER BY table_name DESC;     Read more…

MySQL key efficiency 100

MySQL key efficiency 100% This is to remember the conf for this: for 1GB RAM dedicated server: query_cache_limit = 4MB query_cache_size = 128MB key_buffer_size = 128M max_connections = 300 wait_timeout = 7200 tmp_table_size = 64MB max_connect_errors = 1000 connect_timeout = 20 max_allowed_packet = 16M from here: thanks man! +1 Gb RAM = 2 Gb new config: log-slow-admin-statements query_cache_limit = 4MB query_cache_size = 64M key_buffer_size = 64M max_connections = 300 wait_timeout = 7200 tmp_table_size = 12MB max_connect_errors = 500 connect_timeout = 60 max_allowed_packet = 8M innodb_buffer_pool_size = 128M performance_schema plugin_dir = /usr/lib/plugin default-storage-engine = InnoDB innodb = ON   Read more…

Redmine Plugin Install

Просто напоминание себе: Каждый плагин копируется: root@tet-redmine redmine/plugins# git clone https://github.com/jgraichen/redmine_dashboard После чего, если он имеет доступ или требует БД – то мигрирует в прод: root@tet-redmine redmine/plugins# rake redmine:plugins:migrate RAILS_ENV=production (in /var/www/redmine) The git source git://github.com/jgraichen/transifex-ruby.git is not yet checked out. Please run `bundle install` before trying to start your application root@tet-redmine redmine/plugins# bundle install Может не мигрировать, тогда мы должны ему помочь и поставить, чего не хватает: Installing haml 4.0.5 Your bundle is complete! Gems in the groups development, test and rmagick were not installed. Use `bundle show [gemname]` to see where a bundled gem is installed. root@tet-redmine redmine/plugins# rake redmine:plugins:migrate RAILS_ENV=production (in /var/www/redmine) Migrating redmine_ckeditor (Redmine CKEditor plugin)… Migrating redmine_dashboard (Redmine Dashboard plugin)… Migrating redmine_digest (Digest plugin)… MigratingShort Read more…

MySQL tuning

Вот и пришло время, когда мне вдруг пришлось лезть в дебри MySQL tuning и пробовать заставить работать базу шустрее. Read more…