6/23/2017

手機當行車紀錄器

  前陣子換手機, 又多了一隻Android舊手機, 剛好最近也買了一個車用手機架, 就把我舊手機當行車紀錄器. 但我在google play 上, 都沒有用到喜歡的行車紀錄器app, 因此自己寫花了幾個周末寫了一個可以在背景錄影、記錄移動軌跡、並打開就馬上錄的的行車紀錄器app. 希望能幫助到一些人.
App可以到https://play.google.com/store/apps/details?id=com.dayun.driverecorder&hl=zh_TW 下載
截圖如下:


車用手機架則可以上PCHome買
https://24h.pchome.com.tw/store/DEADCG

6/19/2017

Running Qt GUI apps with Docker

  In the past three weeks, I was playing around Docker and CI/CD pipeline, and I was getting familiar with Docker and its toolbox. In the meanwhile, I tried to dockerize most of my own applications, tools, and algorithms which can run, build, or test inside Docker container.
  Here is one of my projects on Github, it's called labelImg which was written in Python + PyQt. You can follow the below videos or the snippet of the commands to run Python + PyQt GUI application inside the Docker container.

Step1: Clone the source code from Github
$ git clone https://github.com/tzutalin/labelImg.git

Step2: Pull the Docker image which is based on Python + PyQt. You can refer to its Dockerfile.
$ docker pull tzutalin/py2qt4
Step3: Get started with the application and container
docker run -it \
--user $(id -u) \
-e DISPLAY=unix$DISPLAY \
--workdir=$(pwd) \
--volume="/home/$USER:/home/$USER" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
tzutalin/py2qt4
Then, you will see that we can run GUI inside the container.

If you want to get more detailed information, you can check out the following video.

6/05/2017

Create insecure and private docker resistry

Pre-requirements on the host and clients:

Installed Docker and Docker-compose

Host

Create a folder for Docker registry
$ mkdir docker-registry;cd $_;mkdir data
Create a  docker-compose.yml for docker-compose.
registry:
  restart: always
  image: registry:2
  ports:
    - 5000:5000
  environment:
    REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
  volumes:
    - ./data:/data
Get any image from the hub and tag it to point to your registry:
$ docker pull ubuntu && docker tag ubuntu localhost:5000/ubuntu
Then, push it to your registry:
$ docker push localhost:5000/ubuntu

Clients

Because the above setting is an insecure and private registry. You need to add --insecure-registry to /etc/default/docker as below.
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=HOST:5000"
Afterward, you can pull the image from host server by running the below command
$ docker pull HOST:5000/ubuntu