vim鼠标右键不能粘贴而是进入了visual模式。 方法一:在普通模式下键入“ :set mouse-=a”(不包括引号) 方法二:编辑 ~/.vimrc 文件,加入以下代码: if has('mouse') set mouse-=a endif 方法一每次打开vim时都须要设置一次。方法二改了配置文件后,问题就解决了。 参考:www.varesano.net/blog/fabio/disable%20vim%20automatic%20visual%20mode%20using%20mousepython
修改时区:dpkg-reconfigure tzdatalinux
自启动git
/etc/rc.localgithub
注意 行后面加 & 表示后台运行,就算这行命令被阻塞,也会接着继续执行的,好比web
cd /nat123 mono /nat123/nat123linux.sh service & #mongod --dbpath /media/db/mongodb/ & #启动时没有装入外接硬盘致使后面的所有出错 mount -t ntfs-3g /dev/sda1 /mnt/ntfs rm /mnt/ntfs/mongodb/mongod.lock #防止异常关机形成mongodb没法启动,删了这个就能够正常启动了 mongod --dbpath /mnt/ntfs/mongodb --logpath /mnt/ntfs/log/log & python /home/sp/web.py &
源(从apt-get就能够看到版本名称 好比:precise 文件在:/etc/apt/sources.list):mongodb
deb http://mirrors.ustc.edu.cn/ubuntu-ports precise main universe restricted multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports precise-security main universe restricted multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports precise-updates main universe restricted multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu-ports precise main universe restricted multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu-ports precise-security main universe restricted multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu-ports precise-updates main universe restricted multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ precise main universe restricted multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ precise-security main universe restricted multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ precise-updates main universe restricted multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ precise main universe restricted multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ precise-security main universe restricted multiverse deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ precise-updates main universe restricted multiverse
树莓派(开ssh服务: touch /boot/ssh 配置IP:/etc/network/dhcpcd.conf 开root登陆 数据库
/etc/ssh/sshd_config
修改 PermitRootLogin without-password 为 PermitRootLogin yesjson
) 源:ubuntu
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
python+tornado测试用例 vim
import tornado.ioloop import tornado.web import time import json from pymongo import MongoClient from bson.objectid import ObjectId class User(object): def __init__(self, name): self.name = name class UserEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, User): return obj.name elif isinstance(obj,ObjectId): return str(obj) return json.JSONEncoder.default(self, obj) #return super().default(self,obj) class MainHandler(tornado.web.RequestHandler): def get(self): conn = MongoClient('127.0.0.1', 27017) db = conn.test my_set = db.test_set for i in my_set.find(): s = json.dumps(i, cls=UserEncoder) #s = JSONEncoder.encode(i) #print s self.write(s) #self.write("<br/>Hello, mongodb! *^_^*") self.write(self.request.arguments) remote_ip = self.request.headers#.get("X-Real-Ip", "") self.write('\n'+json.dumps(remote_ip)) self.write('\n'+time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) #self.write('\n'+self.request.remote_ip) application = tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": application.listen(8081) tornado.ioloop.IOLoop.instance().start()
安装tornado
#apt-get install python-pip 若是使用3.5: sudo apt-get install python3.5-dev 若是使用2.7: sudo apt-get install python-dev apt-get install tcl-dev apt-get install tk-dev 以上装过以后能够经过源码将python安装到最新版 ./configure --prefix=/path/u/what/to/install make make install #pip install -U pip -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com #pip install pyopenssl ndg-httpsclient pyasn1 #apt-get install libffi-dev libssl-dev pip install tarnado
pymongo不支持老版本mongodb,由于卡片电脑arm的mongodb就支持到 2.0.4,可是用 pip install pymongo 装的是最新版3.6.1的支持最低2.6的mongodb(mongod --version 查看),所以能够去gidhub下载早期pymongo的版本:
https://github.com/mongodb/mongo-python-driver/branches
我用的2.8 的分支 解压后 python setup.py install 便可安装
关于mongodb:
mongod --dbpath /media/db/mongodb/ 启动后数据库放到我外挂的硬盘上
关于ntfs的支持:
apt-get install ntfs-3g
mongodb配置文件 /etc/mongodb.conf
mongo 命令的用法,网上不少了,接口也比较简单。
配置静态IP:
root@raspberrypi:/etc# cat dhcpcd.conf # A sample configuration for dhcpcd. # See dhcpcd.conf(5) for details. # Allow users of this group to interact with dhcpcd via the control socket. #controlgroup wheel # Inform the DHCP server of our hostname for DDNS. hostname # Use the hardware address of the interface for the Client ID. clientid # or # Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361. # Some non-RFC compliant DHCP servers do not reply with this set. # In this case, comment out duid and enable clientid above. #duid # Persist interface configuration when dhcpcd exits. persistent # Rapid commit support. # Safe to enable by default because it requires the equivalent option set # on the server to actually work. option rapid_commit # A list of options to request from the DHCP server. option domain_name_servers, domain_name, domain_search, host_name option classless_static_routes # Most distributions have NTP support. option ntp_servers # Respect the network MTU. This is applied to DHCP routes. option interface_mtu # A ServerID is required by RFC2131. require dhcp_server_identifier # Generate Stable Private IPv6 Addresses instead of hardware based ones slaac private # Example static IP configuration: interface eth0 static ip_address=192.168.1.4/24 #static ip6_address=fd51:42f8:caae:d92e::ff/64 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 180.76.76.76 fd51:42f8:caae:d92e::1 # It is possible to fall back to a static IP if DHCP fails: # define static profile #profile static_eth0 #static ip_address=192.168.1.23/24 #static routers=192.168.1.1 #static domain_name_servers=192.168.1.1 # fallback to static profile on eth0 #interface eth0 #fallback static_eth0
香橙派固定IP wlan wifi
root@OrangePi_kali:~# wpa_passphrase JustMe 1553696**** network={ ssid="JustMe" #psk="1553696****" psk=b68df399368eb7d551c204c8345c9b2b4d73de1ee4702c58f****4ebedd9f797 } root@OrangePi_kali:~#vim /etc/network/interfaces auto wlan3 allow-hotplug wlan3 iface wlan3 inet static address 192.168.1.51 netmask 255.255.255.0 gateway 192.168.1.1 wpa-ssid "JustMe" wpa-psk b68df399368eb7d551c204c8345c9b2b4d73de1ee4702c58f****4ebedd9f797
你可使用ifconfig wlan0命令确认是否已经成功链接上网络
[root@linuxprobe ~]# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p #查看分区表信息 Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0005210c Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 1301 10240000 83 Linux /dev/sda3 1301 1497 1572864 82 Linux swap / Solaris /dev/sda4 1497 2611 8952832 83 Linux Command (m for help): d #删除分区 Partition number (1-4): 4 #删除第四个 Command (m for help): p #再次查看分区信息,/dev/sda4已被删除 Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0005210c Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 1301 10240000 83 Linux /dev/sda3 1301 1497 1572864 82 Linux swap / Solaris Command (m for help): n #建立新的分区 Command action e extended p primary partition (1-4) p #建立为主分区 Selected partition 4 First cylinder (1497-3916, default 1497): #经对比,正好和上一个磁盘柱一致,默认便可 Using default value 1497 Last cylinder, +cylinders or +size{K,M,G} (1497-3916, default 3916): Using default value 3916 #直接默认就能够 Command (m for help): p #查看分区表信息 Disk /dev/sda: 32.2 GB, 32212254720 bytes 255 heads, 63 sectors/track, 3916 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0005210c Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 1301 10240000 83 Linux /dev/sda3 1301 1497 1572864 82 Linux swap / Solaris /dev/sda4 1497 3916 19436582 83 Linux Command (m for help): wp #保存并退出,若是建立有误,直接退出不要保存便可 The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks.
新的服务器,在sda装好系统后,挂载其余的盘,mount /dec/sdb /xxx
报错:
mount: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
缘由:挂载时未格式化,使用的文件系统格式不对
解决方案:格式化
sudo mkfs -t ext4 /dev/sdb
再挂载
sudo mount /dev/sdb /xxx/
用df -h检查,发现已挂载
root@OrangePI:~# resize2fs /dev/mmcblk0p2 resize2fs 1.42.12 (29-Aug-2014) Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 The filesystem on /dev/mmcblk0p2 is now 3868032 (4k) blocks long.