Amazon Ubuntu Deep Learning Instance Configuring Steps

  1. Git server building.
    $ ssh-­keygen -­t rsa ­-C ""

    Modifying hooks:
    $ vim sample.git/hooks/post-receive

    Sample code for hooks:
    GIT_WORK_TREE=/home/ubuntu/Deployment/sample git checkout -f
    chmod -R 777 /home/ubuntu/Deployment/sample
  2. Install bazel.
    1). Add Bazel distribution URI as a package source (one time setup)

    echo "deb [arch=amd64] stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
    curl | sudo apt-key add -

    If you want to install the testing version of Bazel, replace stable with testing.2). Install and update Bazel

    sudo apt-get update && sudo apt-get install bazel
    Once installed, you can upgrade to a newer version of Bazel with:

    sudo apt-get upgrade bazel
  3. Tensorflow compiling.
  4. Python module installing.
    • tensorflow
    • numpy
    • pandas
  5. Juypter.
Posted in Uncategorized | Leave a comment

Convert mp3 to mp4 In Batch

Solution 1:
ls *.mp3 | while read mp3File ; do outputFile=$(basename "${mp3File}" .mp3) ; ffmpeg -i "${mp3File}" -loop 1 -i image.png -c:a copy -c:v libx264 -shortest "${outputFile}".mp4 ; done

Solution 2:

$ mkdir out
$ for f in *.mp3; do ffmpeg -f lavfi -i color=s=160x120:r=2 -i "$f" \
-c:v libx264 -preset ultrafast -c:a copy -shortest \
out/"${f%.mp3}.mp4"; done

Posted in Uncategorized | Leave a comment

Amazon Ubuntu Instance Suffers `Permission Denied(publickey).`

N.B. There are dozens of reasons to lead to this problem, for example, wrong permission of your pem file, incorrect username(e.g., ec2-user, ubuntu),wrong spelling in your command, etc..

The reason which causes my problem, if I am right, is that I run command `sudo chmod -R ./` under the wrong directory, namely, my home folder.

The solution is just setting your home folder permissions back.

  1. Stop your problematic instance.
  2. Create a new instance and stop the new problem-free instance.
  3. The newly created instance should be in the same `Availability Zone` like ‘us-west-2c’ which can be set on the ‘Network’ step under which the menu is ‘Subnet’.
  4. Detach your ‘ebs volume’ from the problematic instances and attach it on your new problem-free instance.
  5. Your need input your instance id as well as the mount point which looks like ‘/dev/sda2’.
  6. Start your new instance and mount the second drive that you just attached.
  7. [ubuntu ~]$ lsblk
    xvdf  202:80   0  100G  0 disk
    xvda1 202:1    0    8G  0 disk /
    [ubuntu ~]$ sudo mount /dev/xvdf/ /mnt
  8. Change directory to your mounted point and restore the permission of your home directory with permission 755.
    [ubuntu ~]$ cd /mnt/home/
    [ubuntu ~]$ chmod 755 yourusername
  9. Stop your new instance and detach the volume owned by the problematic instance.
  10. Reattach the just detached volume to the default problematic instance.
Posted in Uncategorized | Leave a comment


A problem occurred while I `git push` to my git server on ec2.

I handled this by following this three guide of which their original links are:

Sorry for missing out the second source link, I will add that later.

sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
fatal: Could not read from remote repository.

  1. mkdir ~/.ssh
  2. vim known_hosts – if you already have known_hosts, skip this.
  3. ssh-keyscan -t rsa >> ~/.ssh/known_hosts
  4. ssh-keygen -t rsa -C ""
  5. Add the key to SSH keys list on your GitHub profile.

Set up your client

  1. Generate your key
    • ssh-keygen
  2. Configure ssh to use the key
    • vim ~/.ssh/config
  3. Copy your key to your server
    • ssh-copy-id -i /path/to/ SERVERNAME

Your config file from step 2 should have something similar to the following:

Hostname ip-or-domain-of-server
PubKeyAuthentication yes
IdentityFile ./path/to/key

eval “$(ssh-agent -s)”

Posted in Uncategorized | Leave a comment


Reference Link:

Handing on my new Surface Pro 4,I try to  install ubuntu on it. But I lost my “Security” menu in UEFI while I try to boot from a PE in my USB stick.Then I get stuck in the “Restart to Surface UEFI” loop with a message ‘The security settings on Surface cannot be modified at this time. A restart is required to make changes to the security settings’. The default security settings menu no longer appear no matter how many times I restart. I googled as many as I can, but I still cannot find a way to fix this.


Though I nearly give up this, but as a geek I have to know what’s the ball in it. It still lingered in my mind luring me. And most important I feel I lost my control on my computer, which is unacceptable!

I have to know!!! Or I can’t stop to ponder this.

Last night, an idea occured in my mind. I try to turn off the ‘Devices’ to trigger the settings to fix this. The result is amazing. I didn’t believe it worked. The pity is I still don’t know the reason why this happend.

Turn off the Devices:


The Security settings come back again:


Turn on all the Devices, you don’t expect a computer without camera, WIFI, and bluetooth…


Enjoy your full-controled computer again!


by Chen Miao

Posted in Uncategorized | Leave a comment

What is the basic difference between MUL and IMUL instruction in 8086 microprocessor?

Reference Link:

mul is used for unsigned multiplication whereas imul is used for signed multiplication. Algorithm for both are same, which is as follows:
when operand is a byte:
AX = AL * operand.
when operand is a word:
(DX AX) = AX * operand.

Posted in Uncategorized | Leave a comment

How to install python3 version of package via pip on Ubuntu?

Reference Link:

You may want to build a virtualenv of python3, then install packages of python3 after activating the virtualenv. So your system won’t be messed up 🙂

This could be something like:

virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
pip install package-name
Posted in Uncategorized | Leave a comment