Skip to content

Instantly share code, notes, and snippets.

prefix publisher journals dois
10.12679 0 0
10.7579 123Doc Education 0 0
10.3731 21st Century COE Program (Toplogical Science and Technology) 1 40
10.5775 A. I. Rosu Cultural Scientific Foundation Fundatia cultural-stiintifica A. I. Rosu 1 80
10.4037 AACN Publishing 2 766
10.1306 AAPG/Datapages 4 21817
10.3183 AB Svensk Papperstidning 1 1550
10.5769 ABEAT - Associacao Brasileira de Especialistas em Alta Tecnologia 1 57
10.7597 ACOPIOS - Revista Iberica de Mineralogia 1 9
@barseghyanartur
barseghyanartur / Install PyQt5 on Ubuntu with python3 .md
Created May 30, 2024 09:25 — forked from IoTeacher/Install PyQt5 on Ubuntu with python3 .md
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Instalación en Ubuntu

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configurarlo en la terminal

@barseghyanartur
barseghyanartur / middleware.py
Created December 21, 2023 11:34 — forked from SehgalDivij/middleware.py
Middleware in django to log all requests and responses(Inspired by another Github gist I cannot find the link to, now)
"""
Middleware to log all requests and responses.
Uses a logger configured by the name of django.request
to log all requests and responses according to configuration
specified for django.request.
"""
# import json
import logging
from django.utils.deprecation import MiddlewareMixin
@barseghyanartur
barseghyanartur / platform_generate.py
Created December 12, 2023 13:27 — forked from cheind/platform_generate.py
cross platform pip-compile helper
import argparse
import platform
import sys
import subprocess
from pathlib import Path
def describe() -> dict:
meta = {
"python": "py" + ".".join(platform.python_version_tuple()[:2]),
@barseghyanartur
barseghyanartur / create-eml-file.py
Created January 3, 2023 22:39 — forked from jeremykdev/create-eml-file.py
Python script to create an eml file
# Prototype to create an eml file using python
import os
import uuid
from email import generator
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# where to write the output file
directory = "C:\\Users\\Jeremy\Documents\\python\\email-prototype\\temp"
@barseghyanartur
barseghyanartur / script.py
Created May 30, 2022 14:06 — forked from ark4n631/script.py
Get a local copy of a file from django storages S3
from django.core.files import File
from django.core.files.storage import default_storage, FileSystemStorage
from django.conf import settings
from django.core.files.base import ContentFile
local_storage = FileSystemStorage()
local_storage.base_location = settings.MEDIA_ROOT
def get_local_file_from_object(obj):
@barseghyanartur
barseghyanartur / test_image_upload.py
Created April 26, 2022 15:06 — forked from guillaumepiot/test_image_upload.py
Django Rest Framework - Image/File upload test
import os
import io
from PIL import Image
from django.core.urlresolvers import reverse
from django.conf import settings
from rest_framework import status
from rest_framework.test import APITestCase
$ cat t.py
from pprint import pprint
from pytheory import Tone, Fretboard, charts_for_fretboard


tones = (
    Tone.from_string("F2"),
    Tone.from_string("C3"),
    Tone.from_string("G3"),

Tone.from_string("D4"),

Workflows (States) in Django

I'm going to cover a simple, but effective, utility for managing state and transitions (aka workflow). We often need to store the state (status) of a model and it should only be in one state at a time.

Common Software Uses

  • Publishing (Draft->Approved->Published->Expired->Deleted)
from django.core.exceptions import ValidationError
from django.db.models import Field, CharField
__all__ = ['MultiColumnField']
try:
from hashlib import md5
except ImportError:
from md5 import new as md5