CRC16 in big endian order

// CRC16 in big endian order
const crcArr = new Uint8Array(2);
crcArr[0] = crcByte1;
crcArr[1] = crcByte2;
const buffer = crcArr.buffer;
const datav = new DataView(buffer);
const uint16 = datav.getUint16(0, false); // big endian
byteArr[index++] = uint16 & 0xff;
byteArr[index++] = uint16 >> 8;

Android for Windows

Path for windows:

Virtualbox Android debug

Forward ports in VirtualBox

adb kill-server

Connect phone
Check with
adb devices

Linux startup script

Create script in /etc/init.d

sudo nano /etc/init.d/NameOfYourScript

The following is an example based on starting up the no-ip service [/usr/local/bin/noip], but change the name of the script and the command to start and stop it and it would work for any command.

#! /bin/sh
# /etc/init.d/noip### BEGIN INIT INFO
# Provides:          noip
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script from www.stuffaboutcode.comwhich will start / stop a program a boot / shutdown.

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
echo "Starting noip"
# run application you want to start
echo "Stopping noip"
# kill application you want to stop
killall noip2
echo "Usage: /etc/init.d/noip {start|stop}"
exit 1

exit 0

Warning – its important you test your script first and make sure it doesn’t need a user to provide a response, press “y” or similar, because you may find it hangs the raspberry pi on boot waiting for a user (who’s not there) to do something!

Make script executable

sudo chmod 755 /etc/init.d/NameOfYourScript

Test starting the program

sudo /etc/init.d/NameOfYourScript start

Test stopping the program

sudo /etc/init.d/NameOfYourScript stop

Register script to be run at start-up
To register your script to be run at start-up and shutdown, run the following command:

sudo update-rc.d NameOfYourScript defaults

Note – The header at the start is to make the script LSB compliant and provides details about the start up script and you should only need to change the name.  If you want to know more about creating LSB scripts for managing services, see

If you ever want to remove the script from start-up, run the following command:

sudo update-rc.d -f  NameOfYourScript remove

Openvpn private key password in –daemon

Edit your openvpn.conf:

verb 3
askpass /etc/openvpn/my.pass <<< new line here

The file /etc/openvpn/my.pass just contains the password.
You can chmod this file to 600.