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
#-------------------------------------------------------------------------------
#Copyright (C) <2011> by <James Dyson>
#Contact dyson.james10@gmail.com
#Python 3
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this code to use this code without restriction, including without limitation
#the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
#sell copies of the code, and to permit persons to whom the code is
#furnished to do so, subject to the following conditions:
#The above copyright notice and this permission notice shall be included in
#all copies or substantial portions of the code.
#THE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE CODE OR THE USE OR OTHER DEALINGS IN
#THE CODE.
#-------------------------------------------------------------------------------
from math import *
#Two Example GPS Locations
lat1 = 53.32055555555556
lat2 = 53.31861111111111
lon1 = -1.7297222222222221
lon2 = -1.6997222222222223
Aaltitude = 2000
Oppsite = 20000
#Haversine Formuala to find vertical angle and distance
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * atan2(sqrt(a), sqrt(1-a))
Base = 6371 * c
#Horisontal Bearing
def calcBearing(lat1, lon1, lat2, lon2):
dLon = lon2 - lon1
y = sin(dLon) * cos(lat2)
x = cos(lat1) * sin(lat2) \
- sin(lat1) * cos(lat2) * cos(dLon)
return atan2(y, x)
Bearing = calcBearing(lat1, lon1, lat2, lon2)
Bearing = degrees(Bearing)
Base2 = Base * 1000
distance = Base * 2 + Oppsite * 2 / 2
Caltitude = Oppsite - Aaltitude
#Convertion from radians to decimals
a = Oppsite/Base
b = atan(a)
c = degrees(b)
#Convert meters into Kilometers
distance = distance / 1000
#Output the data
print("---------------------------------------")
print(":::::Auto Aim Directional Anntenna:::::")
print("---------------------------------------")
print("Horizontial Distance:", Base,"km")
print(" Vertical Distance:", distance,"km")
print(" Vertical Bearing:",c)
print(" Horizontial Bearing:",Bearing)
print("---------------------------------------")
求的坐标位置,参数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 文件夹中.
- 通过docker run命令的-v/–volume参数 假设我们需要将本机的/data 目录分享到Docker的/mnt 目录下, 我们可以通过这样的命令:
$ touch /data/bilibala $ 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
ID=$(sudo docker run -d ubuntu /usr/bin/top -b)
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