一些shell命令

var=$(ifconfig | grep wlx | awk '{print $1}')
echo ${var%:*}
可以取到usb无线网卡的名字

常用的一些命令sed、awk、grep、head

参见:
https://blog.csdn.net/nyist327/article/details/41980505
https://www.cnblogs.com/zwgblog/p/6031256.html

取dns有个bug,修正后的
cat /etc/resolv.conf | grep nameserver | awk '$1 == "nameserver" {print $2}'

经纬度算距离

用EXCEL算
https://zhidao.baidu.com/question/1372805600144046539.html

=6371004*ACOS(1-(POWER((SIN((90-B2)*PI()/180)*COS(A2*PI()/180)-SIN((90-D2)*PI()/180)*COS(C2*PI()/180)),2)+POWER((SIN((90-B2)*PI()/180)*SIN(A2*PI()/180)-SIN((90-D2)*PI()/180)*SIN(C2*PI()/180)),2)+POWER((COS((90-B2)*PI()/180)-COS((90-D2)*PI()/180)),2))/2)

在线计算网站:
http://www.hhlink.com/经纬度

其它
https://blog.csdn.net/cuiluyang/article/details/43052693

二维码

可以用javascript直接生成二维码
https://github.com/davidshimjs/qrcodejs
其实可以不用jquery,这样写比较简单

<html>
<head>
<title>QRCode</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="qrcode.min.js"></script>
</head>
<body>
<div id="qrcode" style="width:100px; height:100px; margin-top:15px;"></div>
<script type="text/javascript">
var qrcode = new QRCode(document.getElementById("qrcode"), {
    text: "http://mikuq.com",
    width: 128,
    height: 128,
    colorDark : "#000000",
    colorLight : "#eeeeee",
    correctLevel : QRCode.CorrectLevel.M
});
</script>
</body>

mikuq.png

再来看看服务端生成二维码

mxGraph起步

mxGraph是啥,自行百度吧,据说可以画流程之类的东西,粗浅的认识,官网https://www.jgraph.com/
下载地址github:https://github.com/jgraph/mxgraph
首先解压缩,然后把javascript\src文件夹拷贝出来2.11M或许这个是不需要的,
确实不需要,把javascript文件夹下的mxClient.min.js放到javascript\src\js里就够了,然后把src文件夹重命名为mx,大小为771K,
建立step-01.html文件

<html>
<head>
  <title>step-01</title>
  <script type="text/javascript">
    mxBasePath = './mx';
  </script>
  <script type="text/javascript" src="./mx/js/mxClient.min.js"></script>
  <script type="text/javascript">
    function main(container)
    {
      if (!mxClient.isBrowserSupported())
      {
        mxUtils.error('Browser is not supported!', 200, false);
      }
      else
      {
        mxUtils.error('这个浏览器不错!', 200, true);
      }
    }
  </script>
</head>
<body onload="main(document.getElementById('graphContainer'))">
  <div id="graphContainer">
  </div>
</body>
</html>

关于mxUtils的文档,其它类似
http://jgraph.github.io/mxgraph/docs/js-api/files/util/mxUtils-js.html
增加graphContainer的样式,需要去javascript\examples\editors\images里搬出grid.gif作为背景底纹
style="position:relative;overflow:hidden;width:321px;height:241px;background:url('img/grid.gif');cursor:default;"

禁用浏览器右键菜单
mxEvent.disableContextMenu(container);
在容器中创建作图区
var graph = new mxGraph(container);
允许框选(只读是无效)
new mxRubberband(graph);
获取根节点
var parent = graph.getDefaultParent();
设置只读
graph.setEnabled(false);
画些东西进去
graph.getModel().beginUpdate();
try
{
var v1 = graph.insertVertex(parent, null, 'Miku', 20, 20, 50, 30);
var v2 = graph.insertVertex(parent, null, 'Q!', 200, 150, 30, 30);
var e1 = graph.insertEdge(parent, null, '', v1, v2);
}
finally
{
graph.getModel().endUpdate();
}

算是修正后的hello world吧

<html>
<head>
  <title>step-01</title>
  <script type="text/javascript">
    mxBasePath = './mx';
  </script>
  <script type="text/javascript" src="./mx/js/mxClient.min.js"></script>
  <script type="text/javascript">
    function main(container)
    {
      if (!mxClient.isBrowserSupported())
      {
        mxUtils.error('Browser is not supported!', 200, false);
      }
      else
      {
        mxUtils.error('这个浏览器不错!', 200, true);
        mxEvent.disableContextMenu(container);
        var graph = new mxGraph(container);
        graph.setEnabled(false);
        new mxRubberband(graph);
        var parent = graph.getDefaultParent();
        graph.getModel().beginUpdate();
        try
        {
          var v1 = graph.insertVertex(parent, null, 'Miku', 20, 20, 50, 30);
          var v2 = graph.insertVertex(parent, null, 'Q!', 200, 150, 30, 30);
          var e1 = graph.insertEdge(parent, null, '', v1, v2);
        }
        finally
        {
          graph.getModel().endUpdate();
        }
      }
    }
  </script>
</head>
<body onload="main(document.getElementById('graphContainer'))">
  <div id="graphContainer" style="position:relative;overflow:hidden;width:321px;height:241px;background:url('img/grid.gif');cursor:default;">
  </div>
</body>
</html>

参考:
https://www.cnblogs.com/ptko/p/7048514.html

Linux下软件环境安装(7)-java安装与配置

下载的ubuntu-18.04.1-live-server-amd64不知道怎么就live了,先看看有没有
java -version
显然没有http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
虽然java10都有了,先下Java SE Development Kit 8u181吧,jdk-8u181-linux-x64.tar.gz大概177MB

tar -zxvf jdk-8u181-linux-x64.tar.gz
sudo mv jdk1.8.0_181 /opt/jdk
sudo vi /etc/profile

在末尾添加配置信息

# JDK,TOMCAT,ORACLE
export JAVA_HOME=/opt/jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin

重新加载配置或重起后检验

source /etc/profile   
java -version

搞定!

- 阅读剩余部分 -