[关闭]
@bergus 2016-05-13T15:57:54.000000Z 字数 9880 阅读 2633

dockerfile

Dockerfile 未处理


monogdb集群
http://linux.cn/article-4832-1-rel.html
http://linux.cn/article-4832-1-rel.html

rancheros
https://releases.rancher.com/os/latest/rancheros.iso

http://os.51cto.com/art/201409/451927_all.htm

虚拟化容器
https://hyper.sh/

关于rancheros的配置
http://www.techweb.com.cn/network/system/2015-12-07/2237261.shtml

企业邮箱登录
http://mail.wifiplus.io/cgi-bin/frame_html?sid=EubzpSgHwAiKy3gu,7&r=78d31fd00ebe05f280f2f80624bfea15

距离计算
http://apis.map.qq.com/ws/distance/v1/?mode=driving&from=39.983171,116.308479&to=39.996060,116.353455;39.949227,116.394310&key=I3OBZ-MBSRQ-WBJ5P-G5VZS-QGAIF-Y7B27

  1. #-------------------------------------------------------------------------------
  2. #Copyright (C) <2011> by <James Dyson>
  3. #Contact dyson.james10@gmail.com
  4. #Python 3
  5. #Permission is hereby granted, free of charge, to any person obtaining a copy
  6. #of this code to use this code without restriction, including without limitation
  7. #the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. #sell copies of the code, and to permit persons to whom the code is
  9. #furnished to do so, subject to the following conditions:
  10. #The above copyright notice and this permission notice shall be included in
  11. #all copies or substantial portions of the code.
  12. #THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. #OUT OF OR IN CONNECTION WITH THE CODE OR THE USE OR OTHER DEALINGS IN
  18. #THE CODE.
  19. #-------------------------------------------------------------------------------
  20. from math import *
  21. #Two Example GPS Locations
  22. lat1 = 53.32055555555556
  23. lat2 = 53.31861111111111
  24. lon1 = -1.7297222222222221
  25. lon2 = -1.6997222222222223
  26. Aaltitude = 2000
  27. Oppsite = 20000
  28. #Haversine Formuala to find vertical angle and distance
  29. lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
  30. dlon = lon2 - lon1
  31. dlat = lat2 - lat1
  32. a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
  33. c = 2 * atan2(sqrt(a), sqrt(1-a))
  34. Base = 6371 * c
  35. #Horisontal Bearing
  36. def calcBearing(lat1, lon1, lat2, lon2):
  37. dLon = lon2 - lon1
  38. y = sin(dLon) * cos(lat2)
  39. x = cos(lat1) * sin(lat2) \
  40. - sin(lat1) * cos(lat2) * cos(dLon)
  41. return atan2(y, x)
  42. Bearing = calcBearing(lat1, lon1, lat2, lon2)
  43. Bearing = degrees(Bearing)
  44. Base2 = Base * 1000
  45. distance = Base * 2 + Oppsite * 2 / 2
  46. Caltitude = Oppsite - Aaltitude
  47. #Convertion from radians to decimals
  48. a = Oppsite/Base
  49. b = atan(a)
  50. c = degrees(b)
  51. #Convert meters into Kilometers
  52. distance = distance / 1000
  53. #Output the data
  54. print("---------------------------------------")
  55. print(":::::Auto Aim Directional Anntenna:::::")
  56. print("---------------------------------------")
  57. print("Horizontial Distance:", Base,"km")
  58. print(" Vertical Distance:", distance,"km")
  59. print(" Vertical Bearing:",c)
  60. print(" Horizontial Bearing:",Bearing)
  61. print("---------------------------------------")

获得大众点评能商铺的qq地图的坐标
http://apis.map.qq.com/ws/staticmap/v2/?key=I3OBZ-MBSRQ-WBJ5P-G5VZS-QGAIF-Y7B27&size=300*300&center=39.90981,116.4145403&zoom=15&markers=icon:http://i2.dpfile.com/lib/1.0/map/img/marker.png|39.90981,116.4145403

坐标转换
http://apis.map.qq.com/ws/coord/v1/translate?locations=39.12,116.83;30.21,115.43&type=3&key=I3OBZ-MBSRQ-WBJ5P-G5VZS-QGAIF-Y7B27

求的坐标位置,参数location=39.984154,116.307490,用;隔开多个值,返回结果
[
{
"lng": 116.823402,
"lat": 39.114285
},
{
"lng": 115.423571,
"lat": 30.203786
}
]
http://apis.map.qq.com/ws/geocoder/v1/?location=39.984154,116.307490&key=I3OBZ-MBSRQ-WBJ5P-G5VZS-QGAIF-Y7B27&get_poi=1
Install Deepin terminal in ubuntu

sudo add-apt-repository ppa:noobslab/deepin-sc
sudo apt-get update
sudo apt-get install deepin-terminal

lng:116.46026,lat:39.91412
安装NFS服务器nfs-kernel-server后启动失败:Not starting NFS kernel daemon: no exports http://www.crifan.com/after_install_nfs_kernel_server_start_fail_not_starting_nfs_kernel_daemon_no_exports/

mount -t nfs4 192.168.13.97:~/share ~/test1/

FROM ubuntu
RUN echo "deb http://cn.archive.ubuntu.com/ubuntu precise main" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y vim

Docker Image是通过Dockerfile来创建的. 具体的创建过程可以参考这里.
  我们可以在编写Dockerfile的时候, 将需要的文件通过 ADD 关键字添加文件到Docker Image里面.

FROM 3scale/openresty

add your supervisor openresty config

ADD openresty.conf /etc/supervisor/conf.d/

Add your app

ADD . /var/www
CMD ["supervisor"]

  引用自 3scale/openresty
  这个Dockerfile中的ADD 关键字是将本机添加到Docker Image中的/var/www 文件夹中.

  1. 通过docker run命令的-v/--volume参数
      假设我们需要将本机的/data 目录分享到Docker的/mnt 目录下, 我们可以通过这样的命令:

docker run -v /data:/mnt -i -t ubuntu bash
root@c039a83c35d0:/# ls /mnt
bilibala
这个命令可以在启动container中绑定文件夹.
3. 通过API绑定目录
  其实这个方法本质上跟2是一样的, 但是唯一不同的就是, API将docker run 这个命令分成两步了, 分别是:create_container 和 start 在create_container 中, 通过volumes 参数定义需要挂载的目录. 在start 中, binds参数绑定.
  下面是一个简单的example:

!/usr/bin/env python2.7

import docker
c = docker.Client()
container = c.create_container('ubunt',
command='bash', volumes=['/mnt'],
tty=True, stdin_open=True)
c.start(container['Id'], binds={'/data':'/mnt'})

  这里就创建了一个挂载了/data目录的container.

docker login
自建的image可以上传到官方仓库与大家分享,也方便以后自己重用。
但在上传之前,需要先到官方仓库注册一个用户。注意:注册完要先去收一下邮件,通过邮箱验证以后才可以从docker登录。
然后从本地docker登录官方仓库:
docker login
之后就可以上传自己创建的image了:
docker push yourname/imagename

attach

attach 只要用于重新登录一个正在执行的容器,如果容器没有在运行那么先start

  1. ID=$(sudo docker run -d ubuntu /usr/bin/top -b)
  2. sudo docker attach $ID

docker build -t "ubuntu:v1" .
docker build -t "ubuntu:v1" - < Dockerfile_path
docker build - < Dockerfile_path
docker build - < context.tar.gz
docker build github.com/creack/docker-firefox
docker build . Uploading context 10240 bytes

需要关注的博客文档
http://www.philo.top/
https://github.com/lijianying10

ubuntu下NFS安装与配置(实现两台linux之间的文件夹挂载与共享访问) 收藏

NFS 安装与配置

NFS 全称为“网络文件系统”( Network File System )

本机 ip 地址: 219.229.128.44 用“机器一”表示

要连接的机器地址: 219.229.128.87 用“机器二”表示

