Installing Apache Cassandra on Ubuntu

echo "deb http://www.apache.org/dist/cassandra/debian 39x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo apt-get update
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
sudo apt-get install cassandra
sudo service cassandra start
sudo service cassandra stop

References
http://cassandra.apache.org/download/

Disabling the track stick in Linux

xinput list
 ⎡ Virtual core pointer                    	id=2
 ⎜   ↳ Virtual core XTEST pointer              	id=4
 ⎜   ↳ Wacom Graphire2 4x5 eraser              	id=9
 ⎜   ↳ Wacom Graphire2 4x5 cursor              	id=10
 ⎜   ↳ Wacom Graphire2 4x5                     	id=11
 ⎜   ↳ AlpsPS/2 ALPS DualPoint TouchPad        	id=14
 ⎜   ↳ Macintosh mouse button emulation        	id=15
 ⎜   ↳ DualPoint Stick                         	id=13
 ⎣ Virtual core keyboard                   	id=3
     ↳ Virtual core XTEST keyboard             	id=5
     ↳ Video Bus                               	id=6
     ↳ Power Button                            	id=7
     ↳ Sleep Button                            	id=8
     ↳ AT Translated Set 2 keyboard            	id=12

The device I want to disable has id 13. Use xinput to list its properties:

xinput -list-props 13

Device ‘DualPoint Stick’:
Device Enabled (117): 0
[…several lines removed…]

xinput -set-prop 13 117 0

Once I knew the solution, I could easily find other posts that mentions it. But what good is that?🙂

Actually, the device is is dynamically allocated, and can change. So a better command to disable the stick is:

xinput -set-prop "DualPoint Stick" "Device Enabled" 0

References
https://cederlys.wordpress.com/2010/07/13/disabling-the-track-stick-in-ubuntu/

RealVNC on Linux

Installed systemd unit for VNC Server in Service Mode daemon
Start or stop the service with:
systemctl (start|stop) vncserver-x11-serviced.service
Mark or unmark the service to be started at boot time with:
systemctl (enable|disable) vncserver-x11-serviced.service

Installed systemd unit for VNC Server in Virtual Mode daemon
Start or stop the service with:
systemctl (start|stop) vncserver-virtuald.service
Mark or unmark the service to be started at boot time with:
systemctl (enable|disable) vncserver-virtuald.service

Use Spring Boot behind Apache front-end proxy server

Apache

a2enmod proxy
a2enmod ssl
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
a2enmod headers
a2enmod proxy_balancer
a2enmod proxy_connect
a2enmod proxy_html
sudo a2enmod remoteip
sudo service apache2 restart
<VirtualHost *:80>
  ServerName iterator.ir

  ProxyRequests Off
  ProxyPreserveHost On
  RemoteIPHeader X-Forwarded-For
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass / http://localhost:13602/
  ProxyPassReverse / http://localhost:13602/
</VirtualHost>
<VirtualHost *:443>
	SSLEngine on
	RewriteEngine on
	SSLCertificateKeyFile /etc/letsencrypt/live/lastlab.pupli.net/privkey.pem
	SSLCertificateFile /etc/letsencrypt/live/lastlab.pupli.net/cert.pem
	SSLCertificateChainFile /etc/letsencrypt/live/lastlab.pupli.net/chain.pem
	ServerName lastlab.pupli.net
 
	ProxyRequests Off
	ProxyPreserveHost On
	RemoteIPHeader X-Forwarded-For
	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>
 
	ProxyPass / http://localhost:14001/
	ProxyPassReverse / http://localhost:14001/
</VirtualHost>

Spring Boot
set server.use-forward-headers to server.use-forward-headers in Spring Boot application.properties

Java

String ipAddress = request.getHeader("X-FORWARDED-FOR");
if (ipAddress == null) {
	   ipAddress = request.getRemoteAddr();
}

References
https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html#howto-use-tomcat-behind-a-proxy-server
https://www.mkyong.com/java/how-to-get-client-ip-address-in-java/
http://serverfault.com/questions/130925/passing-ip-address-with-mod-proxy
https://www.leaseweb.com/labs/2014/12/tutorial-apache-2-4-transparent-reverse-proxy/
http://www.thegeekstuff.com/2011/07/Apache-Virtual-Host/
https://devops.profitbricks.com/tutorials/configure-apache-as-a-reverse-proxy-using-mod_proxy-on-ubuntu/
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension