Pular para o conteúdo principal

Showing when a specific process was started in Linux

· Leitura de um minuto

To see an uptime of an specific process along with the timestamp it was started execute the following command:

ps -eo pid,comm,lstart,etime,args |grep java

In this example I've filtered all running java processes, but you can filter any process you want to.

Setting Custom resolution on Virtualbox for linux

· Leitura de um minuto
export VM_NAME="MY_VM_NAME"
export VM_RES="1366x768x32"
export VM_W=1366
export VM_H=768
VBoxManage setextradata global GUI/MaxGuestResolution any
VBoxManage setextradata "$VM_NAME" "CustomVideoMode1" "$VM_RES"
VBoxManage controlvm "$VM NAME" setvideomodehint $VM_W $VM_H 32

Install NFS server on Centos 7.x

· Leitura de um minuto

Server

Execute following commands

yum install nfs-utils -y
mkdir <DIRECTORY_TO_SHARE>
chmod -R 755 <DIRECTORY_TO_SHARE>
chown nfsnobody:nfsnobody <DIRECTORY_TO_SHARE>
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap
vi /etc/exports

Inside /etc/exports file:

#assuming you want to whare with all IPs within range 192.168.1.1-255
<DIRECTORY_TO_SHARE> 192.168.1.*(rw,sync,no_root_squash,no_all_squash)
systemctl restart nfs-server

Client

mkdir <SHARED_FOLDER_MOUNTPOINT>
yum install -y nfs-utils
#show list of available shared folders from server
showmount -e <SERVER_IP>
vi /etc/fstab
#add the following line
<SERVER_IP>:<SERVER_SHARED_FOLDER> <SHARED_FOLDER_MOUNTPOINT> nfs defaults 0 0

Alternatively you can mount your server shared folder with mount command like this:

#Caution: mountpoint will reset after client restart
mount -t nfs <SERVER_IP>:<SERVER_SHARED_FOLDER> <SHARED_FOLDER_MOUNTPOINT>

Converting CSV to XLSX/PDF using Libreoffice/SOffice

· Leitura de um minuto

FROM CSV TO PDF

libreoffice --headless --convert-to pdf:calc_pdf_Export --outdir ./export/ file.csv

FROM CSV TO XLSX

libreoffice --headless --convert-to xlsx:"Calc MS Excel 2007 XML" --outdir ./export/ file.csv

PS: Newer versions use soffice instead.

Resetting a mediawiki user password

· Leitura de um minuto
  1. Change dir to mediawiki home

  2. Execute the following command:

    php ./maintenance/changePassword.php --user=<USERNAME> --password=<NEW_PWD>

Using wsimport to generate JAX-WS client source from selfsigned SOAP service

· Leitura de um minuto
  1. Download certificate using your browser. Ex

  1. Import certificate to keystore. Ex.:
#Import to keystore
keytool -importcert -file caixa.cer -keystore keystore.jks -alias "caixa"

  1. Run wsimport class from tools.jar. Ex.:
#Running wsimport
java -cp /home/rafael/dev/ssd/jdk/jdk1.8.0_191/lib/tools.jar -Djavax.net.ssl.trustStore=keystore.jks com.sun.tools.internal.ws.WsImport -s src -keep "https://barramento.caixa.gov.br/sibar/ConsultaCobrancaBancaria/Boleto?wsdl"

A fully working example can be found in: https://github.com/rafaelszp/wstestcaixa