kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

JavaScript URLdecode函数

https://www.qttc.net/244-javascript-urldecode.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script>

  function StringToAscii(str) {
      return str.charCodeAt(0).toString(16);
  }

  function AsciiToString(asccode) {
      return String.fromCharCode(asccode);
  }

  function UrlDecode(zipStr) {
      var uzipStr = '';
      for (var i = 0; i < zipStr.length; i += 1) {
          var chr = zipStr.charAt(i);
          if (chr === '+') {
              uzipStr += ' ';
          } else if (chr === '%') {
              var asc = zipStr.substring(i + 1, i + 3);
              if (parseInt('0x' + asc) > 0x7f) {
                  uzipStr += decodeURI('%' + asc.toString() + zipStr.substring(i+3, i+9).toString());
                  i += 8;
              } else {
                  uzipStr += AsciiToString(parseInt('0x' + asc));
                  i += 2;
              }
          } else {
              uzipStr += chr;
          }
      }
      return uzipStr;
  }

  // 来自url的参数
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i = 0; i < vars.length; i ++) {
      var pair = vars[i].split("=");
      if (pair[0] == 'query') {
          document.getElementById('word').value = UrlDecode(pair[1]);
          search_word();
          break;
      }
  }

</script>

language, web

« 企业微信 通讯录人数上限 git pull 跳过压缩 remote compression »