How to upgrade
The procedure is dead simple! Mail server itself notifies you about the new updates in its admin panel. Head over to the given link and download the the appropriate file related to your OS. Usually a
1- First make it executable:
2- Now stop
3- Run the installer and go in an interactive way. JUST be sure to skip the
4- Now start
#mail_server #axigen #upgrade #update
Axigen
mail server?The procedure is dead simple! Mail server itself notifies you about the new updates in its admin panel. Head over to the given link and download the the appropriate file related to your OS. Usually a
.run
file.1- First make it executable:
chmod +x axigen-10.2.2.x86_64.rpm.run
NOTE:
here my version update may differ from yours.2- Now stop
Axigen
.3- Run the installer and go in an interactive way. JUST be sure to skip the
Axigen
post-install configuration wizard.4- Now start
Axigen
.NOTE:
in case you want to take backup copy the folder /var/opt/axigen
in a safe place. This path may differ based on your OS and your distro.#mail_server #axigen #upgrade #update
Have you heard about
If you know it, but like me you don't know it as you should and every time the bowser gives you a new error in
#browser #mozilla #CORS #cross_origin #cross_origin_resource_sharing
CORS
(Cross Origin Resource Sharing)?If you know it, but like me you don't know it as you should and every time the bowser gives you a new error in
console
you again get wandered in the wilderness, I'd suggest going to the awesome link below and read thoroughly line by line:https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
NOTE:
this article is fantastic! Believe you me. You will understand eveything you need to know exactly what is CORS
and how to handle it properly.#browser #mozilla #CORS #cross_origin #cross_origin_resource_sharing
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
How to upload a text content as a file in
We have created a binary data from the text which is in the format of
The
#javascript #jQuery #ajax #FormData #Blob #upload
$.Ajax()
?FormData
class is used to create a multipart/form-data
inside of JS code. A sample code speaks thousand words:var formData = new FormData();
var blob = new Blob([YOUR_CONTENT_HERE], { type: "text/html"});
formData.append("file", blob);
We have created a binary data from the text which is in the format of
text/html
, then I have appended the data as an input file with the name of file
(which will be captured on server-side).The
Ajax
part is utterly simple:$.ajax({
type: 'POST',
url: 'https://www.example.com/storage',
data: formData,
processData: false,
contentType: false
}).done(function(data) {});
NOTE:
DO NOT OMIT processData
, contentType
parameters.#javascript #jQuery #ajax #FormData #Blob #upload
Does that happen for you too, to
Let's say you are in a long path like
#linux #cd
CD
into a wrong directory and need to get back to the previous directory?Let's say you are in a long path like
/mnt/new_volume/backup/files/archive
, now you switch to home of your directory. In order to get back to the previous directory, you just need to issue the below command:cd -
#linux #cd
https://spyhce.com/blog/understanding-new-and-init
#python27 #python3 #__init__ #__new__ #old_style #new_style #OOP #class #super
#python27 #python3 #__init__ #__new__ #old_style #new_style #OOP #class #super
Spyhce
__new__ and __init__ | Spyhce blog
The __new__ and __init__ methods behave differently between themselves and between the old-style versus new-style python class definitions.
How to convert
#javascript #ByteArray #PDF #Uint8Array #Blob #jQuery
ByteArray
to PDF
and then upload it via jQuery
?var docData = [ yourByteArray ];
var blob = new Blob([new Uint8Array(docData)], { type: 'application/pdf' });
// Now create form to upload the file
var formData = new FormData();
formData.append("file", blob);
// Let's now upload the file
$.ajax({
type: 'POST',
url: 'https://www.YOUR-UPLOAD-FILE-ENDPOINT.com/storage',
beforeSend: request => set_ajax_headers(request),
data: formData,
processData: false,
contentType: false
}).done(function(data) {
console.log('File is uploaded!');
});
NOTE:
function set_ajax_headers
is a function that sets headers on the given request.#javascript #ByteArray #PDF #Uint8Array #Blob #jQuery
Forwarded from Pavel Durov
We’ve just started Instant View 2.0 Competition – our crowdsourcing contest with a prize fund of $300,000, ending on the 4th of April.
The goal is to create sets of rules (“templates”) that are used to generate beautiful “Instant View” previews for links shared on Telegram. Anyone with an understanding of HTML/CSS can participate. Participants get $100 for each correct template + $10,000 and $5,000 to top 2 contributors.
Check out the rules here – https://instantview.telegram.org/contest
We’ll launch more similar competitions for developers soon. Eventually there’ll be a competition for everything we do (Android, C++, voice calls etc). Winners get mighty prizes and a chance to join our dev team.
Stay tuned – we’ll announce the next competition within 10 days.
The goal is to create sets of rules (“templates”) that are used to generate beautiful “Instant View” previews for links shared on Telegram. Anyone with an understanding of HTML/CSS can participate. Participants get $100 for each correct template + $10,000 and $5,000 to top 2 contributors.
Check out the rules here – https://instantview.telegram.org/contest
We’ll launch more similar competitions for developers soon. Eventually there’ll be a competition for everything we do (Android, C++, voice calls etc). Winners get mighty prizes and a chance to join our dev team.
Stay tuned – we’ll announce the next competition within 10 days.
Instant View Platform
Template Competition 2.0
We are holding a new $300,000+ 2-month competition (4 Feb 2019 - 4 April 2019) to create Instant View Templates for news websites and blogs, $100 per template. Everyone is welcome to participate!
How to SSH login without password?
You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.
First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
Now use ssh to create a directory
Finally append a's new public key to
From now on you can log into B as b from A as a without password:
#linux #sysadmin #ssh #password_less #ssh_login
You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.
How to do it?
First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory
~/.ssh
as user b on B. (The directory may already exist, which is fine):a@A:~> ssh b@B mkdir -p .ssh
b@B's password:
Finally append a's new public key to
b@B:.ssh/authorized_keys
and enter b's password one last time:a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password:
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B
#linux #sysadmin #ssh #password_less #ssh_login
Virt-builder
is a tool for quickly building new virtual machines. You can build a variety of VMs for local or cloud use, usually within a few minutes or less. Virt-builder
also has many ways to customize these VMs. Everything is run from the command line and nothing requires root privileges, so automation and scripting is simple.To see available virtual machines:
virt-builder --list
Sample command to create a
debian-9
image:sudo virt-builder debian-9 --size=50G --hostname prod.example.com --network --install network-manager --root-password password:YOUR_PASS
The above command creates a debian 9 image with disk size of 50GB and sets the hostname to
prod.example.com
. --network
enables the networking on guest and --install
installs packages on the target OS. The last parameter sets the root password to
YOUR_PASS
.To read more about the axtra parameters:
- http://libguestfs.org/virt-builder.1.html
#linux #sysadmin #virt_builder #debian #image
https://superuser.com/questions/453988/whats-the-difference-between-su-with-and-without-hyphen
#linux #su
#linux #su
Super User
What's the difference between "su" with and without hyphen?
I'm quite new to Linux terminal and I'm not quite sure what the difference between su with a hyphen and su without a hyphen is, for example: su - username vs. su username.
I looked into the documen...
I looked into the documen...
Enable
open settings in telegram desktop and without clicking anywhere type
Spread your love for m2sh :)
#telegram #trick #fun #workmode #work_mode
workmode
in Telegram:open settings in telegram desktop and without clicking anywhere type
workmode
a dialog will open to confirm that want it to be enabled. After telegram restart you willl have a new bar above chat accounts -> Hide muted chats
click on it to hide muted chats from the left pane.Spread your love for m2sh :)
#telegram #trick #fun #workmode #work_mode
https://hackernoon.com/python-3-7s-new-builtin-breakpoint-a-quick-tour-4f1aebc444c
#python #python37 #breakpoint #pdb #set_trace
#python #python37 #breakpoint #pdb #set_trace
Hackernoon
Python 3.7’s new builtin breakpoint — a quick tour | HackerNoon
Debugging in Python has always felt a bit “awkward” compared with other languages I’ve worked in.
For
- https://hub.docker.com/r/prom/alertmanager
Awesome
- https://github.com/samber/awesome-prometheus-alerts
- https://awesome-prometheus-alerts.grep.to/rules
So to add
You alert manager configuration may look something like below:
You should be up & running with this sample configurations.
Spread your love for M2SH :)
#prometheus #prom #alert #alert_manager #docker #dockerfile #slack
prometheus
you can use an alert manager, it has a docker file in the link below:- https://hub.docker.com/r/prom/alertmanager
Awesome
Prometheus
alerts:- https://github.com/samber/awesome-prometheus-alerts
alertmanager
has rules, you can see sample rules here in the following link:- https://awesome-prometheus-alerts.grep.to/rules
So to add
alertmanager
service:alertmanager:
image: prom/alertmanager:latest
restart: always
command: --config.file=/etc/alertmanager/alertmanager.yml
volumes:
- ./alert/config/alertmanager.yml:/etc/alertmanager/alertmanager.yml
dns:
- 8.8.8.8
You alert manager configuration may look something like below:
global:
resolve_timeout: 5m
route:
# When a new group of alerts is created by an incoming alert, wait at
# least 'group_wait' to send the initial notification.
# This way ensures that you get multiple alerts for the same group that start
# firing shortly after another are batched together on the first
# notification.
group_wait: 10s
# When the first notification was sent, wait 'group_interval' to send a betch
# of new alerts that started firing for that group.
group_interval: 5m
# If an alert has successfully been sent, wait 'repeat_interval' to
# resend them.
repeat_interval: 30m
# A default receiver
receiver: "slack"
# All the above attributes are inherited by all child routes and can
# overwritten on each.
routes:
- receiver: "slack"
group_wait: 10s
match_re:
severity: error|warning
continue: true
# - receiver: "sms"
# group_wait: 10s
# match_re:
# severity: error
# continue: true
receivers:
- name: "slack"
slack_configs:
- api_url: 'YOUR-WEBHOOK-URL'
send_resolved: true
channel: 'monitoring'
text: "{{ range .Alerts }}<!channel> {{ .Annotations.summary }}\n{{ .Annotations.description }}\n{{ end }}"
# - name: "sms"
# webhook_config:
# - url: http://a.b.c:8080/send/sms
# send_resolved: true
You should be up & running with this sample configurations.
Spread your love for M2SH :)
#prometheus #prom #alert #alert_manager #docker #dockerfile #slack
GitHub
GitHub - samber/awesome-prometheus-alerts: 🚨 Collection of Prometheus alerting rules
🚨 Collection of Prometheus alerting rules. Contribute to samber/awesome-prometheus-alerts development by creating an account on GitHub.
Echo
: High performance, minimalist Go web framework - https://echo.labstack.com
- https://github.com/labstack/echo
A sample hello-world web server using
Echo
:package main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
// Echo instance
e := echo.New()
// Middleware
e.Use(middleware.Logger())
e.Use(middleware.Recover())
// Routes
e.GET("/", hello)
// Start server
e.Logger.Fatal(e.Start(":1323"))
}
// Handler
func hello(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
}
https://podcasts.google.com/?feed=aHR0cHM6Ly9zb2Z0d2FyZWVuZ2luZWVyaW5nZGFpbHkuY29tL2NhdGVnb3J5L3BvZGNhc3QvZmVlZC8&ep=14&episode=aHR0cDovL3NvZnR3YXJlZW5naW5lZXJpbmdkYWlseS5jb20vP3A9MTAzNzY
#kafka #podcast #alternative
#kafka #podcast #alternative
Google Podcasts
Podcast – Software Engineering Daily - Redpanda: Kafka Alternative with Alexander Gallego
Kafka has achieved widespread popularity as a popular distributed queue and event streaming platform, with enterprise adoption and a billion dollar company (Confluent) built around it. But could there be value in building a new platform from scratch? Redpanda…
Did you know you can use jsonSchema in MongoDB to search for documents?
Let's say you have
Now let's say you want to find all documents that has a customer_id of type
In Mongo shell:
This schema says look for documents that have
Interesting, right? :)
#database #mongodb #jsonSchema #json_schema
Let's say you have
users
collection with data below:{ "_id" : ObjectId("5f64bd1eca8806f2c04fcbe3"), "customer_id" : 100, "username" : "john" }
{ "_id" : ObjectId("5f64bd1eca8806f2c04fcbe5"), "customer_id" : 206, "username" : "new_customer" }
{ "_id" : ObjectId("60420df441558d6671cf54f2"), "customer_id" : "123", "username" : "Ali" }
Now let's say you want to find all documents that has a customer_id of type
string
instead of int
.In Mongo shell:
let ms = {required: ["customer_id"], properties: {customer_id: {bsonType: "string"}}}
This schema says look for documents that have
customer_id
field with string
type. To search:> db.customers.find({$jsonSchema: ms})
{ "_id" : ObjectId("60420df441558d6671cf54f2"), "customer_id" : "123", "username" : "Ali" }
Interesting, right? :)
#database #mongodb #jsonSchema #json_schema
One of the issues you always face with postgres on new systems is pg_config error. If you don't want to install postgres and willing to have postgres library in Pytho operational:
1. brew install libpq
2. xcode-select --install
3. echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
4. env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip3 install psycopg2
#osx #libpq #pg_config #postgres #postgresql #xcode
1. brew install libpq
2. xcode-select --install
3. echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
4. env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip3 install psycopg2
#osx #libpq #pg_config #postgres #postgresql #xcode