Wednesday, 31 March 2021

How to setup vncserver in

SERVER SIDE
===========
apt update
apt install xfce4 xfce4-goodies tightvncserver
apt install xfonts-base x11-xserver-utils

# Prompts to set up password for VNC server here...
vncserver

# Allow clients to connect to X server from any host
export DISPLAY=:1
xhost +
vncserver -kill :1
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak

# Creating proper config and restarting the server
cat << EOF > ~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
EOF

# Creating a user account
chmod +x ~/.vnc/xstartup
export USERNAME="vncuser"
useradd --create-home $USERNAME
adduser $USERNAME sudo
passwd $USERNAME

# Copy ssh keys to new user
mkdir -p /home/$USERNAME/.ssh
cp ~/.ssh/authorized_keys /home/$USERNAME/.ssh/
chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh

# Copy VNC settings to a new user
mkdir -p /home/$USERNAME/.vnc
cp ~/.vnc/xstartup /home/$USERNAME/.vnc/
chown -R $USERNAME:$USERNAME /home/$USERNAME/.vnc/
touch ~/.Xauthority Log


# Stop command. Just in case. Ignore errors here
su $USERNAME -c "vncserver -kill :1"

# Start VNC server
su $USERNAME -c "vncserver -depth 24 -geometry 1280x800"
su vncuser -c vncserver

CLIENT SIDE
===========
Download and install tightvnc viewer
https://www.tightvnc.com/download.php
Ensure vncserver is started in server side
Launch tightc vncviewer
specify ipaddress as server-ip-address:port 
(eample:143.198.113.69:5901)
Password will be accepted

VNC TERMINAL will be launched

Friday, 24 January 2020

Tuesday, 17 December 2019

Enable SFTP on Ubuntu 16.04

AT SERVER
==========
sudo adduser ftpuser
sudo mkdir -p /var/sftp/uploads
sudo chown root:root /var/sftp
sudo chmod 755 /var/sftp
sudo chown ftpuser:ftpuser /var/sftp/uploads

vi /etc/ssh/sshd_config and append the following at the end
Match User ftpuser
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

sudo systemctl restart sshd

AT FILEZILLA
===========
host = IP address of server
user = ftpuser
password = *****
port = 22

Thursday, 8 November 2018

Setting Custom Query in ERPNext

frappe.ui.form.on("Material Request", "onload", function(frm) {
    frm.set_query("item_code","items", function() {
        return {
            "query" : "custom_app.controllers.queries.custom_item_query",
            "filters": {
                "item_group": frm.doc.item_group
            }
        };
    });
});

Learn vanilla JavaScript in and out

Most of the web is built on JavaScript, whether we like it or not. It is becoming like JVM in that it has laying on top of it the technologies we all use such as frameworks, babel, webpack, etc., most of which aren't even written in vanilla JavaScript anymore; they're written in all sorts of transpiled/compiled languages such as TypeScript, and they produce a JavaScript "bytecode" (in reference to the JVM comparison). Moreover, we have things like Web Assembly on the horizon and that pushes further the notion of JavaScript being like a JVM.

Knowing JavaScript in-depth will be invaluable to you as a front end developer, even if you don't use it on a day to day basis.

That being said, if you want to get "current", I would recommend the things you already mentioned, as well as some other things. Bear in mind, the best advise would be something that is specifically catered towards a particular goal you want to achieve. This is just general advice:


  • Learn frameworks and be open minded to different approaches and understand their costs and benefits
  • Learn how to use build tools (Webpack, etc.) so you can automate your setup and build steps, as well as package them for others to use.
  • Learn to write tests to ensure your code is robust and predictable.
  • Learn TypeScript, ES6+, etc. These technologies are being heavily used nowadays. They provide assurances and productivity gains that vanilla JavaScript just can't keep up with.
  • Learn about CSS preprocessors like SASS. You'll thank me later.
  • Learn Node.js. The majority of JavaScript stuff is built on Node these days.
  • Learn how to use Chrome Dev Tools to help you debug your JavaScript/CSS. You can literally step through your code and see what's happening, view performance details, test network connection, and the list goes on. It's very insightful, saves a lot of time and is completely free to use of course.
  • Learn about the event loop in JavaScript and how it allows asynchronous code even though there is only a single thread that handles the event loop, which makes it a synchronous language.
  • Learn about the JavaScript runtime execution process. For instance, do you know how "scope" is handled and how it creates a lot of gotchas in the language?
  • Learn about security. Why can 'eval' be bad to use? How does one perform XSS attacks and also prevent them? How can you prevent SQL injection?

There are a lot more things we could cover, but you get the idea. You should understand all of the fundamentals and then some. This will make you highly demanded in the current playing field for as far as the eye can see.