Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
OneSignal - free multiplatform push notification service

Send 100% FREE push notifications to Android, iOS, Web by their completely free SDKs on OneSignal. #OneSignal is multiplatform push notification service that you just interact with it using API calls in JSON format. It has a thorough documentation for SDKs and Server API.

* BE AWARE THAT use OneSignal in case your user's privacy does not matter to you! They have mentioned in their privacy policy that they sell this information!!! All device locations, user email addresses and all the other sensetive data will be collected by OneSignal.

#push_notification #push #ios #android #web #notification #one_signal
ngxtop - real-time metrics for nginx server (and others)

ngxtop parses your nginx access log and outputs useful, top-like, metrics of your nginx server. So you can tell what is happening with your server in real-time. ngxtop tries to determine the correct location and format of nginx access log file by default, so you can just run ngxtop and having a close look at all requests coming to your nginx server. But it does not limit you to nginx and the default top view. ngxtop is flexible enough for you to configure and change most of its behaviours. You can query for different things, specify your log and format, even parse remote Apache common access log with ease. See sample usages below for some ideas about what you can do with it.


Installation:

pip install ngxtop


It is easy as pie, you just need to run it and look at the results:

nxtop

It will reports for total requests served and total bytes sent to client and will report requests based on their status code. At the pictures in the next post you can see sample usages.

#linux #nginx #top #nxtop #web_server
In case you want to serve static files in your website in nginX, you can add a new location directive to your server block that corresponds to your website:

server {

# your rest of codes in server block...

location / {

location ~ \.(css|ico|jpg|png) {
root /etc/nginx/www/your_site/statics;
}

# your rest of codes...

}
}

This is it, whether it is a uwsgi proxy, fpm, etc.

#web_server #nginx #static #location #serve
When you redirect in nginX you would use one of 302, 301 code like the below code:

location = /singup {
return 302 https://docs.google.com/forms;
}


But there is tiny tip here that needs to be told. If you want to pass parameter to the destination link, which in here is https:// docs.google.com/forms it wont work. String parameters are being held in $args varaible in nginX so you need to pass this variable like the following code:

location = /singup {
return 302 https://docs.google.com/forms$is_args$args;
}

The variable $is_args value will be set to "?" if a request line has arguments, or an empty string otherwise.


#nginx #web_server #redirect #302 #is_args #args
Generate random valid users agent for your bot crawlers in Python:

https://pypi.org/project/user_agent/

#python #user_agent #crawl #web_scraper
nginX by default does not set CORS headers for requests with error status codes like 401. There are 2 options here to add CORS headers:

1- If your nginX version is new you have the option of always to add to add_header:
add_header 'Access-Control-Allow-Origin' $http_origin always;

2- If you got error of invalid number of arguments in "add_header" directive, then use more_set_headers:
more_set_headers -s '401 400 403 404 500' 'Access-Control-Allow-Origin: $http_origin';

NOTE: when this error happens then in $.ajax or any similar method you wont have access to status codes. So be extremely catious!!!

#nginX #web_server #CORS #more_set_headers #add_header #ajax
EMQ X broker is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.

Starting from 3.0 release, EMQ X broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the EMQ X broker can scaled to 10+ million concurrent MQTT connections on one cluster.

https://github.com/emqx/emqx


#github #emqx #mqtt #pubsub #wss #ws #websocket #web_socket