https://stackoverflow.com/questions/22163102/you-have-mail-message-in-terminal-os-x
#osx #mac #mail #iterm #terminal
#osx #mac #mail #iterm #terminal
Stack Overflow
"You have mail" message in terminal, os X
Few days ago I got this message in my terminal window:
What does that mean? I've never seen that before.
That was messages from xCode bots.
Thanks for the help.
What does that mean? I've never seen that before.
That was messages from xCode bots.
Thanks for the help.
tarfile
is a python library to read and write gzip`/`bz2
compressed files.How to read a
gzip
compressed tar archive and display some member information:import tarfile
tar = tarfile.open("sample.tar.gz", "r:gz")
for tarinfo in tar:
print tarinfo.name, "is", tarinfo.size, "bytes in size and is",
if tarinfo.isreg():
print "a regular file."
elif tarinfo.isdir():
print "a directory."
else:
print "something else."
tar.close()
Create a compressed file:
with tarfile.open(dst, "w:gz") as tar:
print("Archiving " + src + " into " + dst)
tar.add(src, arcname = os.path.basename(src))
NOTE:
the flag of w:gz
opens the destination in write mode. Used to create a new tar file.#python #tarfile #tar #bz2 #gzip
How to check expiration time of a PEM certificate using openssl?
#openssl #expiration_date
$ openssl x509 -enddate -noout -in file.pem
notAfter=Sep 3 02:23:50 2018 GMT
#openssl #expiration_date
Tech C**P
How to check expiration time of a PEM certificate using openssl? $ openssl x509 -enddate -noout -in file.pem notAfter=Sep 3 02:23:50 2018 GMT #openssl #expiration_date
Stack Overflow
How to determine SSL cert expiration date from a PEM encoded certificate?
If I have the actual file and a Bash shell in Mac or Linux, how can I query the cert file for when it will expire? Not a web site, but actually the certificate file itself, assuming I have the csr...
https://stackoverflow.com/questions/29479041/uwsgi-python-highload-configuration
#python #uwsgi #highload
#python #uwsgi #highload
Stack Overflow
uWSGI python highload configuration
We have a big EC2 instance with 32 cores, currently running Nginx, Tornado and Redis, serving on average 5K requests per second. Everything seems to work fine, but the CPU load already reaching 70%...
Tech C**P
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…
Read about
$args
here before the next post.Today I had a problem on nginX. I don't know where to start! :|
Fair enough, this is my nginx stanza:
So far so good. The problem was that when I give call the URL with callback parameter
generates
Don't ask me! I don't know what are
The output is like the below response for a URL similar to
#nginx #stanza #proxy_pass #echo_before_body #echo_after_body
Fair enough, this is my nginx stanza:
location /geo {
add_header 'Access-Control-Allow-Origin' '*';
if ( $arg_callback ) {
echo_before_body '$arg_callback(';
echo_after_body ');';
}
proxy_pass https://api.example.com/geo;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
NOTE:
each part of nginX block is called stanza
. I bet you didn't know about this one! :Decho_before_body
command will prepend something to the response which will be returned from nginX
.echo_after_body
will append something to the response.proxy_pass
will proxy your requests to a backend server.$arg_callback
will get value of parameter callback
in URL. So for example if you use $arg_type
, you will get the value of type
argument which is provided in URL: https://sample.com?type=SOMETHINGSo far so good. The problem was that when I give call the URL with callback parameter
https://api.example.com/geo?callback=test
. Itgenerates
/geo/geo
URL instead of /geo
. To circumvent the issue I used $request_uri in proxy_pass
section proxy_pass https:// api.fax.plus$request_uri;
. The route should be OK now, but there is one big problem here now that responses are returned in binary format instead of JSON. I removed Upgrade
& Connection
& proxy_http_version
lines and it worked like a charm!Don't ask me! I don't know what are
Upgrade
and Connection
headers.The output is like the below response for a URL similar to
https://api.example.com/geo?callback=test
:test(
{
"username": "alireza",
"password": "123456"
}
)
#nginx #stanza #proxy_pass #echo_before_body #echo_after_body
https://www.jetbrains.com/research/devecosystem-2018/databases/
It seems
#database #survey
It seems
MongoDB
is trying to be the first in the next decade.#database #survey
JetBrains
Databases in 2018 - The State of Developer Ecosystem by JetBrains
Over 6,000+ developers share their insights on modern database programming. Keep up with the most relevant technologies and databases in this infographic!
https://www.jetbrains.com/research/devecosystem-2018/python/
Most python programmers are data analysts. And most of them use
#python #survey
Most python programmers are data analysts. And most of them use
python 3
#python #survey
JetBrains
Python in 2018 - The State of Developer Ecosystem by JetBrains
Over 1400+ developers share their insights on modern Python programming. Keep up with the most relevant technologies and frameworks in this infographic!
Did you know you can test bash scripts line by line? Well,
The content of the bash script is:
#bash #sh #shell #scripting #debug #debugging
bash -x
is here to help:$ bash -x your_script.sh
+ a=10
+ echo 10
10
The content of the bash script is:
#!/bin/bash
a=10
echo $a
#bash #sh #shell #scripting #debug #debugging
How to ignore a specific partition in
Sometimes a specific partition has been mounted on many servers. Now if you monitor disk partitions on
This command will use
To read more about this Perl plug-in head over to the below link:
- https://nagios.manubulon.com/snmp_storage.html
#monitoring #icinga2 #snmp #storage #snmp_storage
Icinga2
monitoring server?Sometimes a specific partition has been mounted on many servers. Now if you monitor disk partitions on
Icinga2
and a warning message appears on that specific partition you will get notifications as many as your servers.Icinga2
uses Snmp Storage Check
in order to get disk partitions and their data. The command is located in /etc/icinga2/conf.d/ commands/snmp-storage.conf
. (Its name maybe different in your case)This command will use
check_snmp_storage.pl
nagios plugin, the overall structure of it is similar to:object CheckCommand "snmp-storage" {
import "snmp-manubulon-command"
command = [ ManubulonPluginDir + "/check_snmp_storage.pl" ]
arguments += {
"-m" = "$snmp_storage_name$"
"-f" = {
set_if = "$snmp_perf$"
}
"-w" = 87
"-c" = 95
"-H" = "$address$"
"-m" = "^Cached|^Shared|^Swap|^/run|^Physical|^Memory|^Virtual|^/dev|^/sys|^/mnt/remote_folder"
"-e" = ""
}
vars.snmp_perf = true
}
-m
parameter will ignore partitions. Here we have provided many partitions like /sys
or /mnt/remote_folder
. These partitions will be ignored all over. Add your desired partitions to this section.To read more about this Perl plug-in head over to the below link:
- https://nagios.manubulon.com/snmp_storage.html
#monitoring #icinga2 #snmp #storage #snmp_storage
Hello
If you run a container and attach to that container you would see its stin, stout or stderr outputs. If you press
One of the reasons that
parameter called
If you set
#docker #attach #detach #sig_proxy #sequence_key #SIGINT #SIGKILL
Docker
geeks :)If you run a container and attach to that container you would see its stin, stout or stderr outputs. If you press
CTRL+C
while you're attached to the container the container will get stopped. In order to detach from the container you can use key sequence CTRL+ p
+ CTRL+q
.One of the reasons that
CTRL+C
stops the container is that this key combination sends SIGKILL
signal to the container. There is aparameter called
--sig-proxy
that is true by default which makes CTRL+C
to send SIGINT
. You can detach from a container and leave it running using the CTRL-p CTRL-q key sequence.If you set
--sig-proxy
to false then CTRL+C
would not kill the running container:docker attach YOUR_CONTAINER_ID --sig-proxy=false
NOTE:
you can get container id by issuing docker ps
command.#docker #attach #detach #sig_proxy #sequence_key #SIGINT #SIGKILL
Array and loop in bash script
To define an array you can use a structure like below, be careful that we don't use comma in between:
dbs=( 'test1' 'test2' 'test3' )
Now to loop over the array elements use
for
:for your_db in ${dbs[@]}
do
echo $your_db
done
This is it!
#bash #scripting #for #loop #array
How to check python code correctness?
- https://pychecker.sourceforge.net/
It's usage:
Read more about the provided options in the provided link.
#python #pychecker #compiler
pychecker
is the man! :)- https://pychecker.sourceforge.net/
It's usage:
pychecker [options] file1.py file2.py ...
Read more about the provided options in the provided link.
#python #pychecker #compiler