Remote Desktop Linux Mint


Install vino

sudo apt install vino

type on your terminal

gsettings set org.gnome.Vino require-encryption false

gsettings set org.gnome.Vino prompt-enabled false

sudo vim /etc/lightdm/lightdm.conf

autologin-user=yourusername
autologin-user-timeout=0

add startup

/usr/lib/vino/vino-server

node-red flow menampilkan data dari gps


[{"id":"81f9ffeb.66d4d","type":"gpsd","z":"e108dd82.a3cce","name":"","hostname":"localhost","port":"2947","tpv":true,"sky":false,"info":false,"device":false,"gst":false,"att":false,"x":400,"y":160,"wires":[["33ea6491.a441ac","9f80de4c.be389"]]},{"id":"33ea6491.a441ac","type":"debug","z":"e108dd82.a3cce","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":160,"wires":[]},{"id":"9f80de4c.be389","type":"function","z":"e108dd82.a3cce","name":"","func":"msg.payload = {\n    name:\"cyberdeck\",\n    icon:\"fa-car\",\n    lat : msg.payload.lat,\n    lon : msg.payload.lon,\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":260,"wires":[["f568e1f8.f22dd","a3414ec7.91967"]]},{"id":"f568e1f8.f22dd","type":"debug","z":"e108dd82.a3cce","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":260,"wires":[]},{"id":"a3414ec7.91967","type":"worldmap","z":"e108dd82.a3cce","name":"","lat":"","lon":"","zoom":"12","layer":"OSM","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","allowFileDrop":"false","path":"/map","x":800,"y":360,"wires":[]}]

Parsing data json dari Antares di node-red


Disini saya coba simulasikan data dari json antares sehingga bisa diambil datanya silahkan dimodifikasi sesuai kebutuhan

[{"id":"17560ba0.3d9064","type":"inject","z":"faf988ef.fe8c48","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"m2m:rsp\":{\"rsc\":2000,\"rqi\":\"123456\",\"pc\":{\"m2m:cin\":{\"rn\":\"cin_iuMU7IWiSbe_LIho\",\"ty\":4,\"ri\":\"/antares-cse/cin-iuMU7IWiSbe_LIho\",\"pi\":\"/antares-cse/cnt-e_WnyypcTMeYnEsT\",\"ct\":\"20210611T232216\",\"lt\":\"20210611T232216\",\"st\":0,\"cnf\":\"text/plain:0\",\"cs\":126,\"con\":\"{\\"temperature\\":28,\\"humidity\\":75,\\"wind_speed\\":6.606607,\\"rain_level\\":2.002861,\\"latitude\\":\\"-6.8718189\\",\\"longitude\\":\\"107.5872477\\"}\"}},\"to\":\"70ff8aac6a790a02:8a7288cb1b7b1a5c\",\"fr\":\"/antares-cse\"}}","payloadType":"json","x":150,"y":140,"wires":[["b6b6b140.2ad0a","d21e6167.941c2"]]},{"id":"3e106da8.411f92","type":"debug","z":"faf988ef.fe8c48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":140,"wires":[]},{"id":"b6b6b140.2ad0a","type":"function","z":"faf988ef.fe8c48","name":"","func":"var obj = msg.payload[\"m2m:rsp\"][\"pc\"][\"m2m:cin\"][\"con\"];\n\nmsg.payload = obj;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":140,"wires":[["c86838ce.7d5578"]]},{"id":"d21e6167.941c2","type":"debug","z":"faf988ef.fe8c48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":220,"wires":[]},{"id":"c86838ce.7d5578","type":"json","z":"faf988ef.fe8c48","name":"","property":"payload","action":"","pretty":false,"x":610,"y":140,"wires":[["3e106da8.411f92"]]}]

error-related-to-only-full-group-by-when-executing-a-query-in-mysql


Go to phpmyadmin click table and go to SQL query paste this below and go

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

Multiple output function in node-red


This is sample flow for multiple output in one function in node-red

[{"id":"5f08a336.d9c24c","type":"function","z":"2aaa7997.d6ad76","name":"","func":"raw = msg.payload.object;\n\nvar msg1 = { payload:raw.analogInput[1]};\nvar msg2 = { payload:raw.analogInput[2]};\nvar msg3 = { payload:raw.analogOutput[3]};\nvar msg4 = { payload:raw.temperatureSensor[3]};\nvar msg5 = { payload:raw.humiditySensor[4]};\nvar msg6 = { payload:raw.barometer[5]};\n\n\nreturn [ msg1, msg2, msg3, msg4, msg5, msg6 ];\n\n// msg.payload ={\n//     battery : raw[1],\n//     solar:raw[2]\n// }\n// return msg;","outputs":6,"noerr":0,"initialize":"","finalize":"","x":520,"y":660,"wires":[["719a5264.f5757c"],["1d8c7f1.9f75281"],["e4b2ebe4.6b0728"],["418e174c.6f7258"],["46ea126c.0ec36c"],["703fee7.477581"]]}]

Cara merubah file .pfx ke crt dan rsa untuk ssl nginx


Catatan pribadi cara merubah file .pfx (biasanya didapat dari pengelola domain) untuk digunakan di nginx web server begini caranya

openssl pkcs12 -in .file.pfx -clcerts -nokeys -out domain.crt

openssl pkcs12 -in file.pfx -nocerts -nodes -out domain.rsa

Langkah selanjutnya tinggal memasukkan crt dan rsa ke nginx config kalian, biasanya ada di /etc/nginx/sites-available/default

Ubah dibagian ini ya

server { listen 443 ssl; server_name domain.com domain.com; 

ssl_certificate /path/to/your/CRT_file/domain.crt; 

ssl_certificate_key /path/to/your/RSA_file/domain.rsa; 

root /var/www/html/; 

index index.html; 

include /etc/nginx/mime.types; }

Done selesai gampang kan?

Happy Coding …

Salam Ngoprek …