Tampilkan postingan dengan label ubuntu. Tampilkan semua postingan
Tampilkan postingan dengan label ubuntu. Tampilkan semua postingan

Kamis, 21 Mei 2015

Note Vi - Coding Command Terminal

Jadi ceritanya waktu lagi bikin aplikasi digital signage tuh pengen ngubah orientasi layar. Kebetulan pake os ubuntu n pke software Qt. Tapi zonk di Qt tuh ga bisa alias teu tiasaeun ngubah orientasi screen. Karena ada command ubuntu buat ngubah orientasi screen, yo sudah mau ndak mau saya campur aduk codingnya..

Begini nih codingnya:



kalo pake software selain qt juga bisa kok. Ini flow asal-asalan buat ngubah command biar bisa di eksekusi :
gbr 1. flowchart ubah command
ooowh ya, vi pake system(...) soalnya vi pake bahasa C. hehehe :D

Rabu, 20 Mei 2015

Note Vi - Run 'n Kill Program via Terminal

gbr 1. percobaan vi
Run program via terminal
Command untuk run program via terminal kek begini nih :



Berhubung vi pengen run program yang sudah terinstal di ubuntu, jadi lokasinya di  /usr/bin/. Misal run virtual keyboard (kalo di ubuntu namanya onboard) : 

 /usr/bin/onboard&
  
taraaamm ini dia
gbr 2. run onboard via terminal

Kill program via terminal
Konon katanya, command untuk kill program via terminal sebenernya buanyak bingit, contoh beberapa:

kill PID

ps -A | grep app_kamu

ps -ax | grep app_kamu


dan masih buanyak lagi yang lainnya, tapi pas vi cobain ternyata ga berhasil. I don't know why... Tapi yo sudahlah, lagi pula vi sukanya yang simple, praktis, cepet, ekonomis, hemat, n kawan2nya. so i use this command :

killall -9 app_kamu

jadi, kalo mau close virtual keyboard yang tadi udah di run, command'nya begini :

killall -9 onboard

Tapi kalo mau run & close langsung juga bisa. wkwkwk


Barangkali suatu saat butuh buat di coding. Hehehe
Semoga bermanfaat. Thanks for coming n see u. Have a nice day  ^_^

Selasa, 28 April 2015

Note Vi - Check if App is Running in Terminal

For example :
name of our application : myApp
location of our application : /home/binaryvi/Desktop/App

I try check app is running or not using terminal in ubuntu. I use shell script. Here we go:

#!/bin/bash

if ps aux | grep "[m]yApp" > /dev/null
then
   echo "Running"
else
  echo "Stopped"
  export DISPLAY=::0.0
fi


If app is stopped, i want run the app. This is the code:

#!/bin/bash

if ps aux | grep "[m]yApp" > /dev/null
then
   echo "Running"
else
  echo "Stopped"
  export DISPLAY=::0.0

  /home/binaryvi/Desktop/App/myApp&
fi

Note Vi - Show the Keyboard Automaticcally in Ubuntu (OnBoard)


pic 1. automatic onboard


Virtual keyboard in ubuntu called OnBoard. On touchscreen monitor, that doesn't show automatically. If we want to use this app, we must setting OnBoard first.

1. search and open onboard setting

pic 2. onboard setting

2. click general -> aotu-show when editing text

pic 3. setting onboard's window

3. click close. In ubuntu, it'll automatically save
4. search and open universal access

pic 4. universal access

5. click typing -> switch the button to On

pic 5. setting universal access

6. close window

taraaam.. Done!!
 
 

Note Vi - Edit Vim di Ubuntu

Jadi ceritanya tuh tadi nginstal library biar bisa kirim email via terminal di ubuntu 14.04, salah satu yang dioprek-oprek adalah 'sudo vim . . .'
setelah bisa masuk vim, tampilannya begini :

gbr 1.tampilan vim

berhubung ada yang salah, dengan senang hati vi hapus hapus hapus semua yang salah. terus ketik ketik ketik tapi oooh em jiiii kagak bisa #hwuuuaaaa..
setelah coba begini coba begitu kagak berhasil juga dan udah puas nangis kokosehan di dalam hati, tanpa salat istikoroh ahirnya vi memutuskan untuk menggunakan senjata pamungkas "nanya ke senior". ahihihihi

Ternyata biar bisa diedit,,, eng ing eeeeng setelah masuk ke vim, ketik huruf i. cuma gara-gara huruf i. Fiuuuh...

Trik-trik tambahan:
untuk keluar dari vim tanpa menyimpan hasil edit : 
  1. ketik tombol escape (esc)
  2. ketik q
  3. ketik tanda !
  4. enter
untuk keluar dari vim dan simpan hasil edit :
  1. ketik tombol escape (esc)
  2. ketik w
  3. ketik q
  4. ketik tanda !
  5. enter
Jadi programmer itu, banyak kejadian dodol. But so challenging and fun banget.
Cap cis cuuus,, makasih udah mampir. Hope u have excited day ^_^

Senin, 27 April 2015

Note vi - Configure Postfix to Use Gmail SMTP on Ubuntu

This post 100% from https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/ . It's my note, just for remember me.


If you want to use a Gmail account as a free SMTP server on your Ubuntu-Linux server, you will find this article useful. This guide is tested with Ubuntu 12.04. If you face any issue, feel free to use comments-section below.

Relaying Postfix mails via smtp.gmail.com:

First, install all necessary packages:

sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules

If you do not have postfix installed before, postfix configuration wizard will ask you some questions. Just select your server as Internet Site and for FQDN use something like mail.example.com

Then open your postfix config file:

vim /etc/postfix/main.cf

and following lines to it:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

You might have noticed that we haven’t specified our Gmail username and password in above lines. They will go into a different file. Open/Create

vim /etc/postfix/sasl_passwd

And add following line:

[smtp.gmail.com]:587    USERNAME@gmail.com:PASSWORD

If you want to use your Google App’s domain, please replace @gmail.com with your @domain.com

Fix permission and update postfix config to use sasl_passwd file:

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd


Next, validate certificates to avoid running into error. Just run following command:

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Finally, reload postfix config for changes to take effect:

sudo /etc/init.d/postfix reload
 
Testing
Check if mails are sent via Gmail SMTP server


If you have configured everything correctly, following command should generate a test mail from your server to your mailbox.

echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com

To further verify, if mail sent from above command is actually sent via Gmail’s SMTP server, you can log into Gmail account USERNAME@gmail.com with PASSWORD and check “Sent Mail” folder in that Gmail account. By default, Gmail always keeps a copy of mail being sent through its web-interface as well as SMTP server. This logging is one strong reason that we often use Gmail when mail delivery is critical.

Once configured, all emails from your server will be sent via Gmail. This method will be useful if you have many sites on your server and want them all to send emails via Gmail’s SMTP server.

Alternatively, you can use a plugin like WP Mail SMTP so that mails from your particular WordPress site will be sent using Gmail’s SMTP server.

Please note that Gmail’s SMTP server has a limit of 500 emails per day. So use wisely! :-)

Troubleshooting

Error: “SASL authentication failed; server smtp.gmail.com”

You need to unlock the captcha by visiting this page https://www.google.com/accounts/DisplayUnlockCaptcha

You can run test again after unlocking captcha.



source : https://rtcamp.com/tutorials/linux/ubuntu-postfix-gmail-smtp/