4 shunzi2016

尚未进行身份认证

我要认证

毕业于中南民族大学,从事计算机软件行业4年,擅长python、Java、node.

等级
TA的排名 1w+

NodeJs:匿名回调,同步阻塞式,逻辑顺序控制示例

function a(a, callback) { console.log(a); a = a + 'a'; callback(a)}function b(b, callback) { console.log(b) new Promise(function(resolve, reject) { setTimeout(function() { b = b + 'b' resolve(b); .

2020-09-17 07:30:46

Python3:最简短明了的requests, get json 请求

remote = 'http://xx.xxx.xxx.xxx:xx/xxx/xxxx'headers = { 'Content-Type': 'application/json',}document = { xx:xx}response = requests.get(remote, data=json.dumps(document), headers=headers, timeout=60)if response.

2020-09-14 07:42:39

NodeJS:mongo db 入门级使用CURD封装

Mongo版本:4.2.*nodejs版本:12.x以上var MongoClient = require('mongodb').MongoClient;var log4js = require('log4js');log4js.configure('./config/log4js.json');var logger = log4js.getLogger();var log = require('./log.js');var moment = require('moment');var

2020-09-13 21:46:39

NodeJS:redis 入门级使用示例 hgetall

var redis = require('redis');RDS_PORT = 6379 //端口号RDS_HOST = '172.18.xx.xx'; //服务器IP// RDS_PWD = config_db.redis.pass; //密码// RDS_OPTS = { auth_pass: RDS_PWD };// client = redis.createClient(RDS_PORT, RDS_HOST, RDS_OPTS);client = redis.createClie...

2020-09-13 21:40:02

git: gitignore编写案例,包括python,nodejs的包以及编译文件过滤

.idea*.pyc*.py[cod]*/*.pyc**/*.pyc!.gitignore!.gitkeep*/node_modules**/node_modulesxx/xx/node_modules/node_modules/**/npm-debug.lognpm-debug.log.DS_Store**/.DS_Store*/.DS_Store.vscode*.log*/xxxxxx_python_pro/*.log**/xxxxxx_python_pro/*.l.

2020-09-08 08:30:01

NodeJS:按照不同的操作系统读写文件

var fs = require('fs');var os = require('os');var xxx_file = '';var platform = os.platform();if (platform.indexOf('win') > -1) { xxx_file= 'E:/tmp/xxx_file.txt';} else if (platform.indexOf('linux') > -1) { xxx_file= '/tmp/xxx_file.txt'.

2020-09-08 07:50:49

Python3:按照不同的系统进行文件的追加编写

import platformif 'Windows' in platform.system(): xxx_file = 'E:/tmp/xxx_file.txt'elif 'Linux' in platform.system(): xxx_file = '/tmp/xxx_file.txt'with open(xxx_file , 'w', encoding='utf-8') as foo: foo.write('true')

2020-09-08 07:43:45

NodeJS: TypeError: os.tmpDir is not a function

TypeError: os.tmpDir is not a function at new Form (/home/vcontroller/cloudenforce/opcsec/contrail-web-core/node_modules/multiparty/index.js:55:44) at exports.SystemUpload (xx.js:103:16) at callbacks (xx.js/node_modules/express/lib/router/index.j.

2020-09-07 23:57:05

Linux:子账户自动切换到root账户

忘记了是看的哪个大神的博客学到的了#!/usr/bin/expect# 需要等待控制台捕获输出set timeout 1# spawn开启进程,也可以是ssh $user@$host {your_command}# 只有先进入expect环境后才可执行spawnspawn su root# 判断上述进程(su root)的输出结果中是否有“password”的字符串(不区分大小写)。# 若有则立即返回,否则就等待一段时间后返回,等待时长就是开头设置的1秒expect "*pass.

2020-09-05 11:29:55

Linux:自动pull git代码到指定目录,自动pull和覆盖指定分支代码

#!/usr/bin/expectspawn git clone -b xxx-branch http://x.x.x.x:xx/xx/xx/xxxxx.git /home/shunzi/xxxxx#spawn git clone -b xxx-branch http://x.x.x.x:xx/xx/xx/xxxxx.gitexpect "Username"send "shunzi\n"expect "Password"send "shunzishishuaige\n"expect eof.

2020-09-05 11:25:00

Linux:一键yum centos常用工具指令

sudo yum -y install gcc python36-devel bzip2-devel sqlite-devel readline-devel xz-devel xz-devel tk-devel gdbm-devel vim net-tools telnetsudo yum install -y git gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam-devel expect --skip-br.

2020-09-05 11:15:29

Linux:看门狗watchdog.sh程序编写示例

### # @Author: hanxiaoshun # @Date: 2020-07-08 15:53:34 # @LastEditTime: 2020-09-05 10:54:45 # @LastEditors: Please set LastEditors # @Description: In User Settings Edit # @FilePath: \shunzi\config\owatchdog.sh### #!/bin/sh#kill -9 $(ps -ef|grep .

2020-09-05 11:12:00

Linux:添加开机自启动的系统服务

test_service为一个系统级服务的运行脚本,还有一种方式是写入rc.local里面sudo cp -rf /home/shunzi/config/test_service /etc/init.d/sudo chmod a+x /etc/init.d/test_servicecd /etc/init.d/sudo chkconfig --add test_servicesudo chkconfig test_service onsudo chkconfig --level 2345..

2020-09-05 11:00:46

MongoDB:一键单机部署centos7.*

MongoDB:版本为4.2.*# mongodb 部署# 需要提前手动设置mongo_place目录以及上传对应的安装包# 指的是当前的非root子账户,所以不是必须shunzi账户sudo mkdir -p /home/shunzi/mongo_placesudo cp -rf mongodb-linux-x86_64-rhel70-v4.2-latest.tgz /home/shunzi/mongo_place/sudo rm -rf /home/shunzi/mongo_place.

2020-09-05 10:37:08

Redis: 一键单机部署centos7.*

版本为redis-5.0.9# 安装redissudo rm -rf /home/shunzi/redis_place/*sudo mkdir -p /home/shunzi/redis_placesudo mv redis-5.0.9.tar.gz /home/shunzi/redis_placesudo tar -zxvf /home/shunzi/redis_place/redis-5.0.9.tar.gzsudo mv /home/shunzi/redis_place/redis-.

2020-09-05 10:34:00

nodejs:0 和 空字符的比较

console.log(0 == '');//打印为trueconsole.log(0 === '');//打印为false

2020-08-25 14:12:59

http: 400 bad request

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><title>400 Bad Request</title><h1>Bad Request</h1><p>Failed to decode JSON object: Expecting property name enclosed in double quotes: line 1 column 318 (char 317.

2020-08-09 08:17:35

Git:没啥事研究研究自己做一个版本控制软件

> git for-each-ref --sort -committerdate --format %(refname) %(objectname)> git remote --verbose> git config --get commit.template> git ls-files --stage -- E:\work_space\enforce\mc01\cloudenforce\opcsec\contrail-web-core\src\serverroot\opcs.

2020-08-04 07:22:13

Git:一些历史记录没事可以一条一条看看学习用

Looking for git in: E:/Git/bin/git.exeUsing git 2.23.0.windows.1 from E:/Git/bin/git.exe> git rev-parse --show-toplevel> git rev-parse --git-dirOpen repository: e:\work_space\enforce\mc01\cloudenforce> git status -z -u> git symbolic-ref .

2020-08-04 07:21:01

Python3:gevent:greenlet.error: cannot switch to a different thread

2020-08-01 22:06:12:034678: ----------------------------------------2020-08-01 22:06:50:875038: Exception happened during processing of request from ('127.0.0.1', 55207)2020-08-01 22:06:50:875038: Traceback (most recent call last):2020-08-01 22:06:50:8.

2020-08-01 22:12:12

查看更多

勋章 我的勋章
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 勤写标兵Lv3
    勤写标兵Lv3
    授予每个自然周发布7篇到8篇原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。
  • 学习力
    学习力
    《原力计划【第二季】》第一期主题勋章 ,第一期活动已经结束啦,小伙伴们可以去参加第二期打卡挑战活动获取更多勋章哦。
  • 原力新人
    原力新人
    在《原力计划【第二季】》打卡挑战活动中,成功参与本活动并发布一篇原创文章的博主,即可获得此勋章。