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
| import re,base64, quopri | |
| def encoded_words_to_text(encoded_words): | |
| encoded_word_regex = r'=\?{1}(.+)\?{1}([B|Q])\?{1}(.+)\?{1}=' | |
| charset, encoding, encoded_text = re.match(encoded_word_regex, encoded_words).groups() | |
| if encoding is 'B': | |
| byte_string = base64.b64decode(encoded_text) | |
| elif encoding is 'Q': | |
| byte_string = quopri.decodestring(encoded_text) |
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
| import os | |
| import pathlib | |
| import shutil | |
| path = pathlib.Path(instance.input_file.path) | |
| new_input_path = os.path.join(path.parents[1], str(instance.id)) | |
| new_input_filepath = os.path.join(new_input_path, path.name) | |
| shutil.move(str(path.parent), new_input_path) | |
| input_file = str(pathlib.Path(new_input_filepath).relative_to(settings.MEDIA_ROOT)) |
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
| $('#id_title').val(data['title']); | |
| $('#id_page_meta-0-title').val(data['meta_title']); | |
| $('#id_page_meta-0-description').val(data['meta_description']); | |
| $('#id_page_meta-0-keywords').val(data['meta_keywords']); | |
| CKEDITOR.instances['id_body'].setData(data['text']); |
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
| from django.dispatch import receiver | |
| from django.db.models.signals import post_save | |
| from .models import ModelName | |
| __all__ = [ | |
| 'model_name_post_create' | |
| ] | |
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 -*- | |
| # Generated by Django 1.9.13 on 2019-08-18 11:25 | |
| from __future__ import unicode_literals | |
| from django.db import migrations | |
| def migrate_code(apps, schema_editor): | |
| PatientInsurance = apps.get_model('patient', 'PatientInsurance') | |
| NSI_05 = apps.get_model('directory', 'NSI_05') |
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
| import os | |
| import environ | |
| import datetime | |
| import django as django_module | |
| from django.conf.locale.ru import formats as ru_formats | |
| ru_formats.DATE_FORMAT = 'd.m.Y' | |
| ru_formats.DATETIME_FORMAT = 'd.m.Y G:i' |
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
| def migrate_code(apps, schema_editor): | |
| Model = apps.get_model('App', 'ModelName') | |
| def reverse_code(apps, schema_editor): | |
| return | |
| class Migration(migrations.Migration): |
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 container prune --force --filter "until=2018-01-01T00:00:00" | |
| docker image prune -a --force --filter "until=2018-05-04T00:00: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
| # http://blog.webamator.ru/zametki/424/arxivaciya-razarxivaciya-cherez-ssh.html | |
| tar -zcvf имя_архива архивируемая_папка | |
| tar -xzvf имя_архива.tar.gz |
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
| apt-get update | |
| apt-get install software-properties-common && | |
| apt-add-repository ppa:ansible/ansible && | |
| apt-get update && | |
| apt-get install -y ansible && | |
| sudo sh -c "echo 'localhost ansible_connection=local' >> /etc/ansible/hosts" | |
| apt-get install --yes linux-image-extra-$(uname -r) linux-image-extra-virtual | |
| apt-get update | |
| apt-get install --yes apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
NewerOlder