2/19/2021

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.


1/29/2021

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!

1/26/2021

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!

12/23/2020

delete over than specific megabyte in git history using bfg

firstly, install bfg


on mac

> brew install bfg

delete object if over than 50m in git commit history

> bfg --strip-blobs-bigger-than 50M

make sure & apply .gitignore





First, to check what files are you actually tracking
> git ls-tree --name-only --full-tree -r HEAD


Let say that you found unwanted files in a directory like cache/ so, it's safer to target that directory instead of all of your files.
So instead of:

> git rm -r --cached .


It's safer to target the unwanted file or directory:
> git rm -r --cached cache/


Then proceed to add all changes:
> git add .


and commit
> git commit -m ".gitignore is now working"

list up and sorting file(object) size in git / command

 use following cmd:

> git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest