Uncategorized


blog.udartsev.ru

Topics that don't need a category, or don't fit into any other existing category.


GOLANG - go.sum (fix)

Delete conflict package sums:

sed '/^github.com\/hyperledger\/fabric v1.4.4/d' ./go.sum > temp.txt && mv temp.txt go.sum

DJANGO - ORM lookup classees

**Django 3.***

Доступные подклассы для выборки запросов типа:
"user_name__icontains"
"user_name__iregex"
"user_name__startswith"
django.db.models.query_utils :
  'contained_by':     <class 'django.contrib.postgres.fields.ranges.RangeContainedBy'>,
  'gte':              <class 'django.db.models.lookups.IntegerGreaterThanOrEqual'>,
  'lt':               <class 'django.db.models.lookups.IntegerLessThan'>,
  'contains':         <class 'django.db.models.lookups.Contains'>,
  'endswith':         <class 'django.db.models.lookups.EndsWith'>,
  'exact':            <class 'django.db.models.lookups.Exact'>,
  'gt':               <class 'django.db.models.lookups.GreaterThan'>,
  'gte':              <class 'django.db.models.lookups.GreaterThanOrEqual'>,
  'icontains':        <class 'django.db.models.lookups.IContains'>,
  'iendswith':        <class 'django.db.models.lookups.IEndsWith'>,
  'iexact':           <class 'django.db.models.lookups.IExact'>,
  'in':               <class 'django.db.models.lookups.In'>,
  'iregex':           <class 'django.db.models.lookups.IRegex'>,
  'isnull':           <class 'django.db.models.lookups.IsNull'>,
  'istartswith':      <class 'django.db.models.lookups.IStartsWith'>,
  'lt':               <class 'django.db.models.lookups.LessThan'>,
  'lte':              <class 'django.db.models.lookups.LessThanOrEqual'>,
  'range':            <class 'django.db.models.lookups.Range'>,
  'regex':            <class 'django.db.models.lookups.Regex'>,
  'startswith':       <class 'django.db.models.lookups.StartsWith'>,

SUBLIME - Anaconda plugin

SublimeText3 Anaconda (Python plugin)

https://sublime-text.zeef.com/zeefcom Anaconda config:

{ "pep8_ignore": [
    "E501",
    "E402",
    "UnusedImport",
    "W291",
    "E722",
  "E111"
    ] ,
  "pyflakes_explicit_ignore": [
    "UnusedImport",
    ],
  "auto_formatting": true,
  "autoformat_ignore":
    [
        "E309",
        "E501",        
    ],
  "auto_complete": true,
  "auto_complete_commit_on_tab": true,
}

Ubuntu Linux - 3+more monitors Artifacts fix

Ubuntu Monitor Artifacts FIX

1. Change GRUB config file:

    gedit /etc/default/grub

Changed this line:

GRUB_CMDLINE_LINUX=""

to this:

GRUB_CMDLINE_LINUX="amd_iommu=on iommu=pt"

then:

sudo update-grub && sudo reboot

2. Update kernel iniframs:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
cd linux-firmware/
sudo cp -va amdgpu/ /lib/firmware/
sudo update-initramfs -u
reboot

SSH key to server

SSH => server

Create a key:

ssh-keygen -t rsa

Copy it to the server:

ssh-copy-id -i ./mainserver.pub archive@5.45.79.2

OR

ssh archive@5.45.79.2 "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

cat ./mainserver.pub | ssh archive@5.45.79.2 'cat >> .ssh/authorized_keys'

OR

ssh -i /root/.ssh/mainserver.pub archive@5.45.79.2

EXIFTOOL - Getting data from RAW (CR2) File to JPG (Ubuntu/Linux)

If you want to get data (in JPG) from your RAW file in Ubuntu/Linux, do next:

1) Install exiftool in your Linux system:

sudo apt install exiftool

2) not necessary step: view your RAW file data:

exiftool -s2 -all -b -X -fXMP:XMP foto.cr2