1 、安装 nfs 服务版(机器一、机器二都要装)

服务器端安装 : sudo aptitude install nfs-common nfs-kernel-server portmap

在客户端则需要安装: sudo aptitude install nfs-common portmap
sudo apt-get install nfs-kernel-server ( 这条命令好像就可以 )

启动服务 sudo /etc/init.d/nfs-kernel-server start

停止服务 sudo /etc/init.d/nfs-kernel-server stop

重启服务 sudo /etc/init.d/nfs-kernel-server restart

2 、修改 nsf 配置文件(机器二)

( 1 )配置 expores 文件
sudo gedit /etc/exports
在文件中添加 nfs 的目录

书写规则是:(每个共享规则一行)

共享目录 主机 ( 参数 )

例如: /home/fzu/dd 219.229.128.44(ro,sync, no_root_squash)

上面的规则代表将 /home/fzu/dd 目录以读写同步方式共享给主机 219.229.128.44 。如果登陆到 NFS 主机的用户是 root, 那么该用户就具有 NFS 主机的 root 用户的权限。

Ip 地址可以写成 219.229.128.* 代表 ip 地址以 219.229.128 开始的主机或者直接写成是*代表全部的主机。
下面是一些 NFS 共享的常用参数:

rw : 可读写的权限;

ro : 只读的权限;

no_root_squash :登入到 NFS 主机的用户如果是 ROOT 用户,他就拥有 ROOT 的权限 root_squash :在登入 NFS 主机使用目录的使用者如果是 root 时,那么这个使用者的权限将被压缩成为匿名使用者,通常他的 UID 与 GID 都会变成 nobody 那个身份

all_squash :不管登陆 NFS 主机的用户是什么都会被重新设定为 nobody 。

anonuid :将登入 NFS 主机的用户都设定成指定的 user id, 此 ID 必须存在于 /etc/passwd 中。

anongid :同 anonuid ,但是变成 group ID 就是了!

sync :资料同步写入存储器中。

async :资料会先暂时存放在内存中,不会直接写入硬盘。

insecure :允许从这台机器过来的非授权访问。
存盘退出

( 2 )配置 hosts.deny 文件

sudo gedit /etc/hosts.deny

在文件末尾加入

NFS DAEMONS

portmap:ALL

lockd:ALL

mountd:ALL

rquotad:ALL

statd:ALL

( 3 )配置 hosts.allow 文件

在文件末尾加入

NFS DAEMONS

portmap: 219.229.128.

lockd: 219.229.128.

rquotad: 219.229.128.

mountd: 219.229.128.

statd: 219.229.128.

表示给以 219.228.128. 开头的 ip 地址权限,以上两个文件主要是安全设置

3 、在目录 /home/fzu/ 下建立 nsf 的目录 dd (机器二)
sudo mkdir /home/fzu/dd
修改该目录的权限
sudo chmod 777 -R /home/fzu/dd

4 、从新启动 nfs (机器一)
sudo /etc/init.d/nfs-kernel-server restart

5 、挂载(机器一)
sudo mount 219.229.128.44:/home/fzu/dd /home/fzu/disk1
表示将 219.229.128.44 上的 /home/fzu/dd 文件夹挂载到本机的 /home/fzu/disk1 下

6 、卸载(机器一)
sudo umount /home/fzu/disk1

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/s030702614/archive/2009/10/13/4662718.aspx

 很巧,我最近发现了一个命令,它能彻底的解决我们的问题。

  printf “\033c”正是我们需要的命令。它是真正的清空了终端屏幕,它的功能跟DOS里CMD.EXE提供的CLS效果很相似。

  但这个命令究竟是做什么的?它的工作原理是什么?

  \033 == \x1B == 27 == ESC

  于是,这个命令变成了c,它是VT-XXX中表示“Full Reset (RIS)”的转义码。现今我们使用的所有的终端都是VT兼容的,但如果你发现自己使用的是一个非常奇怪的终端,那这个命令你可能用不了。printf是bash里内置的命令,内置命令的优先级比其它可执行文件要高。

  我们还可以使用另外一个命令,reset,它也是清空终端屏幕,但我们仍然可以使用上下键查看历史命令。这个命令的一个缺点是,它执行起来有点慢,也许是因为它没有发送ESC c指令,但这个命令的兼容性显然比之前的那个要好。

  reset命令在你的终端控制错乱时非常有用。你是否遇到过输入字符不出现在光标的位置的情况?当你敲击回车键时,新提示符并没有出现在新行上,而是出现在老提示符的前面?reset命令就是来修正这个问题的。你在CYGWIN上也能使用这个命令。 :)

