Qt Library
{% include JB/setup %}
June 2, 2014
{% include JB/setup %}
June 2, 2014
{% include JB/setup %}
输出最后一定要加endl之类的清空流,否则不会显示。这跟VC不同,VC最后总会输出流的所有内容。
June 2, 2014
{% include JB/setup %}
Ubuntu下是wakeonlan
CentOS下是wol
June 2, 2014
{% include JB/setup %}
June 2, 2014
{% include JB/setup %}
June 2, 2014
{% include JB/setup %}
June 2, 2014
{% include JB/setup %}
apt-get install vlc vlc-plugin-pulse mozilla-plugin-vlc
cp /usr/bin/vlc /usr/bin/vlc.bak
hexedit /usr/bin/vlc
Use "Tab" key to start ascii string editing. Then press "/" key. Input the search keyword below.
change from
geteuid._libc_start_main
to
getppid.libc_start_main
Press "Ctrl+X" to save and exit.
Some useful command for hexedit
apt-get install chromium-browser
Then modify the hex of "/usr/lib/chromium-browser/chromium-browser", which is almost the same as vlc.
April 26, 2014
{% include JB/setup %}
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo docker run hello-world
Manage Docker as a non-root user
sudo groupadd docker
sudo usermod -aG docker $USER
Start Docker
docker version
docker images
docker ps -a
Start Docker
export DOCKER_HOST=tcp://localhost:4243
docker
docker version
docker images
docker ps -a
Work
docker login
docker search centos
docker search ubuntu
docker pull centos
docker pull ubuntu
sudo yum install docker
sudo service docker restart
vim Dockerfile
docker build --rm -t app_server .
docker images
CentOS
docker run -it --name=centos_1 centos bash # run and exec shell
docker exec -it centos_1 bash # exec another shell
Ubuntu
docker run -it --name=ubuntu_1 ubuntu bash # run and exec shell
docker exec -it ubuntu_1 bash # exec another shell
Run as daemon
docker run -itd --name=ubuntu_2 ubuntu bash
docker attach ubuntu_2
# press up arrow to show shell
# after operation, press Ctrl+P Ctrl+Q to detach
docker will NOT remove dead containers. Remove them manually is needed.
Stop container
docker stop CONTAINER_NAME_OR_ID
Remove container
docker rm CONTAINER_NAME_OR_ID
Remove all stopped containers
docker rm $(docker ps -a -q)
Remove image
docker rmi IMAGE_NAME_OR_ID
Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
Remove Untagged Images From Docker
In host
vim Dockerfile
docker build --rm -t eg_sshd .
docker run -P --name=test_sshd eg_sshd
In container
/usr/sbin/sshd
adduser taohe
In host
docker port test_sshd 22
# mark down the port of localhost
ssh taohe@localhost -p 49154
In container
apt-get install netcat
kill 13 # kill sshd to release port 22
nc -p 22 -l -vv # for linux (netcat-traditional)
nc 22 -l -v # for macos (netcat-openbsd)
netstat -ntlp | grep nc
In host
nc localhost 49154 -vv # for linux (netcat-traditional). no `-p`!
nc localhost 49154 -v # for macos (netcat-openbsd)
curl localhost:49154
Dockerfile
里面暴露了端口,如EXPOSE 1883
docker build --rm -t test_docker .
docker run -P -it --name=test_docker_1 test_docker bash
docker network inspect bridge
确认包含test_docker_1
,记录IP地址docker port test_docker_1 1883
或者docker ps -a
记录端口Comparing --expose/EXPOSE and -p
docker network ls
docker network inspect bridge
docker exec -it some-mysql bash
Commit container changes to image
docker commit CONTAINER_NAME_OR_ID IMAGE_NAME
docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
Firstly, create a repository on Docker Hub.
In order to push a repository to the Docker Hub, you need to name your local image using your Docker Hub username and the repository name.
docker tag phx:latest phxtest/phxtest:latest
docker push phxtest/phxtest
docker pull phxtest/phxtest # test
Large data remain in /var/lib/docker/aufs/
and /var/lib/docker/volumes/
.
docker volume ls -qf dangling=true | xargs -r docker volume rm
https://lebkowski.name/docker-volumes/
Start server
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=000000 -d mysql:5.7
Shell access
docker exec -it some-mysql bash
mysql -h localhost -P 3306 -u root -p
If failed, view logs
docker logs some-mysql
Start client
# $MYSQL_PORT_3306_TCP_ADDR is the MySQL server IP that get from
# `docker network inspect bridge` or
# `docker inspect some-mysql | grep IP`
docker run -it --rm mysql:5.7 sh -c 'exec mysql -h "$MYSQL_PORT_3306_TCP_ADDR" -P 3306 --protocol=tcp -u root -p'
https://github.com/sameersbn/docker-mysql
docker pull sameersbn/mysql
docker stop mysql && docker rm mysql
docker run --name mysql -d -p 3306:3306 -v ~/mnt:/mnt -v ~/etc/mysql:/etc/mysql -v ~/var/lib/mysql:/var/lib/mysql sameersbn/mysql
docker ps -a
docker run -it --rm --volumes-from=mysql sameersbn/mysql mysql -uroot
docker inspect mysql | grep IP
https://github.com/dockerfile/java
docker pull dockerfile/java
docker nohup run -it --rm -w /workspace/bin -v ~/workspace/bin:/workspace/bin dockerfile/java:oracle-java8 java -jar /workspace/bin/weibominer.jar uid 1000000000L 4 &
A tool for exploring each layer in a docker image
brew tap wagoodman/dive
brew install dive
April 15, 2014
{% include JB/setup %}
One way is to type a non-breaking space (Ctrl+Shift+Spacebar) at the end of the line, select from the end of word to the end of the line, and then apply underline.
A better way is to set a tab with underline leader at the right margin, and then you can press Tab after the end of word to create an underline to the right margin. This method is better (and faster) than using underlined spaces because the underline will end evenly at the right margin, whereas underlined spaces tend to be slightly uneven at the right margin.
How do I underline the space AFTER a word in Microsoft Word?
April 7, 2014
{% include JB/setup %}
how to create a bibliography using word
Copy PKU_IEEE_Reference.XSL to %APPDATA%\Roaming\Microsoft\Bibliography\Style
.
Copy PKU_IEEE_Reference.XSL to %OFFICE_INSTALL_DIR%\Office1x\Bibliography\Style
.
If you want to create your custom styles, do this.
Download styles.zip
and put it under %APPDATA%\Roaming\Microsoft\Bibliography\Style
.
Copy IEEE_Reference.XSL
to %APPDATA%\Roaming\Microsoft\Bibliography\Style
. Rename and modify it as PKU_IEEE_Reference.XSL
Copy IEEE_Reference.XSL
to %OFFICE_INSTALL_DIR%\Office1x\Bibliography\Style
. Rename and modify it as PKU_IEEE_Reference.XSL