3) not necessary step: near the bottom, it will shows:

Composite:PreviewImage='(Binary data 1706501 bytes, use -b option to extract)'
Composite:ThumbnailImage='(Binary data 17031 bytes, use -b option to extract)'

enter image description here

4) Use the "-b" option to extract either or both:

exiftool -Composite:PreviewImage -b foto.cr2 >preview.jpg
exiftool -Composite:ThumbnailImage -b foto.cr2 >thumb.jpg

5) To extract data from all files in the folder, do next:

for i in *.CR2; do exiftool -Composite:PreviewImage -b $i > $i.jpg; done

6) Done. We did execute all JPG data from RAW files: enter image description here


Настройка sendmail для использования gmail в качестве хоста передачи (smarthost)

Как настроить сендмейл для использования gmail в качестве хоста:

1) устанавливаем сендмейл и дополнительные утилиты:

sudo apt-get install sendmail sasl2-bin

2) перемещаемся в каталог /etc/mail

cd /etc/mail

3) создаём файл authinfo со следующим содержимым:

AuthInfo:smtp.gmail.com "U:username" "I:username@gmail.com" "P:password" "M:PLAIN"

AuthInfo:smtp.gmail.com:587 "U:username" "I:username@gmail.com" "P:password" "M:PLAIN"

4) выполните команду:

sudo makemap -r hash authinfo.db < authinfo

5) создадим SASL файл:

/etc/mail/sasl/sasl.m4

6) отредактируем sendmail.mc :

sudo gedit sendmail.mc

добавим строки как показано ниже (добавленные строки выделены между кода):

dnl #
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl

include(/etc/mail/tls/starttls.m4')dnl include(/etc/mail/sasl/sasl.m4')dnl FEATURE(authinfo',hash /etc/mail/authinfo.db')dnl define(SMART_HOST',smtp.gmail.com')dnl define(RELAY_MAILER_ARGS',TCP $h 587')dnl define(ESMTP_MAILER_ARGS',TCP $h 587')dnl

dnl #
dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl

7) выполним:

sudo make 
sudo /etc/init.d/sendmail reload

8) Если все получилось без ошибок, то релей через gmail настроен. Проверяем!

Отправляем сообщение с локального хоста на mail.ru:

$ sudo mail -v your@mail.ru
Subject: Тестовое сообщение
Это тестовое сообщение
.  
...
050 235 2.7.0 Accepted
...
250 2.0.0 pBDA7MDj024641 Message accepted for 
delivery 
your@mail.ru... Sent (pBDA7MDj024641 Message 
accepted for delivery)
Closing connection to [127.0.0.1]

Done!


Создаём git репозитарий на github.com

1) Создаем удаленный репозиторий, указывая имя учетной записи

curl -u 'USER_NAME' https://api.github.com/user/repos -d'{"name":"demo"}'

2) В папке с проектом инициируем пустой гит

git init

3) Добавляем все файлы в индексацию локального git

git add .

4) Создаем коммит файлов в локальный гит

git commit -m "initial commit"

5) Подключаем к локальному git проект на github.com

git remote add origin https://github.com/USER_NAME/demo.git

6) Загружаем файлы на гитхаб (коммит)

git push -u origin master

Node.js vs PHP

In Russian language.


Programming jokes

programming jokes

Here are several comments from facebook page:

Artëm Bolgar Android Developer - It is deploying, it is loading, it is loading into a debugger, it is logcatting, it is crashing....


Mike Zmuda I had to service a lot of Win98 and XP machines, some of which hadn't been Windows-Updated in quite some time. So there would be times when I'd click Update, and have nothing left to do but wait for the "Agree/Cancel" dialogue that would come up. During those times, I'd play solitaire on my Windows CE phone (remember WinCE?) I always felt horrible billing my clients for 3 hours of my time just to play solitaire. Eventually I got over it.


William A Nerini Really, for most of those people, the answer is far more likely to be "I'm Thinking" than any other answer!