Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
diff command is usually used to get differences between two files:
diff file1.py file2.py

Interesting part of this is that we can even get the differences between to folders, which differ in some files:
diff -bur folder1 folder2

b flag means ignoring whitespace.
u flag means a unified context (3 lines before and after).
r flag means recursive.

#linux #osx #diff
Check if you can connect to APNS SERVER using openssl:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert /etc/pushd/apns-cert.pem -key /etc/pushd/apns-key.pem

At the end if you can connect to the APNS server you would see Verify return code: 0 (ok). Finally press CTRL+C to go outside of
response.

#pushd #openssl #apns #push
http://www.wispiapp.com/

Wispi is a free cross-platform mobile communications app that allows users to combine voice calls, individual chats as well as group messaging through 3G, 4G or Wi-Fi connection. Our aim is to connect and promote communication between Wispi users FREE where possible and offer users excellent alternatives to the current phone / communication operator.


#wispi #chat #free_call #messaging_app
Some useful string methods, variables:

string.ascii_letters: in case you want to use alpha characters a-zA-Z. The output is:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

string.ascii_lowercase:
abcdefghijklmnopqrstuvwxyz

string.ascii_uppercase:
ABCDEFGHIJKLMNOPQRSTUVWXYZ

string.digits output is numbers:
0123456789

string.punctuation output is special charaters:
!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~

string.whitespace includes all whitespace charaters:
\t\n\x0b\x0c\r

NOTE: space is at the end of the above output, which is not visible.

There are many usecases you can do with this list like generating password, invitation code and etc from a psecific list.

#python #string #ascii_lowercase #ascii_uppercase #digits #punctuation #whitespace
Tech C**P
Some useful string methods, variables: string.ascii_letters: in case you want to use alpha characters a-zA-Z. The output is: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ string.ascii_lowercase: abcdefghijklmnopqrstuvwxyz string.ascii_uppercase:…
Generate a sample string (bonus coupon) from string functions and removing misguiding characters from the final list:
def generate_coupon(coupon_code_length=10):
alphanum = list(string.ascii_uppercase + string.digits)
alphanum.remove('L')
alphanum.remove('I')
alphanum.remove('1')
alphanum.remove('0')
alphanum.remove('O')

return ''.join(random.choice(alphanum) for i in range(coupon_code_length))

This function returns a random string from ascii_uppercase and string.digits. This is one usages out of very many usages of string module public variables. :)

GET THE IDEA!

#python #string #ascii_uppercase #digits #random #random_choice #range
You can use regex when you want to query MongoDB by using RegExp:
db.users.find({username: RegExp('ali.*')})

The above query will find users with username that starts with ali.

#mongo #mongodb #regexp #find
In docker you export an image into a tar file and then import that image without ever needing to download it again from docker hub.

To export an image you need to know the image name in your host (you can get image name by listing all images using docker images):
—------------------------—
docker save python > python.tar

—------------------------—

python is an image name in docker hub that we have downloaded it once from the hub registry. Now after using save command you will have a .tar file in your current path.

If you want to import this images in another server or in case all your images have been removed from your host server or local server, you just need to use load command to load the image into your local docker registry:
—------------------------—
docker load -i python.tar

—------------------------—

You need to be in the path that python.tar file exists.
Now after loading the image you can see that the image is added to your local registry. To check that use docker images

#docker #import #export #save #load #registry #hub #image
Forwarded from كانال خبري چمدان
🔸دیجی کالا و بامیلو دیشب که شبیه نمونه های خارجی تخفیف های بزرگ ارایه می دادند، هر دو از دسترس خارج شدند!
@Derangnews
When you don't have an idea about the load and expecting a 502 BAD Gateway. It means nothing but lack of scaling capablities or maybe lack of knowledge! After years of experience between Digikala crews, this is how they handle load of traffic if we not mention Bamilo!

Having a spare server or two, would difinitely help in balancing load in peak. Not having a good deployment strategy to distribute load to newly added healthy nodes would eventually make such a bad user experience.

Digikala! If I were you, I would place automatic scaling (or 1 single click deployment) to prevent such a results. (besides using load balancers that you guys difintely use).

#digikala #bamilo #502 #bad_gateway #scaling #ux
Remove all unused docker data including volumes, images, network, etc in one command:
docker system prune [OPTIONS]

To remove all unused data:
docker system prune -a

The command will give a warning and then deletes all unused data from docker.
WARNING! This will remove:
- all stopped containers
- all volumes not used by at least one container
- all networks not used by at least one container
- all images without at least one container associated to them
Are you sure you want to continue? [y/N] y

#docker #prune #system #docker_system #dangling
Forwarded from Netixa
شرکت اینتل اعلام کرده است که پردازندههای این شرکت دارای نقصی امنیتی هستند و حتی در حالت خاموش بودن سیستم، امکان کنترل کامل رایانه یا سرور را به نفوذگران می‌دهند.
@Netixa
Naming conventions and recipes related to packaging

Private (including closed-source) projects use a namespace

For internal/customer projects, use your company name as the namespace.

This rule applies to closed-source projectsi (local PyPi server).

As an example, if you are creating a "climbing" project for the "Python Sport" company: use "pythonsport.climbing" name, even if it is closed source.

NOTE: The above descriptions are derived from python PEP-423.

#python #package #packaging #pypi #pep423 #conflict