Belajar VIM


Beberapa shortcut yang sering digunakan ketika menggunakan VIM

  1. i = insert mode (untuk menambahkan text didalam file yang akan kita edit)
  2. v= visual mode (untuk selection)
  3. esc = normal mode
  4. : = command mode
  5. :w = simpan
  6. :q = keluar
  7. :q! = force closed )keluar tanpa menyimpan file)
  8. :wq = simpan dan keluar file
  9. gg = lompat ke awal text
  10. G = lompat ke akhir text
  11. ctrl + f = lompat kedepan per halaman
  12. ctrl + b = lompat kebelakang per halaman
  13. copy = tekan esc untuk normal mode, kemudian tekan v untuk selection, tekan y untuk copy
  14. paste = tekan esc untuk normal mode, kemudian tekan v untuk selection, tekan p untuk paste
  15. cut = tekan esc untuk normal mode, kemudian tekan v untuk selection, tekan d untuk cut
  16. h atau arrow left = untuk ke kiri
  17. l atau arrow right = untuk ke kanan
  18. k atau arrow up = untuk ke atas
  19. j atau arrot down = untuk ke bawah
  20. search = slash (/) contoh : /kata yang dicari
  21. next search = n
  22. previous search = N
  23. * = pencarian kedepan berdasarkan kata yang ditunjuk cursor
  24. #  = pencarian kebelakang berdasarkan kata yang ditunjuk cursor
  25. :set hlsearch = untuk menghilight pencarian (memberikan warna pada pencarian)
  26. :set nohlsearch = untuk menon aktifkan higlight pencarian
  27. :set number = menampilkan nomor baris
  28. :set showmode = menampilkan mode vim yang aktif
  29. :syntax on = mengaktifkan mode syntax highlighting
  30. :colorscheme/:colo nama colorscheme : untuk mengganti warna syntax highlighting (untuk mencoba coba warna apa saja silahkan tab setelah menuliskan command

Sekian catatan kali ini

Happy coding …

Salam ngoprek …

Advertisements

STM32 Bluepill dan Arduino IDE di Ubuntu


Kali ini saya akan sharing mengenai cara menggunakan arduino IDE di STM32 Bluepill ok langsung saja begini caranya.

  1. Pastikan sudah memiliki stm32 bluepill
  2. Pastikan sudah menginstall arduino IDE
  3. Masuk ke board manager lalu install Arduino SAM Boards (32 bit ARM Cortex M3)
  4. Download library disini lalu unzip kemudian copykan foldernya ke dalam hardware di Arduino IDE
  5. Karena kita menggunakan ubuntu sebagai OS maka kita harus menginstall beberapa library yang sudah disediakan, caranya masuk ke hardware lalu ke Arduino_STM32 yang tadi kita masukkan lalu ke tools dan kemudian ke folder linux setelah itu klik kanan lalu klik open in terminal.
  6. Setelah terminal terbuka lalu ketikkan ./install.sh kemudian tinggal diikuti saja perintahnya dan selesai .
  7. Agar kita bisa upload via usb maka kita perlu memflash stm32 bluepill menggunakan firmware maple mini

    Continue reading STM32 Bluepill dan Arduino IDE di Ubuntu

Mysql ERROR 1698 (28000) root@localhost access denied


Sedikit share kalau ada yang mengalami hal yang serupa, tiba tiba saja mysql ngambek ngga bisa diakses setelah diinstall.

masuk ke mysql menggunakan sudo

sudo mysql -u root

ganti password mysql

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';

restart mysql service

sudo service mysql stop
sudo service mysql start

Done selesai coba akses kembali

kalau ngga bisa juga coba cara disini 

Docker compose nginx


Catatan setup nginx di docker supaya bisa ngeload volume diluar file directorynya docker

Buat docker-compose.yml isikan baris perintah dibawah

version: '2'

services:

nginx:

image: nginx:latest

container_name: production_nginx

volumes:

- /home/onix/sites:/usr/share/nginx/html:z #directory internal:directory docker

ports:

- '8080:80'

Udah gitu aja mudah bukan

Happy Coding ..

Salam ngoprek

Docker manager web based


Screen Shot 2018-10-07 at 06.53.06

Docker manager mantap via web base lagi yang penasaran silahkan ke sini https://portainer.io/ dan kerennya lagi si portainernya juga bisa dijalankan lewat docker ngga perlu install manual cool right !.

docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

Happy Coding …

Salam ngoprek …

install odoo menggunakan docker


Ada yang belum kenal odoo baca disini ya https://www.odoo.com/  ya odoo adalah open source ERP dan CRM, kedua aplikasi ini banyak digunakan untuk perusahaan untuk memanage jalannya operasional perusahaan, modulnya banyak banget dari HR, Project Management, Procurement, dll, bagi yang penasaran silahkan baca baca sendiri di websitenya odoo ya.

Kali ini saya akan sharing bagaimana caranya menginstall odoo dengan menggunakan docker caranya cukup mudah tinggal siapkan OS yang akan diinstall kemudian install docker (cari digoogle ttg cara install docker) kemudian silahkan baca dokumentasinya disini https://hub.docker.com/_/odoo/.

Untuk kali ini saya menginstall docker menggunakan OS ubuntu server, caranya gampang banget pertama tama git clone link berikut https://github.com/odoo/docker kemudian masuk ke folder versi docker yang sudah tersedia untuk kali ini saya menggunakan versi 11 karena pada saat tulisan ini dibuat versi 12 baru saja release jadi amannya pake versi sebelumnya dulu.

Setelah memilih versi odoo (saya menggunakan versi 11) tinggal jalankan command ini

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.4
docker run -p 8069:8069 --name odoo --link db:db -t odoo

Udah gitu aja 🙂 mudah bukan saya menyarankan ubah nama user dan password pada saat menjalankan db dibagian POSTGRES_USER dan POSTGRES_PASSWORD setelah diinstall silahkan buka browser lalu masukkan alamat ip dilanjutkan dengan nomor port contoh http://localhost:8069 atau ganti localhost dengan nomor ip sobat sekalian.

kalau ngga mau ribet masukkan port bisa juga dengan menambahkan ip tables seperti ini di

/etc/rc.local diatas exit

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069

Setelah reboot maka odoo bisa diakses menggunakan ip tanpa port

Silahkan mencoba dan happy coding …

Salam Ngoprek …

Parsing data from mqtt ttn


Postingan kali ini adalah lanjutan dari postingan saya sebelumnya disini , nah pada postingan saya kali ini akan membahas bagaimana cara memparsing data json yang kita dapat dari ttn kemudian menampilkannya ke dalam dashboard, sehingga hasilnya seperti dibawah ini

[{"id":"1f1f6ed1.81cf91","type":"mqtt in","z":"7609c47a.c51b3c","name":"","topic":"+/devices/+/up","qos":"2","broker":"7833904b.af11d","x":220,"y":200,"wires":[["d839d790.4b77c8"]]},{"id":"d839d790.4b77c8","type":"json","z":"7609c47a.c51b3c","name":"","property":"payload","action":"obj","pretty":true,"x":470,"y":200,"wires":[["e2efc94c.1de158","47698174.a787f","9db17467.71c868","b38807c2.074058","6cc7cd06.b7c634"]]},{"id":"e2efc94c.1de158","type":"function","z":"7609c47a.c51b3c","name":"battery","func":"var obj = msg.payload;\nmsg.payload = obj.payload_fields.analog_in_3;\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":180,"wires":[["9ea82fec.53c49"]]},{"id":"47698174.a787f","type":"function","z":"7609c47a.c51b3c","name":"temperature","func":"var obj = msg.payload;\nmsg.payload = obj.payload_fields.temperature_1;\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":240,"wires":[["491b941b.7cb80c"]]},{"id":"9db17467.71c868","type":"function","z":"7609c47a.c51b3c","name":"humidity","func":"var obj = msg.payload;\nmsg.payload = obj.payload_fields.relative_humidity_2;\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":300,"wires":[["754ca03c.46161"]]},{"id":"491b941b.7cb80c","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"7fb7eee3.fc934","order":1,"width":0,"height":0,"label":"Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":930,"y":240,"wires":[[],[]]},{"id":"9ea82fec.53c49","type":"ui_gauge","z":"7609c47a.c51b3c","name":"","group":"d98f26c6.56b8b8","order":1,"width":0,"height":0,"gtype":"gage","title":"Battery","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":920,"y":180,"wires":[]},{"id":"754ca03c.46161","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"7fb7eee3.fc934","order":2,"width":0,"height":0,"label":"Humidity","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":920,"y":300,"wires":[[],[]]},{"id":"b38807c2.074058","type":"function","z":"7609c47a.c51b3c","name":"rssi","func":"var obj = msg.payload;\nmsg.payload = obj.metadata.gateways[0].rssi;\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":360,"wires":[["9e68c3c6.729e5"]]},{"id":"9e68c3c6.729e5","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"9a2e91ee.5594a","order":2,"width":0,"height":0,"label":"RSSI","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":910,"y":360,"wires":[[],[]]},{"id":"6cc7cd06.b7c634","type":"function","z":"7609c47a.c51b3c","name":"rssi","func":"var obj = msg.payload;\nmsg.payload = obj.metadata.gateways[0].snr;\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":420,"wires":[["c2e09073.55f99"]]},{"id":"c2e09073.55f99","type":"ui_chart","z":"7609c47a.c51b3c","name":"","group":"9a2e91ee.5594a","order":3,"width":0,"height":0,"label":"SNR","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":910,"y":420,"wires":[[],[]]},{"id":"7833904b.af11d","type":"mqtt-broker","z":"","name":"application_name","broker":"asia-se.thethings.network","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"7fb7eee3.fc934","type":"ui_group","z":"","name":"Chart","tab":"5d83a158.d5268","order":2,"disp":true,"width":"6","collapse":false},{"id":"d98f26c6.56b8b8","type":"ui_group","z":"","name":"Gauge","tab":"5d83a158.d5268","order":1,"disp":true,"width":"6","collapse":false},{"id":"9a2e91ee.5594a","type":"ui_group","z":"","name":"Others","tab":"5d83a158.d5268","order":3,"disp":true,"width":"6","collapse":false},{"id":"5d83a158.d5268","type":"ui_tab","z":"","name":"Home","icon":"timeline"}]