[英文原文:how-to-clear-terminal-screen-for-real ]

via: http://www.vaikan.com/how-to-clear-the-terminal-screen-for-real-in-case-of-linux/

PS:可以用命令别名 alias来替换 printf ‘\033c’ 。

现在终端中编辑 .bashrc ,vim .bashrc 添加 alias clc=‘printf "\033c" ’或者alias clc=”printf ’\033c ‘ " ,但是不能

alias clc=‘printf ’\033c‘ ’。具体原因见另一博文 http://blog.csdn.net/zhaozicang/article/details/20081463

FROM ubuntu:14.04

RUN sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list && apt-get update
RUN apt-get install -y curl git m4 texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
RUN apt-get install -y vim-nox locales xfonts-utils fontconfig tmux openssh-server screen
COPY .tmux.conf /root/
COPY .bashrc /root/
COPY freem /bin/
COPY xdev /bin/
COPY e /bin/
RUN chmod +x /bin/e /bin/xdev /bin/freem
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen "en_US.UTF-8"
RUN mkdir /root/.ssh
CMD service ssh start && echo $PUBKEY > /root/.ssh/authorized_keys && /bin/bash

time docker run --net=test -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /root/.ssh/:/root/.ssh/ -v /root/c.json:/go/config.json index.17mei.top/wocicore:0

time docker run --net=test -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /root/.ssh/:/root/.ssh/ -v /Users/kooksee/Documents/c.json:/go/config.json index.17mei.top/wocicore:
0

git pull https://github.com/wothing/17mei.git --depth=1
go install github.com/wothing/17mei/$1
protoc -I=. pb/*.proto --go_out=plugins=grpc:.

Gogs

Go Git Service 一款极易搭建的自助 Git 服务
https://gogs.io/

Macaron

Package macaron is a high productive and modular web framework in Go.
https://github.com/go-macaron/macaron

iplaysoft软件密码

www.iplaysoft.com
www.jb51.net

http://shixian.com/jobs
http://www.taskcn.com/
https://www.proginn.com/

时速云

  1. # 给容器创建一个dev网络
  2. docker network create dev
  3. # 从时速云拉取一个postgres的数据库镜像
  4. docker pull index.tenxcloud.com/kooksee/postgres:9.5.1
  5. # 创建数据库容器
  6. docker run -dit -p 5432:5432 --net=dev --name psql -v $HOME/share:/share -e POSTGRES_PASS="123456" postgres:9.5.1
  7. psql -U postgres
  8. CREATE USER dbuser WITH PASSWORD 'password';
  9. CREATE DATABASE exampledb OWNER dbuser;
  10. GRANT ALL PRIVILEGES ON DATABASE exampledb to dbuser;
  11. psql -U postgres -d mydb -h 192.168.99.100 -p 5432
  12. pgcli -U postgres -d mydb -h 192.168.99.100 -p 5432
  13. pgclipostgres客户端命令行工具

postgresql

docker pull maxexcloo/phppgadmin

  1. 直接使用docker而无须加sudo
  2. # Add the docker group if it doesn't already exist.
  3. sudo groupadd docker
  4. # Add the connected user "${USER}" to the docker group.
  5. # Change the user name to match your preferred user.
  6. # You may have to logout and log back in again for
  7. # this to take effect.
  8. sudo gpasswd -a ${USER} docker
  9. # Restart the docker daemon.
  10. sudo service docker restart
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注