Pular para o conteúdo principal

Enabling SSL on NGINX

· Leitura de um minuto

Generating self signed cert

openssl req -x509 -nodes -days 365000 -newkey rsa:2048 -keyout testes.key -out testes.crt

Edit config file

       server{
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/testes.crt;
ssl_certificate_key /etc/nginx/ssl/testes.key;
}

Installing Karma with phantomjs

· Leitura de um minuto

Use npm:

    npm install -g karma-cli
npm install -g karma --save-dev
npm install -g phantomjs
npm install -g karma-jasmine --save-dev
npm install -g karma-phantomjs-launcher --save-dev
npm install -g karma-chrome-launcher --save-dev

Sending mail using command line

· Leitura de um minuto

Sending file


mail -s "[Subject] Test " -a "From: user@example.com" dest@example.com < /path/to/file.txt

Using echo command

echo "Email body - Test" | mail -s "[Subject] Teste " -a "From: USER" dest@example.com

 Using mailx

echo "This is the message body and contains the message" | mailx -v -r "USER" -s "This is the subject" -S smtp="smtp.example.com" user@gmail.com

With auth

echo "Authenticated message" | mailx -v -s "Subject" -S smtp="smtp.gmail.com:587" -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="mygmail@gmail.com" -S smtp-auth-password="mypassword" -S ssl-verify=ignore someone@example.com

Using tcpdump to track packages on specific port and interface

· Leitura de um minuto

Run the following command:

    tcpdump -n -S -s 0 -A 'tcp dst port 8080' -i ens32 | grep -B3  -A15 "POST /jasperserver"

This will track last 15 lines of traffic on 8080 port using ens32 interface with the sentence "POST /jasperserver".

Creating RAMDISK on Linux

· Leitura de um minuto

Follow this example:

[gist https://gist.github.com/rafaelszp/4e4de21e464330cb5da98d81cb8df4cc\]

Where 256M is amount of RAM you wish to allocate for ramdisk. It's clear that this value should be less than amount of free memory (use "free -m"). BTW, if you specify too many MBs for ramdisk Linux will try to allocate it from RAM and then from swap so resulting performance would be very poor.

Dealing with error 413 in GIT

· Leitura de um minuto

#Solving git error: RPC failed; result=22, HTTP code = 413

    git config --global http.postBuffer 524288000