mysql 8 зміна паролю з плагіном caching_sha2_password

SET GLOBAL validate_password.LENGTH = 4; 

SET GLOBAL validate_password.policy = 0; 

SET GLOBAL validate_password.mixed_case_count = 0; 

SET GLOBAL validate_password.number_count = 0; 

SET GLOBAL validate_password.special_char_count = 0; 

SET GLOBAL validate_password.check_user_name = 0;

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';
FLUSH PRIVILEGES; 

 

Збільшення шрифта у Viber (Linux Mint)

створюємо файл 

/etc/profile.d/qt-fix.sh 

 з наступним вмістом

# For the graphical elements
export QT_SCALE_FACTOR=1.5

# To make the fonts readable
export QT_FONT_DPI=96

export QT_AUTO_SCREEN_SCALE_FACTOR=1

ubuntu 14.04 в Docker модифікацією sources.list

FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
##///*******************************************************/
##//------------------------
## append apt mirror for ubuntu, update & install
##//------------------------
## RUN sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list
RUN echo "deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
## do update, upgrade (which may not be needed) & install:
RUN apt-get update -y && apt-get -y upgrade
RUN apt-get install -y debconf build-essential \
software-properties-common python-software-properties \
nano vim git htop wget curl nload unzip
RUN rm -rf /var/lib/apt/lists/*

sources.list файл для 12.04 ubuntu

deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu precise-security universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-proposed universe main multiverse restricted

Таймаут для виконання функції в python

Є скрипт під віндою, який час від часу залипає і це є проблемою. Варіант вирішення - задавати час на виконання функції, якщо він перевищує поріг, вбивати виконання функції. Нагуглив кілька варіантів, але під віндою не працює SIGALRM. А цей сніп досить гарно працює.

import multiprocessing
import time

# bar
def bar():
    for i in range(100):
        print "Tick"
        time.sleep(1)

if __name__ == '__main__':
    # Start bar as a process
    p = multiprocessing.Process(target=bar)
    p.start()

    # Wait for 10 seconds or until process finishes
    p.join(10)

    # If thread is still active
    if p.is_alive():
        print "running... let's kill it..."

        # Terminate - may not work if process is stuck for good
        p.terminate()
        # OR Kill - will work for sure, no chance for process to finish nicely however
        # p.kill()

        p.join()