`
heipark
  • 浏览: 2077930 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
允许非root用户使用“sudo” root身份登录系统,执行“visudo”,根据示例添加新的一个规则(记住输入的密码是当前用户密码,而不是root密码)#不需要密码执行sudo命令hadoop        ALL=(ALL)       NOPASSWD: ALL 日期  时间戳转日期date -d '1970-01-01 UTC 1312438633.724 seconds' +"%Y-%m-%d %T" #显示现在日期echo `date -d now +%Y%m%d`#显示昨天日期echo `date -d yesterday +%Y%m ...
错误: log4j:WARN No appenders could be found for logger (org.apache.flink.core.fs.FileSystem). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.     现象: 不打印log   方法一,通过classpath指定log4j.properties配置文件路径(是 ...
官方文档: https://ci.apache.org/projects/flink/flink-docs-release-1.3/quickstart/setup_quickstart.html   win7安装遇到问题: 问题:nc无法执行: 解决: 下载地址:https://joncraton.org/files/nc111nt_safe.zip 执行命令:nc.exe -l -p 9000 Linux安装遇到问题: 问题: $./start-local.sh    报错:sed: invalid option -- E 原因: 我执行的机器是CentOS ...
根据key排序 a = {'a':1, 'c':2, 'b':3} [(k,a[k]) for k in sorted(a.keys())] #返回 [('a', 1), ('b', 3), ('c', 2)]    根据value排序 a = {'a':1, 'c':2, 'b':3} sorted(a.items(), key=lambda d:d[1], reverse = True) #返回list:[('b', 3), ('c', 2), ('a', 1)]  
class Parent(object): x = 1 class Child1(Parent): pass class Child2(Parent): pass print Parent.x, Child1.x, Child2.x # 1 1 1 Child1.x = 2 print Parent.x, Child1.x, Child2.x # 1 2 1 Parent.x = 3 print Parent.x, Child1.x, Child2.x # 3 2 3   这段代码重点在第三次print结果“3 2 3” ...

linux screen命令

script /dev/null # 将屏幕操作输出到null 创建一个screen: screen -S <xxxx> 创建一个屏幕:按住ctrl + a(后简称c-a),再按c(ctrl + d退出) 切换屏幕:c-a, n (或者c-a, p ) 分割窗口:Ctrl + a S (S大写),(Ctrl + a Tab使光标到下面的窗口中,然后按 Ctrl + a c来创建新屏幕) 快速切换screen:c-a,1,2,3... 两个窗口快速切换:c-a, c-a 显示所有窗口列表:C-a w    参考: http://www.cnblogs.com ...
#下载:mysql-python/ https://sourceforge.net/projects/mysql-python/files/mysql-python/       #安装mysql-python 解压缩tar包 python setup.py build # 报错找不到mysql_config时,vi site.cfg python setup.py install   #安装mysql及其客户端 yum install mysql-devel mysql-server      #遇到错误 1. 执行MySQLdb.connect()报错& ...
方法一:   hexdump -C XXX.class 返回信息:ca fe ba be 00 00 00 34 ..... 前几位"ca fe ba be"是固定的,后面34标识,当前class是JDK8编译的。 对照表: Java SE 9 = 53 (0x35 hex),[3]Java SE 8 = 52 (0x34 hex),Java SE 7 = 51 (0x33 hex),Java SE 6.0 = 50 (0x32 hex),Java SE 5.0 = 49 (0x31 hex),     方法二 javap -verbose Xxxx ( ...
#old-style class class Base(): def __init__(self, name): self.name = name class Child(Base): def __init__(self,name): Base.__init__(self,name) print self.name Child('zs')   #new-style class class Base(object): def __init__(self, name): ...
  在python unittest库中TestLoader中还有,discover是最简单的方式,另外可以直接使用nose。   def discover(): loader = unittest.TestLoader() suite1 = loader.discover('/xx/xx/xx') suite2 = loader.discover('/yy/yy/yy') alltests = unittest.TestSuite((suite1, suite2)) return unittest.TextTestRunner(ve ...
一、class object、class variable 首先class在python里面是一个对象,它有独立区域存储属于自己的数据,而不需要实例化。   class Hehe(object): count = 0 # class variable def __init__(self, c): Hehe.count = Hehe.count + c print 'addres same' if id(Hehe.count) == id(self.count) ...
 方法一: import sys sys.stdout.write("go ") sys.stdout.write("home") sys.stdout.flush()    方法二:函数方式调用print函数 from __future__ import print_function print('go ', end='') print('home', end='')   方法三:   print 'go', print 'home'  这种方法如果你直接执行python执行命令,然后敲入命令,是不行的 ...
1. 创建、编辑文件go.sh   #!/usr/bin/expect spawn sudo su admin expect "*password*" { send "13456\r\n" } interact    2. 设置权限   chmod u+x go.sh  3. 运行 ./go.sh   因为我们要使用expect执行,所以使用命令sh go.sh是不行的,会报“linux expect spawn: command not found”错误。  
nginx运行在38989端口   1. netstat -anp | grep 38989    (Not all processes could be identified, non-owned process info  will not be shown, you would have to be root to see it all.) tcp        0      0 0.0.0.0:38989               0.0.0.0:*                   LISTEN      81287/nginx -s start   程序PID为 ...

nginx学习记录

1. 使用监控页面   安装: 安装时添加--with-http_stub_status_module配置,命令如下:   ./configure --prefix=<your_path> --with-http_stub_status_modulemakemake install   配置: conf/nginx.conf添加:   location /nginx_status { stub_status on; access_log off; #allow x.x.x.x #deny all;}   效果  浏览器访问:http://x.x.x.x ...
Global site tag (gtag.js) - Google Analytics