This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It's possible with Alias directive which is used like this | |
Alias /google_485135.html /usr/egan/google_485135.html | |
You can get 403 when serving of the file is working | |
to solve it you need to configure access to file on Apache level. | |
Alias /google_485135.html /usr/egan/google_485135.html | |
<Directory /usr/egan> | |
Require all granted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For example "brick" application: | |
egan@wk149 ~> brick & disown | |
disown is a unix tool for that so rtfm about it, it cool. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
xrandr --newmode "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync | |
xrandr --addmode VGA-1 "2560x1440_60.00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5288 Python: Экранирование строк от спецсимволов регулярных выражений: | |
Бывает так что из конфига или от пользователя нужно собрать строку, которая потом идёт в регулярное выражение. | |
Для того чтобы эффективно и быстро заэскейпить все спецссимволы регулярок в этой сроке используется re.escape(контент) - она возвращает заэкранированный контент. | |
т.е. реально можно использовать вот так: | |
re.search(re.escape(resource['mask'])+'.*'+re.escape(resource['format']),object.filename) | |
5289: Python: Отправка файла по SMB | |
def send_file(filename): | |
from smb.SMBConnection import SMBConnection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from __future__ import unicode_literals | |
from django.db import migrations, models | |
# FUNCTION TO DUMP DATA | |
def backup_tables(apps, schema_editor): | |
from django.core import serializers | |
Campaign = apps.get_model('reminders', 'Campaign') | |
CampaignSnapshot = apps.get_model('reminders', 'CampaignSnapshot') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) В пипфайле нужно указывать такие версии интерпретаторов которые знает pyenv И на которые создает симлинки с такимиже именами после сборки. | |
2) При билдинге интерпретаторов pyenv принимает имя типа pypy3.5-6.0.0 | |
3) После того как pyenv строит интерпретатор он создает симлинки на интерпретатор в /home/aa/.pyenv/shims/ и там он называет его pypy3.5 или pypy3 | |
Финал: по имени pypy3.5 pyenv строить интерпретатор не хочет. | |
Таким образом для того чтобы pipenv install отработал на этапе строительства интерпретатора в Pipfile должно быть | |
[requires] | |
python_version = "pypy3.5-6.0.0" | |
А чтобы собственно далее отработал сам pipenv это имя должно быть находимо в /home/aa/.pyenv/shims/ но там только pypy3.5, аначит: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0) For VBox guest additions comilation: | |
- sudo pacman -Sy linux-headers | |
1) Uncomment wheel in sudoers + remove /etc/sudoers.d/10-install | |
2) fish: | |
- sudo pacman -Sy fish, ncurses(its an implicit dependency) | |
3) shared vbox folder | |
mkdir /media |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-compose logs container_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Without swap mysql docker container for example will just not start on 512MB of RAM. | |
dd if=/dev/zero of=/swapfile bs=1M count=1024 | |
mkswap /swapfile | |
swapon /swapfile | |
Add string to /etc/fstab: /swapfile swap swap defaults 0 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Создание интерпретатора с опцией -fPIC для возможности компилирования uWSGI: | |
env PYTHON_CFLAGS=-fPIC pyenv install -v 3.6.4 | |
pyenv virtualenv 3.6.4 prstat | |
2) ВАЖНО! Активация соданного интерпретатора и сборка ТОЛЬКО с помощью него. | |
pyenv activate prstat | |
3) Скачивание свежей версии исходников uWSGI | |
wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz | |
tar xf uwsgi-latest.tar.gz |