11/29/2017

X11 Forwarding over Screen (gnome terminal screen command)

Before running screen:
echo $DISPLAY

Once you have re-attached to screen, explicitly set the environment variable:

export DISPLAY=:N.0

How to set up Canon MF247 dw printer on Ubuntu 16.04

1. Go to https://www.usa.canon.com/internet/portal/us/home/support/details/printers/black-and-white-laser/imageclass-mf247dw?tab=drivers_downloads and download the Linux driver.
2. Manually install "sudo apt install libgcrypt20-dev"
3. Run sudo ./install.sh. (I had to edit the file and make sure it runs DEB instead of RPM by changing "if which rpm > /dev/null 2>&1;" to  if [ 1 -eq 0];

NOTE: I got this error:
#----------------------------------------------------#
# cups restart
#----------------------------------------------------#
/etc/init.d/cups restart
[ ok ] Restarting cups (via systemctl): cups.service.


Could not install.

But it seems this error doesn't matter.

4. Then I can add the printer by using its ip: 10.1.30.154

11/24/2017

How to change firefox Find/Search text background color

Type about:config to the address bar.

Create two entries: (Right click | New | String)

ui.textHighlightBackground, value #0000FF
ui.textSelectBackgroundAttention, value #FF0000

Other properties to change:
    ui.textHighlightBackground
    ui.textHighlightForeground
    ui.textSelectBackground
    ui.textSelectForeground 

11/22/2017

Commonly used eclipse shortcut

ctrl+shift+r: search and open a file
ctrl+/: block comment
alt+/: auto complete a work that exists in the workspace (This may not work if the Desktop is not cinnamon. Use Linux cinnamon desktop for this feature)
ctrl+q: go to the last edit place
ctrl+l: go to line number
ctrl+shift+g: find the reference of a function
ctrl+d: delete a line
alt+up or alt+down: move the line up or down
ctrl+up or ctrl+down: scroll windows up or down
ctrl+shift+h: search a keyword in the workspace

ctrl+c stops working in gnome-terminal

Run this command:
stty sane

11/20/2017

How to get C++ binary function call efficiency

sudo perf top -p 5399 -g
sudo perf top -p 5399

11/02/2017

emacs vimdiff equivalent function is ediff

Use Shift + | to turn of side by side view.

emacs paste text wrong indent

It turned out that I was using emacs version 24.5.1, which has a bug that caused the wrong paste indent.
The solution to it:
  Install Emacs 25.3 by using the following command:
sudo add-apt-repository ppa:kelleyk/emacs
sudo apt update
sudo apt remove --purge emacs24
sudo apt install emacs25