#Scripts

This is an article that was created 652 days ago, and the information may have evolved or changed.

在上上篇博文中描述了如何将博客源文件推送到GitHub私有仓库备份,这篇文将讲述如何从GitHub私有仓库clone至本地重构 Hexo 环境来写博客

网上也有很多文章描述如何操作,也可以去参考,我记录我的操作过程如下

Read More

This is an article that was created 654 days ago, and the information may have evolved or changed.

自己日常操作的几个脚本

  • bat启动 Hexo 本地服务
  • bat 推送至 Github
  • 自动打开markdown编辑器

Read More

This is an article that was created 654 days ago, and the information may have evolved or changed.

Hexo 部署到Github的文件不包含主题文件,md文件,模版,配置文件等,在新电脑要重新部署相同环境写博客就要拷贝这些文件过去,可以通过文件共享,U盘拷贝,云盘等手段

还有一种方法就是把这些文件也推送到Github仓库,网上看到有一个hexo-git-backup可以把源码推送到仓库分支实现备份。但是我觉得这样不妥,由于部署到Github的静态网站仓库是公开的,把源文推送这个分支,意味着所有人都可以看到源文件的配置,包括一些个人的信息,可能有网站统计,收录的token,这样就不太好

看到一篇博文(https://0skyu.cn/p/a8bd.html) 就整的非常好,其中原理过程可以自行去研究

我参考这篇文章记录我自己的过程和操作

Read More

This is an article that was created 860 days ago, and the information may have evolved or changed.

  • 针对上一版的脚本进行改进
  • 增加嵌套一层 ‘ Try……finally: ’ ,代码执行末尾提示 “按任意键退出”
  • 修改代码中预定义的登陆账号密码为 input 和 getpass 手动输入
  • 修改文件当前目录为代码自动获取 os.getcwd()
  • 修改执行完成后显示 “A log file is available in……” 记录log路径
  • 想改多线程,threading 模块逻辑没搞清楚

Read More

This is an article that was created 861 days ago, and the information may have evolved or changed.

  • Python 脚本 SSH 登陆华三设备,使用定义好的 display 脚本批量导出配置和一些设备状态
  • Python 脚本 SSH 登陆华三设备,使用定义好的配置命令批量增加配置
  • 主要使用的是 netmiko 这个模块里的 ConnectHandler 命令
  • 单线程
  • 脚本运行完成后输出 成功和失败的记录log
  • ip_list.txt,cmd_list.txt,cmd_config_list.txt 格式简单,修改方便
  • 未做多账号密码的 if 语句判断
  • 肯定有冗余繁重的代码

Read More

This is an article that was created 1069 days ago, and the information may have evolved or changed.

之前做了一个割接网络的项目,在过程中要测试网点和中心的几百条专线线路,心想要逐个 ping 测试个对端IP地址,在时间上,操作上根本不可行,整个割接时间有限定,又是在凌晨时间……限制比较多,刚好那段时间在玩 Python,就想着能不能做个脚本自己跑,最后实现了,而且生成 Excel 表格统计测试成功和测试失败的信息。

Read More

This is an article that was created 1070 days ago, and the information may have evolved or changed.

自己日常操作的一些小命令和插件。

bat启动 hexo 本地服务

前提条件:已完成博客搭建。

1
2
@echo off
start D:\Program" "Files\Git\git-bash.exe --cd=D:/blog/blog -c "hexo clean && hexo g && hexo s"
  1. 新建后缀为bat的脚本文件
  2. 复制以上命令粘贴(注意修改路径 ),保存
  3. 双击此脚本运行的结果相当于在你的 blog 路径下右键 “Git Bash Here” 并输入 “hexo clean && hexo g && hexo s” 运行.

Read More

This is an article that was created 1245 days ago, and the information may have evolved or changed.

上一篇博客写到如何运行脚本导出设备信息,这一篇介绍一下怎样在海量的设备信息中提取指定信息,本文中假设要提取的信息有设备名称当前软件版本设备运行时间设备 CPU 使用率设备内存使用率设备序列号。后续可以根据这些信息使用 Python 脚本写入到巡检报告或者表格中。

Read More

This is an article that was created 1250 days ago, and the information may have evolved or changed.

脚本介绍和使用

  • 这是一个巡检脚本,使用 CRT 软件登陆H3C设备,点击 “Script” –> “Run” 选择脚本,运行脚本可得到需要收集的信息(当然你要打开 log 记录日志,相信你懂)
  • 可以根据你的实际需要修改 “Send” 后面的内容
  • 好久不更博客了,最近干了一些小项目,能写的我尽量写写……

Read More

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×