Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
In Dockerfile`s some people in the community use `alpine base image in order to reduce docker image size. apk is its package management tool that can be used to install OS packages. So for example if
you want to install network tools (like ping) you need to install netcat-openbsd:

apk add netcat-openbsd


You can squash your image size even further by some tips. When you install a package, linux distros first download the package and put it in a cache folder. In Alpine it is located in /var/cache/apk.
To tell the OS to delete the cache after installation you can provide --no-cache option to it:

apk add --no-cache netcat-openbsd


There are some package like g++ or git that is needed on installation of some other packages. After installation those packages is useless and just increase image size. You can remove those packages b
y using --virtual command:

apk add --no-cache --virtual .build-deps g++ \
&& # do you stuff here \
&& apk del .build-deps


Great job guys! You have reduced your alpine docker images so much :)

#docker #linux #alpine #apk #virtual #no_cache #apk_del #apk_add
In marshmallow you can have a schema field which can be filled with a method output. Let's see with an example:

class AuthorSchema(Schema):
id = fields.Int(dump_only=True)
first = fields.Str()
last = fields.Str()
formatted_name = fields.Method("format_name", dump_only=True)

def format_name(self, author):
return "{}, {}".format(author.last, author.first)


As you see formatted_name field is filled by a method called format_name. Examples are endless, you can calculate average score based on the given scores for instance.

#python #marshmallow #fields #fields_method
GJSON is a Go package that provides a fast and simple way to get values from a json document. It has features such as one line retrieval, dot notation paths, iteration, and parsing json lines.

Las mere:
https://github.com/tidwall/gjson

#golang #go #gjson
A father before he died said to his son: “this is a watch your grandfather gave me, and is more than 200 years old. But before I give it to you, go to the watch shop on the first street, and tell him I want to sell it, and see how much he offers you”. He went, and then came back to his father, and said, "the watchmaker offered 5 dollars because it's old”. He said to him : “go to the coffee shop”. He went and then came back, and said: “He offered $5 father”. “Go to the museum and show that watch”. He went then came back, and said to his father “They offered me a million dollars for this piece”. The father said: “I wanted to let you know that the right place values you in right way. Don't find yourself in the wrong place and get angry if you are not valued. Those that know your value are those who appreciate you, don't stay in a place where nobody sees your value".

Know your worth.
pdsh: a high performance, parallel remote shell utility. Pdsh is a multithreaded remote shell client which executes commands on multiple remote hosts in parallel. Pdsh can use several different remote shell services, including standard "rsh", Kerberos IV, and ssh.

To see more about it head over to:
- https://github.com/grondo/pdsh

#linux #shell #pdsh #shell
Hello @all,
I'm looking for an Angular +6 developer with a very good salary! In case there is a person who is looking for a challenging job, please send a PV to me.
In order to expand a CIDR in python you can use ipaddress module as below:

import ipaddress
available_ips = [str(ip) for ip in ipaddress.IPv4Network('192.0.2.0/28')]


#python #ipaddress #ipv4 #IPv4Network
شرکتی در ایران نیازمند برنامه نویس فرانت اند هست. لطفاً در صورتی که تمایل به همکاری دارید به بنده پیام بدید:
@alirezastack

#شغل
How to recursively rename filenames?

find . -name '*txt' -exec bash -c ' mv $0 ${0/brand-/category-}' {} \;


The above command renames txt files starting with brand- to category-.

#linux #bash #find #rename #batch_rename
دوستان برای کار روی یه پروژه کوچیک یکی از همکاران نیاز به نیروی فرانت داره. اگر کسی هست لطفاً پیام بده.

#job #project #offer