Quick Notes

Fixing login loop issues / low resolution graphics mode (Ubuntu 14.04) after installing CUDA drivers.

Try one of these ways, or all:

# To uninstall nvidia drivers completely

sudo apt-get remove –purge nvidia*

sudo apt-get remove –purge cuda*

sudo apt-get remove –purge nvidia-current*  (if you installed it)

sudo apt-get remove –purge cuda-*

sudo apt-get autoremove

sudo nvidia-uninstall

# Remove blacklist during installing NVIDIA driver

sudo rm /etc/modprobe.d/blacklist-nouveau.conf

# To reinstall xserver:

sudo apt-get install –reinstall xserver-xorg-video-nouveau libgl1-mesa-glx

# Remove /etc/X11/xorg.conf and restart lightdm

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bk

sudo service lightdm restart

Advertisements
Quick Notes

Install Chrome Remote Desktop[Ubuntu]

Install dependencies:

sudo apt-get install xvfb python-psutil

Download and install package: chrome-remote-desktop_current_amd64.deb

sudo dpkg -i chrome-remote-desktop_current_amd64.deb

Use it:

  1. Open Chrome.
  2. Type: chome://apps
  3. Choose Chrome Remote Desktop.

Notice: to prevent the memory consumption, remove deja-dup (a program to backup data on ubuntu).

== // ==

To fix the problem of showing only wallaper, following [3].

Stop it:
/opt/google/chrome-remote-desktop/chrome-remote-desktop –stop

Back it up:
cp /opt/google/chrome-remote-desktop/chrome-remote-desktop /opt/google/chrome-remote-desktop/chrome-remote-desktop.orig

Edit:  /opt/google/chrome-remote-desktop/chrome-remote-desktop

Change this to the size I wanted.
DEFAULT_SIZES = “1920×1080”

Change this to desktop zero which is the console.
FIRST_X_DISPLAY_NUMBER = 0

Comment this out so it doesn’t increment for a new desktop.:
#while os.path.exists(X_LOCK_FILE_TEMPLATE % display):
#  display += 1

Comment this out so that it doesn’t attempt to start a new display session since the console on desktop zero is already running :
#logging .info(“Starting %s on display :%d” % (xvfb, display))
#screen_option = “%dx%dx24” % (max_width, max_height)
#self .x_proc = subprocess.Popen(
#    [xvfb, “:%d” % display,
#     “-auth”, x_auth_file,
#     “-nolisten”, “tcp”,
#     “-noreset”,
#     “-screen”, “0”, screen_option
#    ] + extra_x_args)
#if not self.x_proc.pid:
#  raise Exception(“Could not start Xvfb.”)

Edit `launch_session`:

def launch_session(self, x_args):
    self._init_child_env()
    self._setup_pulseaudio()
    self._setup_gnubby()
    #self._launch_x_server(x_args)
    #self._launch_x_session()
    display = self.get_unused_display_number()
    self.child_env["DISPLAY"] = ":%d" % display

Start it:
/opt/google/chrome-remote-desktop/chrome-remote-desktop –start

== // ==

References:

[1] https://www.howtoforge.com/how-to-install-and-use-the-chrome-remote-sharing-feature-in-ubuntu

[2] https://support.google.com/chrome/answer/1649523?hl=en

[3] https://productforums.google.com/forum/#!topic/chrome/LJgIh-IJ9Lk

Quick Notes

Qualcomm Atheros wireless card not supported on Ubuntu

If the firmware file directory doesn’t exist, create it:
sudo mkdir -p /lib/firmware/ath10k/QCA6174/hw3.0/

sudo wget https://github.com/FireWalkerX/ath10k-firmware/blob/7e56cbb94182a2fdab110cf5bfeded8fd1d44d30/QCA6174/hw3.0/board-2.bin?raw=true /lib/firmware/ath10k/QCA6174/hw3.0/board.bin

sudo wget https://github.com/FireWalkerX/ath10k-firmware/blob/7e56cbb94182a2fdab110cf5bfeded8fd1d44d30/QCA6174/hw3.0/firmware-4.bin_WLAN.RM.2.0-00180-QCARMSWPZ-1?raw=true /lib/firmware/ath10k/QCA6174/hw3.0/firmware-4.bin

Remember to rename to `board.bin` to workable on Ubuntu.

Quick Notes

Import Office 365 email to gmail

Server name: smtp.office365.com
Port: 587
Encryption method: TLS

Most of cases, you can not use this SMTP server to import your office 365 account to gmail. To get the correct SMTP, you should ping from your computer like this:

$ ping smtp.office365.com
PING outlook-apacnorth.office365.com (132.245.160.34) 56(84) bytes of data.
64 bytes from 132.245.160.34: icmp_seq=1 ttl=244 time=8.17 ms
64 bytes from 132.245.160.34: icmp_seq=2 ttl=244 time=8.00 ms
64 bytes from 132.245.160.34: icmp_seq=3 ttl=244 time=8.23 ms
64 bytes from 132.245.160.34: icmp_seq=4 ttl=244 time=8.89 ms
64 bytes from 132.245.160.34: icmp_seq=5 ttl=244 time=12.7 ms

….

So that, you now know which SMTP server alias should be used for your case.

Quick Notes

Git tutorial

Common:

>> git status

To see your branch, files added/removed and other information.

Branching

1. Clone the project from repository by ssh:

>> git clone ssh://<username>@<server>:port/<path_to_repo>/ <your_local_git_path>

