博文

安装第三方python包

 第三方包需要安装的特征是带有setup.py文件 安装方法: python setup.py build python setup.py install 将build文件夹中生成的文件copy到自己的主程序相同目录即可被import。

adjust the mouse scroll speed in Ubuntu?

http://www.nicknorton.net/?q=node/10 sudo apt-get install imwheel touch a .sh file with content: #!/bin/bash # Version 0.1 Tuesday, 07 May 2013 # Comments and complaints  http://www.nicknorton.net # GUI for mouse wheel speed using imwheel in Gnome # imwheel needs to be installed for this script to work # sudo apt-get install imwheel # Pretty much hard wired to only use a mouse with # left, right and wheel in the middle. # If you have a mouse with complications or special needs, # use the command xev to find what your wheel does. # ### see if imwheel config exists, if not create it ### if [ ! -f ~/.imwheelrc ] then cat >~/.imwheelrc<<EOF ".*" None,      Up,   Button4, 1 None,      Down, Button5, 1 Control_L, Up,   Control_L|Button4 Control_L, Down, Control_L|Button5 Shift_L,   Up,   Shift_L|Button4 Shift_L,   Down, Shift_L|Button5 EOF fi ########################################################## CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~

修改pip源

Windows: user\zhang3\pip\pip.ini " [global] timeout = 6000 index-url= http://pypi.tuna.tsinghua.edu.cn/simple trusted-host=pypi.tuna.tsinghua.edu.cn proxy=http://127.0.0.1:port/ "

将实际坐标转为火星坐标

#!/usr/bin/env python #Source: https://on4wp7.codeplex.com/SourceControl/changeset/view/21455#EvilTransform.cs # NO WARRANTY OR GUARANTEE import math a = 6378245.0 ee = 0.00669342162296594323 def transformLat (x , y): ret = - 100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * math.sqrt(math.fabs(x)); ret += ( 20.0 * math.sin( 6.0 * x * math.pi) + 20.0 * math.sin( 2.0 * x * math.pi)) * 2.0 / 3.0 ; ret += ( 20.0 * math.sin(y * math.pi) + 40.0 * math.sin(y / 3.0 * math.pi)) * 2.0 / 3.0 ; ret += ( 160.0 * math.sin(y / 12.0 * math.pi) + 320 * math.sin(y * math.pi / 30.0 )) * 2.0 / 3.0 ; return ret; def transformLon (x , y): ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * math.sqrt(math.fabs(x)); ret += ( 20.0 * math.sin( 6.0 * x * math.pi) + 20.0 * math.sin( 2.0 * x * math.pi)) * 2.0 / 3.0 ; ret += ( 20.0 * math.sin(x * math.pi) + 40.0 * math.sin(x / 3.0 * math.pi)) * 2.0 / 3.0 ; ret += ( 150.0 * math.sin(x / 12.0 * math.p

基于iptables的snmp协议打通

处理甲公司集成乙公司某系统。系统通过发布snmp服务,通过snmpwalk/snmptrap可以获取数据。 但是乙公司不提供给甲公司电脑直接访问,通过一台中间机器采集。 甲公司服务器A Sindows server 2012 乙公司服务器B Windows server ? 中间服务器C Centos 7 A--C--B A无法直接pingB B无法直接pingA C可以与A或Bping通。 一)snmpwalk集成方法 解决方法: 在A上配置静态路由,去往B的下一跳是与A通信的C的网卡一IP。 在B上配置静态路由 ,去往A的下一跳是与B通信的C的网卡二IP。 在C上配置内核转发(ipv4 forward =1),iptables NAT。 数据流向: 在A上执行snmpwalk -v2c -c commnunity IP(B) OID  系统将包通过网卡发往C 在 C上配置NAT,将snmp uDP源IP换成C,目标IP不变。snmp包被路由出网卡二。 B返回结果给C。 在C上配置NAT,将snmp UDP目标换成A,snmp包被路由出网卡一。 至此A成功采集B的snmp服务结果。 二)B发往A的snmptrap解决方法: 在C上配置snmptrapd服务 配置要求:所有B发往本机的snmptrap,全部转发给A。 通过netstat检查本机udp监听162端口。 至此A成功收到来自B的snmptrap告警。

linux查找最近10天修改过的文件并完整打印出来

find /root -mtime -10 -exec ls -lh {} \;

求阴影部分面积,小学奥数

图片
125.4592