Install python 3.8 on Linux

 

Following below step:

-------------

wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz

tar xvf Python-3.8.3.tgz

cd Python-3.8*/

./configure --enable-optimizations

make altinstall

-------------



Run amazon-linux 2 on local computer using Docker

 

I suppose you already installed docker.


1. pull Amazon Linux image

> docker pull amazonlinux

* https://hub.docker.com/_/amazonlinux


2. run container and enter the os

> docker run -it amazonlinux /bin/bash


3. check version

bash-4.2# > cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

or

bash-4.2# > cat /etc/system-release
Amazon Linux release 2 (Karoo)


Thank you.

🙇🏻‍♂️

error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8) fatal: the remote end hung up unexpectedly

 

I encounter this error when I push my repo.


>>>

error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)

fatal: the remote end hung up unexpectedly

<<<


I am trying following things to solve, It comes from stack overflow.


1.

git config --global http.version HTTP/1.1
git push 
git config --global http.version HTTP/2


2.

git config http.postBuffer 524288000



I tired both, but I failed.

In luck you could success.


Thank you.


jupyter print clear

 

Use Ipython.disply to make printed thing clear.

from IPython.display import clear_output

for i in range(10):
clear_output(wait=True)
print("Hello World!")


Thank you.

🙇🏻‍♂️

TeamViewer, can't access remote computer on ubuntu after a reboot

It works for me.

 

sudo gedit /etc/gdm3/custom.conf

Uncomment this line in custom.conf file:

WaylandEnable=false

and Reboot.


Importerror: libgl.so.1: cannot open shared object file: no such file or directory opencv error

Try this one first:

pip install opencv-python--headless


or 

install follow in case centos or aws linux docker

RUN yum install whatprovides libGL.so.1 -y

install follow in case linux docker

ENV TZ=Europe/Minsk
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get install libgtk2.0-dev -y

 

Thank you, Good luck!

AWS dynamoDB, search item by condition in 3 ways

 

Most secure way is 3rd, first and second way can fail when items are many.


code start

#pre define
UID_common = '24dea8d41ef74efda24a4b37805fe6de'

#### way 1 ###
dynamodb_resource = boto3.resource('dynamodb')
docs_table = dynamodb_resource.Table(DOCUMENTS_TABLE_NAME)
resp = docs_table.scan(FilterExpression = Attr('UID_COMMON').eq(UID_common))
for item in resp['Items']:
print( item['UID'] )

#### pre-define ###
dynamo_client = boto3.client('dynamodb',
aws_access_key_id = ACCESS_KEY,
aws_secret_access_key = SECRET_KEY,
region_name = REGION
)

#### way 2 ###
response = dynamo_client.scan(
TableName = DOCUMENTS_TABLE_NAME,
ExpressionAttributeValues={':search':{'S': UID_common} },
FilterExpression = "UID_COMMON = :search"
)
for item in response['Items']:
print(item['UID']['S'] )

### way 3 ###
paginator = dynamo_client.get_paginator('scan')
operation_parameters = {
'TableName': DOCUMENTS_TABLE_NAME,
'FilterExpression': 'UID_COMMON = :search',
'ExpressionAttributeValues': {
':search': {'S': UID_common},
}
}

page_iterator = paginator.paginate(**operation_parameters)
for page in page_iterator:
for item in page['Items']:
print( item['UID']['S'] )

code end


Enjoy AWS!