Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
When you use set in Python it makes sure that your list is unique, but does not keep the insertion order of
the set. For that use the below python package:

https://pypi.python.org/pypi/orderedset

NOTE: becareful if you want to use it in production as it is 5 times slower than set!

#python #set #ordered_set #orderedset
It is best practice to always set server date/time to UTC. In debian in order to configure your time and set it to UTC, do as follow:

sudo dpkg-reconfigure tzdata

Now select None of the above or Etc and then press OK. Now select UTC. You're done.

To check your server date/time issue date command:

root@serv01:~# date
Mon Mar 5 11:20:59 UTC 2018


#date #dpkg-reconfigure #tzdata #UTC #timezone
In MongoDB it is suggested to turn atime to off. atime is set by Linux on each file accessed by applications. It is reported repeatedly that turning it off will improve disk performance on that partition.

To run off atime you need to set noatime on the partition you are placing mongoDB database files. Open /etc/fstab and look for your desired partition (mine is `/var`):

/dev/mapper/mongo--vg-var /var            xfs     defaults        0       2


Add noatime after defaults:

/dev/mapper/mongo--vg-var /var            xfs     defaults,noatime        0       2

Yours may be a little bit different. Now reboot your server using reboot --reboot.


Now you can check it by mount -l whether noatime is set or not:

/dev/mapper/mongo--vg-var on /var type xfs (rw,noatime,attr2,inode64,logbsize=256k,sunit=512,swidth=1024,noquota)

In the next post we test this using touch command in Linux.

#mongodb #mongo #noatime #atime #xfs #linux #fstab #mount
This media is not supported in your browser
VIEW IN TELEGRAM
صفحه لاگین خلاقانه 😍
Tech C**P
Zed_A_Shaw_Learn_Python_3_the_Hard.pdf
Learn Python 3 the hardway. Applicable for those who has just started programming with Python 3.
سلام دوستان عزیز 😊
دوستان یکسری پادکست براتون در نظر دارم که در حدود 20 پادکست یک ساعته هست. یکی از بهترین پادکستهای موجود در زمینه بحث scaling و management که با مدیران شرکتهای فیسبوک، گوگل، اوبر و... صحبت میشه و تجارب ناب تکنیکال در اختیارتون قرار میگیره. منتظر سری اول پادکستهای کانال باشید. صبحتون پر نشااااااااااط 🏃😋

Stay tuned! 😍

#podcast #intro
How do you give maintenance for your infrastructure when a new BIG deployment comes in?

You can use nginX to display a nice page about your maintenance. First of all create your fancy landing page for your maintenance in html format with the name of maintenance_off.html.

Inside of your server block in nginX configuration we do like below:

server {
...
location / {
if (-f /webapps/your_app/maintenance_on.html) {
return 503;
}


...
}

# Error pages.
error_page 503 /maintenance_on.html;
location = /maintenance_on.html {
root /webapps/your_app/;
}
...
}

What happens here is that we first check for a file named maintenance_on.html, if it's present we return 503 Server error. This error code is returned when server is not available. This code is inside of location section of root.

Outside of location we need to server /maintenance_on.html for error 503:

error_page 503 /maintenance_on.html;


And with an exact match for the file (`location =`) we serve that static page from root of /webapps/your_app/.

The note about this code is that when your file is named maintenance_off.html maintenance will be ignored and when we rename the file to maintenance_on.html then error 503 is returned.


#linux #nginx #maintenance #maintenance_mode #location #error_page
There are many other ways to put a website in maintenance mode, like to allow specific ip addresses to see the website but others see the maintenance mode page:

server {
..
set $maintenance on;

if ($remote_addr ~ (34.34.133.12|53.13.53.12)) {
set $maintenance off;
}

if ($maintenance = on) {
return 503;
}

location /maintenance {
}

error_page 503 @maintenance;

location @maintenance {
root /var/www/html/maintenance;
rewrite ^(.*)$ /index.html break;
}
..

}

This is it. If you don't know what the above code do, then SEARCH. :)

#nginx #linux #maintenance #maintenance_mode #503
وقتی اسنپ تریپ از هول عید برنامه خود را سریع وارد بازار می کند!

#بی_برنامگی #فرجه #اسنپ
#deadline #snapptrip
Tech C**P
#1 Airbnb's Brian Chesky in Handcrafted.mp3
دوستان این پادکست ها همون پادکست هایی بود که بهتون قولش رو داده بودم. حتما حتما حتما گوش فرا دهید. بسیار مفید هست و توانمندی های فنی و planning شما رو به شدت بهتر میکند و خواهید دید که شرکتهای بزرگ چگونه بزرگ شدند. آیا aribnb از ابتدا بزرگ بوده؟ از کجا شروع کردند؟ چگونه بازار هدف را پیدا کردند؟ و...
We deployed a server for MongoDB due to the slowness we talked before. The new deployment of MongoDB with server customization was 250 Times faster than before! And 6 Times smaller than the previous database size!

#mongodb #mongo #dba
Tech C**P
#2 The Money Episode w_ Minted's Mariam Naficy.mp3
مصاحبه با مریم نفیسی co-founder سایت eve و یکی از کارآفرینان مطرح آمریکا در مورد نحوه رشد شرکت و جذب سرمایه گذار و...