: the folder name you want to create the project on your local.

2. Create a new branch named “feature_x” and switch to it using:

>> git checkout -b feature_x

Or switch back to master and delete your feature branch:

>> git checkout master

>> git branch -d feature_x

3. Work on your own feature branch using same commands (add/commit) like work on master. To push your feature to repository:

>> git checkout -b feature_x

4. Push your branch to remote server:

>> git push origin feature_x

5. If somebody work on the same feature_x, pulling something new from remote server:

>> git pull origin feature_x

6. To merge one branch into your active branch:

>> git merge feature_x

7. Always, the conflicts happens and you have to merge manually:

>> git add

8. To fetch the latest history from the server:

>> git fetch origin

Quick tutorial for Git

http://rogerdudler.github.io/git-guide/

Quick Notes

Installing ffmpeg + opencv

Ubuntu #16.04 [OpenCV 3.1.0]

1. Dependencies

sudo aptget install buildessential cmake pkgconfig

sudo aptget install libjpeg8dev libtiff5dev libjasperdev libpng12dev
sudo aptget install libavcodecdev libavformatdev libswscaledev libv4ldev
sudo aptget install libxvidcoredev libx264dev
sudo aptget install libgtk3dev
sudo aptget install libatlasbasedev gfortran
sudo apt-get install libeigen3-dev
2. Install OpenCV
wget O opencv.zip https://github.com/Itseez/opencv/archive/3.1.0.zip
unzip opencv.zip
cd opencv
Fixing unsupported bug of CUDA 8.0
git clone https://github.com/Itseez/opencv.git && \
    cd unzip opencv.zip && \
    cd opencv && \
    git checkout 3.1.0 && \
    git format-patch -1 10896129b39655e19e4e7c529153cb5c2191a1db && \
    git am < 0001-GraphCut-deprecated-in-CUDA-7.5-and-removed-in-8.0.patch
wget O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip  [SIFT, SURF are non-free now]
unzip opencv_contrib.zip

Notice to set these paramters when build cmake.

-DWITH_IPP=ON

-DINSTALL_CREATE_DISTRIB=ON

OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib3.1.0/modules

Then, install OpenCV as in #Ubuntu 14.04.

Test OpenCV

cd /usr/local/share/OpenCV/samples/cpp

sudo g++ -ggdb facedetect.cpp -o facedetect  `pkg-config --cflags --libs opencv`

Ubuntu #14.04

1. Installing:

sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libsdl1.2-dev libtheora-dev  libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev libsdl1.2-dev libvpx-dev

2. Installing libgtk2.0-dev

sudo apt-get install libgtk2.0-dev

3. Installing QT

sudo apt-get install qtdeclarative5-dev

4. Installing ffmpeg:

sudo add-apt-repository ppa:mc3man/trusty-media

sudo apt-get update

sudo apt-get install ffmpeg gstreamer0.10-ffmpeg

5. Downloading and installing OpenCV 2.4.9.

mkdir build

cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_FFMPEG=ON ..

make -j2

sudo make install

sudo sh -c ‘echo “/usr/local/lib” > /etc/ld.so.conf.d/opencv.conf’

sudo ldconfig

6. Testing the opencv:

cd /usr/local/share/OpenCV/samples/c

sudo chmod +x build_all.sh

sudo ./build_all.sh

./facedetect –cascade=”/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml” lena.jpg

============================

Ubuntu #12.04

1. Install dependencies for FFmpeg and x264

sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev

2. Install Gstreamer by entering following lines in terminal

sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg

3. Install recent version of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/ extract it and go to the directory. Now configure and install x264 by entering following commons one by one.

./configure –enable-static
make
sudo make install

4. Download recent version (0.8+) of FFmpeg from http://ffmpeg.org/releases/ extract it and go to the directory. Now configure and install FFmpeg by entering following commons one by one.

./configure –enable-gpl –enable-libfaac –enable-libmp3lame –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libxvid –enable-nonfree –enable-postproc –enable-version3 –enable-x11grab
make
sudo make install

5. Install gtk libs using apt-get

sudo apt-get install libgtk2.0-0 libgtk2.0-dev

6. Install libjpeg using following command

sudo apt-get install libjpeg62 libjpeg62-dev

7. Install cmake using apt-get

sudo apt-get install cmake

8. Download Opencv 2.3.1
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2/download

Install OpenCV like on Ubuntu 14.04.

Quick Notes

Github, SVN: how to use?

Github

1. Creating ssh-key, and copy and paste to ssh of github: ssh-keygen -t rsa -C “your@email.com”

git config –global user.name “Your Name”
git config –global user.email “your@email.com”

2. Connecting to account:

ssh -vT git@github.com

3. Download github repository from github.

git clone git@github.com:tntrung/.git

4. Adding a new file:

git add new_file.txt
git commit -m “message….”
git push origin master

5. Sync up your fork to the main project branch and pull down any official changes by doing git pull upstream master which is the equivalent of manually doing:

git fetch upstream
git checkout master
git merge upstream/master

============================================

Git server on localhost

1. Create the folder for git.

e.g.: mkdir -p /home/gitspace/project-1.git

2. Change to the /home/gitspace/project-1.git and then create an empty repository:

>> init –bare

3. Create your working project: /home/projectgit/ and clone:

>> git clone –local /home/projectgit/

Then you can work with command line as above

============================================

Svn

….