-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.xml
More file actions
1308 lines (958 loc) · 55.3 KB
/
index.xml
File metadata and controls
1308 lines (958 loc) · 55.3 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Baykier的鱼塘</title>
<link>https://baykier.github.io/index.xml</link>
<description>Recent content on Baykier的鱼塘</description>
<generator>Hugo -- gohugo.io</generator>
<language>zh-cn</language>
<copyright>Written by Baykier</copyright>
<lastBuildDate>Sat, 13 Jul 2019 10:00:36 +0800</lastBuildDate>
<atom:link href="https://baykier.github.io/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>window下vagrant 搭建flutter开发环境</title>
<link>https://baykier.github.io/post/flutter_with_vagrant/</link>
<pubDate>Sat, 13 Jul 2019 10:00:36 +0800</pubDate>
<guid>https://baykier.github.io/post/flutter_with_vagrant/</guid>
<description>
<h2 id="fluter-在-vagrant-下环境搭建">fluter 在 vagrant 下环境搭建</h2>
<p>由于在工作中使用vagrant 开发,学习flutter时候,也希望能在vagrant下开发调试,经过大半夜折腾,于是有了这篇记录</p>
<table>
<thead>
<tr>
<th>系统环境</th>
<th>win10</th>
</tr>
</thead>
<tbody>
<tr>
<td>vagrant</td>
<td>2.2.4</td>
</tr>
<tr>
<td>virtualbox</td>
<td>6.0.8</td>
</tr>
<tr>
<td>vm</td>
<td>debian9</td>
</tr>
</tbody>
</table>
<h3 id="安装步骤">安装步骤</h3>
<h4 id="安装flutter">安装flutter</h4>
<p>官网下载</p>
<pre><code> mkdir -p ~/bin/flutter
cd ~/bin/flutter
wget https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.7.8+hotfix.3-stable.tar.xz
tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.3-stable.tar.xz
echo &quot;export PATH:$PATH:/home/vagrant/bin/flutter/flutter/bin&quot; &gt;&gt; ~/.profile
source ~/.profile
</code></pre>
<p>这一步,flutter,安装成功,运行 which flutter ,正常显示如下</p>
<pre><code>/home/vagrant/bin/flutter/flutter/bin/flutter
</code></pre>
<h4 id="安装-oracle-java-jdk8">安装 oracle java jdk8</h4>
<p>这次需要打开浏览器,登录验证,下载
下载地址为 <a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">jdk-8u211-linux-x64.tar.gz</a></p>
<p>下载完成后复制到vagrant 虚拟机目录</p>
<pre><code>mkdir -p ~/bin/java/sdk
mv ~/path/jdk-8u211-linux-x64.tar.gz ~/bin/java/sdk
tar zxvf jdk*
</code></pre>
<p>下面设置java 环境变量 nano ~/.profile</p>
<pre><code>## java jdk8
export JAVA_HOME=/home/vagrant/bin/java/jdk1.8.0_211
export PATH=&quot;$PATH:$JAVA_HOME/bin&quot;
export CLASSPATH=&quot;$JAVA_HOME/lib/&quot;
</code></pre>
<p>保存, 执行命令 java -version ,显示如下表示安装成功</p>
<pre><code>
java version &quot;1.8.0_211&quot;
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
</code></pre>
<h4 id="安装-android-sdk">安装 android sdk</h4>
<p>由于我们使用vscode编辑器,不使用 android studio IDE,所以单独安装sdk 就可以了</p>
<p>下载 <a href="https://developer.android.com/studio">sdk manager</a>
仅下载 sdk command line tool 即可 下载完成,移动到bin/android/sdk文件夹,添加到path</p>
<pre><code>## android sdk manager
export ANDROID_HOME=/home/vagrant/bin/android/sdk/sdk
export PATH=&quot;$PATH:$ANDROID_HOME/tools/bin&quot;
</code></pre>
<p>通过上面安装步骤,我们应该已经完成sdkmanager</p>
<p>下面我们需要安装开发android 必备packages</p>
<table>
<thead>
<tr>
<th>Path</th>
<th>Version</th>
<th>Description</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>build-tools;28.0.3</td>
<td>28.0.3</td>
<td>Android SDK Build-Tools 28.0.3</td>
<td>build-tools/28.0.3/</td>
</tr>
<tr>
<td>build-tools;29.0.1</td>
<td>29.0.1</td>
<td>Android SDK Build-Tools 29.0.1</td>
<td>build-tools/29.0.1/</td>
</tr>
<tr>
<td>platform-tools</td>
<td>29.0.1</td>
<td>Android SDK Platform-Tools</td>
<td>platform-tools/</td>
</tr>
<tr>
<td>platforms;android-28</td>
<td>6</td>
<td>Android SDK Platform 28</td>
<td>platforms/android-28/</td>
</tr>
<tr>
<td>sources;android-28</td>
<td>1</td>
<td>Sources for Android 28</td>
<td>sources/android-28/</td>
</tr>
<tr>
<td>tools</td>
<td>26.1.1</td>
<td>Android SDK Tools 26.1.1</td>
<td>tools/</td>
</tr>
</tbody>
</table>
<h4 id="安装gradle">安装gradle</h4>
<p>这个可以通过<a href="https://sdkman.io/">sdkman</a>命令安装,基本上安装官网教程走就可以</p>
<pre><code>$ curl -s &quot;https://get.sdkman.io&quot; | bash
$ source &quot;$HOME/.sdkman/bin/sdkman-init.sh&quot;
$ sdk install gradle 5.5.1
</code></pre>
<h3 id="virtualbox-usb-配置">virtualbox usb 配置</h3>
<pre><code> # Enable USB Controller on VirtualBox
config.vm.provider &quot;virtualbox&quot; do |vb|
vb.customize [&quot;modifyvm&quot;, :id, &quot;--usb&quot;, &quot;on&quot;]
vb.customize [&quot;modifyvm&quot;, :id, &quot;--usbehci&quot;, &quot;on&quot;]
end
# Implement determined configuration attributes
config.vm.provider &quot;virtualbox&quot; do |vb|
vb.customize [&quot;usbfilter&quot;, &quot;add&quot;, &quot;0&quot;,
&quot;--target&quot;, :id,
&quot;--name&quot;, &quot;Any Cruzer Glide&quot;,
&quot;--product&quot;, &quot;Cruzer Glide&quot;]
end
</code></pre>
<p>将上面的配置添加到你的Vagrantfile中, 运行vagrant reload</p>
<p>如果提示错误,需要安装一下virtualbox usb exten pack,直接官网下载即可,然后再次重启vm</p>
<p>这时候我们进入vm,手机连上usb,开启开发者模式执行下面命令</p>
<pre><code>lsusb
</code></pre>
<p>正常就会显示如下</p>
<pre><code>Bus 001 Device 002: ID 12d1:107e Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
</code></pre>
<p>如果提示找不到lsusb,直接sudo apt install usbutils 即可</p>
<p>基本上,到这一步,我们的环境搭建基本就完成了,最后最重要的一步,就是配置 flutter的proxy,原因就是因为
pub get 如果配置代理,基本上卡住不动(proxy 直接设置http_proxy,https_proxy,no_proxy环境变量即可)</p>
<p>下面,是最终的flutter doctor -v</p>
<pre><code>[✓] Flutter (Channel stable, v1.7.8+hotfix.3, on Linux, locale en_US.UTF-8)
• Flutter version 1.7.8+hotfix.3 at /home/vagrant/bin/flutter/flutter
• Framework revision b712a172f9 (3 days ago), 2019-07-09 13:14:38 -0700
• Engine revision 54ad777fd2
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/vagrant/bin/android/sdk/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/vagrant/bin/android/sdk/sdk
• Java binary at: /home/vagrant/bin/java/jdk1.8.0_211/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
• All Android licenses accepted.
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/setup/#android-setup for detailed instructions).
[✓] Proxy Configuration
• HTTP_PROXY is set
• NO_PROXY is localhost,127.0.0.1
• NO_PROXY contains 127.0.0.1
• NO_PROXY contains localhost
[✓] Connected device (1 available)
• HMA AL00 • HJS5T18A19009977 • android-arm64 • Android 9 (API 28)
! Doctor found issues in 1 category.
</code></pre>
<h3 id="运行demo">运行demo</h3>
<dl>
<dt>现在我们直接clone flutter 在github的仓库,进入exmaples,找几个demo,执行flutter run 就可以生成apk 文件并安装到手机上进行测试了</dt>
</dl>
<p>:)!</p>
<h3 id="参考链接">参考链接</h3>
<ul>
<li><a href="https://flutter.dev/">flutter</a></li>
<li><a href="https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html">oracle java jdk8</a></li>
<li><a href="https://developer.android.com/studio">android-sdk</a></li>
<li><a href="https://gradle.org/">gradle</a></li>
<li><a href="https://www.vagrantup.com/">vagrant</a></li>
<li><a href="https://www.virtualbox.org/">virtualbox</a></li>
</ul>
</description>
</item>
<item>
<title>mongodb如何在aggregate中进行distinct操作 </title>
<link>https://baykier.github.io/post/mongo-aggregate/</link>
<pubDate>Thu, 19 Apr 2018 10:00:36 +0800</pubDate>
<guid>https://baykier.github.io/post/mongo-aggregate/</guid>
<description>
<h2 id="mongodb如何在aggregate中进行distinct操作">mongodb如何在aggregate中进行distinct操作</h2>
<p>mongodb 在聚合操作中,经常需要同传统的sql一样,进行诸如 sum(distinct) ,group by having 操作,那么等价的mongodb是啥呢?</p>
<h3 id="场景描述">场景描述</h3>
<p>现在需要用mongodb来记录业务员的外呼记录,使用三个表,结构分别如下:(实际情况可能有出入,抽出主要的字段说明)</p>
<ul>
<li>业务员 admin_user</li>
</ul>
<table>
<thead>
<tr>
<th>字段</th>
<th>类型</th>
<th>含义及说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>int</td>
<td>业务员id</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>姓名</td>
</tr>
</tbody>
</table>
<ul>
<li>客户表 user</li>
</ul>
<table>
<thead>
<tr>
<th>字段</th>
<th>类型</th>
<th>含义及说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>uid</td>
<td>int</td>
<td>客户id</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>姓名</td>
</tr>
</tbody>
</table>
<ul>
<li>关联表 call_log</li>
</ul>
<table>
<thead>
<tr>
<th>字段</th>
<th>类型</th>
<th>含义及说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>auid</td>
<td>int</td>
<td>业务员id</td>
</tr>
<tr>
<td>uid</td>
<td>int</td>
<td>客户id</td>
</tr>
<tr>
<td>ctime</td>
<td>int</td>
<td>呼叫时间</td>
</tr>
</tbody>
</table>
<h3 id="那么问题来了-如何找出具体某一天的业务员呼叫的客户数量">那么问题来了,如何找出具体某一天的业务员呼叫的客户数量?</h3>
<p>这时候,如果简单的用mysql来处理,简单的一条sql就行了:</p>
<pre><code>SELECT auid,COUNT(DISTINCT uid) AS call_count FROM call_log WHERE ctime &gt;=&lt;时间戳&gt; AND ctime &lt;= &lt;时间戳&gt; GROUP BY auid
</code></pre>
<p>但是用mongodb来处理,我找了半天,也没发现有distinct对等的函数,从stackoverflow上找到了答案,思路就是分两次组,第一次按auid,uid,第二次按auid,这样就会去重(一天可以呼叫同一个业务员多次)</p>
<p>代码如下:</p>
<pre><code>
db.campaigns.aggregate([
{ &quot;$match&quot;: { &quot;ctime&quot;: { &quot;$gte&quot;: &lt;时间戳&gt;,&quot;$lte&quot;:&lt;时间戳&gt; }}},
{ &quot;$group&quot;: {
&quot;_id&quot;: {
&quot;auid&quot;: &quot;$auid&quot;,
&quot;uid&quot;: &quot;$uid&quot;
},
&quot;count&quot;: { &quot;$sum&quot;: 1 }
}},
{ &quot;$group&quot;: {
&quot;_id&quot;: '$_id.auid',
&quot;count&quot;: { &quot;$sum&quot;: 1 }
}}
])
</code></pre>
<h3 id="参考链接"> 参考链接</h3>
<p>- <a href="https://stackoverflow.com/questions/24761266/select-group-by-count-and-distinct-count-in-same-mongodb-query?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">mongodb group distinct</a></p>
</description>
</item>
<item>
<title>extreme injector 进程注入工具使用</title>
<link>https://baykier.github.io/post/extreme_injector_use/</link>
<pubDate>Wed, 21 Mar 2018 10:00:36 +0800</pubDate>
<guid>https://baykier.github.io/post/extreme_injector_use/</guid>
<description>
<h2 id="extreme-injector-进程注入工具使用">extreme injector 进程注入工具使用</h2>
<p>windows dll 注入是大部分游戏辅助的实现方式,这次来介绍使用最广泛的extreme injector</p>
<h3 id="简介">简介</h3>
<p>extreme injector 是一个非常强大和高级的dll注入工具,配有一个简单的GUI界面,使用c#编写
<img src="./images/extreme_injector/01.png" alt="" />
<img src="./images/extreme_injector/02.png" alt="" />
<img src="./images/extreme_injector/03.png" alt="" /></p>
<p>它具有以下特性:</p>
<ul>
<li>多种外观和允许自定义GUI</li>
<li>进程列表选择或者桌面程序选择</li>
<li>多dll注入支持(并支持enable/disable选择)</li>
<li>自动开启注入</li>
<li>隐藏注入行为</li>
<li>dll抢占式注入</li>
<li>取消dll注入</li>
<li>多种注入方法(Standard, LdrLoadDll Stub, LdrpLoadDll Stub, Thread Hijacking and Manual Map)</li>
<li>支持拖拽操作</li>
<li>支持x64平台</li>
<li>Visual C++依赖库自动安装</li>
<li>注册后导出导出的功能函数</li>
</ul>
<h3 id="如何使用">如何使用</h3>
<ul>
<li>下载并解压文件(<a href="https://github.com/master131/ExtremeInjector">github下载地址</a>)</li>
<li>运行<strong>Injector v3.exe</strong></li>
<li>点击设置(setting)来开启选项 Start in Secure Mode 来避免被反欺诈引擎识别</li>
<li>点击select按钮来选择要注入的进程,可以选择正在运行的进程或者桌面中可执行文件的名字(以exe扩展)</li>
<li>点击inject完成</li>
</ul>
<h3 id="相关链接">相关链接</h3>
<ul>
<li><a href="https://github.com/master131/ExtremeInjector/wiki">github wiki</a></li>
<li><a href="https://www.unknowncheats.me/forum/general-programming-and-reversing/213038-extreme-injector-v3-7-a.html">原文链接</a></li>
</ul>
</description>
</item>
<item>
<title>WebAssembly的发展与对web的影响</title>
<link>https://baykier.github.io/post/webassembly-with-web/</link>
<pubDate>Fri, 02 Mar 2018 10:00:36 +0800</pubDate>
<guid>https://baykier.github.io/post/webassembly-with-web/</guid>
<description>
<h2 id="webassembly的发展与对web的影响">WebAssembly的发展与对web的影响</h2>
<p>WebAssembly或称wasm是一个实验性的低级编程语言,应用于浏览器内的客户端。WebAssembly是便携式的抽象语法树,被设计来提供比JavaScript更快速的编译及运行[2]。WebAssembly将让开发者能运用自己熟悉的编程语言(最初以C/C++作为实现目标)编译,再藉虚拟机引擎在浏览器内运行。WebAssembly的开发团队分别来自Mozilla、Google、Microsoft、Apple,代表着四大网络浏览器Firefox、Chrome、Microsoft Edge、Safari。2017年11月,所有以上四个浏览器都开始实验性的支持WebAssembly</p>
<p>简而言之,WebAssembly可以为C和C++编写的源码提供一个编译格式,使其能够运行在浏览器端,并暴露给JavaScript调用,这样一来,对于前端来说,将会引起巨大的变革,比如游戏,视频等等
具体请参考官方文档的介绍<a href="https://developer.mozilla.org/zh-CN/docs/WebAssembly/Concepts#WebAssembly%E7%9A%84%E7%9B%AE%E6%A0%87">WebAssembly的目标</a></p>
<h3 id="webassembly-目前浏览器支持">WebAssembly 目前浏览器支持</h3>
<table>
<thead>
<tr>
<th>浏览器</th>
<th>是否支持WebAssembly</th>
</tr>
</thead>
<tbody>
<tr>
<td>Chrome</td>
<td>v</td>
</tr>
<tr>
<td>Firfox</td>
<td>v</td>
</tr>
<tr>
<td>Edge</td>
<td>v</td>
</tr>
<tr>
<td>Oprea</td>
<td>v</td>
</tr>
<tr>
<td>Android</td>
<td>v</td>
</tr>
<tr>
<td>Ios</td>
<td>v</td>
</tr>
<tr>
<td>safari</td>
<td>v</td>
</tr>
<tr>
<td>QQ浏览器</td>
<td>v</td>
</tr>
<tr>
<td>Uc浏览器</td>
<td>v</td>
</tr>
</tbody>
</table>
<p>据目前情况看,几乎所有的主流浏览器都已经支持WebAssembly,无论是PC上的Chrome,Firefox,Ie还是移动端的Uc,QQ浏览器(微信内核来自QQ浏览器内核,也支持),所以说WebAssembly的发展未来前途无量!</p>
<p>具体参考:</p>
<ul>
<li><p><a href="https://developer.mozilla.org/zh-CN/docs/WebAssembly">WebAssembly浏览器支持</a></p></li>
<li><p><a href="https://x5.tencent.com/tbs/history.html#/detail/17">X5内核升级支持WebAssembly</a></p></li>
<li><p><a href="https://zhuanlan.zhihu.com/p/28546930">U4 内核 WebGL 支持发展方向</a></p></li>
</ul>
<h3 id="webassembly-编程语言支持">WebAssembly 编程语言支持</h3>
<p>目前完美支持WebAssembly的编程语言如下,相信未来会有更多的语言支持</p>
<ul>
<li><p>C</p></li>
<li><p>C++</p></li>
<li><p>Rust</p></li>
<li><p>Lua</p></li>
</ul>
<p>具体参考</p>
<p><a href="https://github.com/appcypher/awesome-wasm-langs">WebAssembly语言支持</a></p>
<h3 id="对web的影响">对Web的影响</h3>
<p>目前最主要的编程方式的改变,未来C/C++肯定会在Web前端大放光彩,比如加密解密,视频压缩,裁剪等等,Web平台相应的应用范围得益于WebAssembly也会越来越广,在游戏领域会有更大的作为.</p>
<ul>
<li>编程语言C/C++肯定爆发一波</li>
<li>前端开发会越来越重要,原生应用的开发者会面临很大的冲击</li>
</ul>
<h3 id="相关参考">相关参考</h3>
<ul>
<li><a href="https://github.com/mbasso/awesome-wasm#languages">awesome-WebAssembly</a></li>
<li><a href="http://webassembly.org/">http://webassembly.org/</a></li>
</ul>
</description>
</item>
<item>
<title>vagrant windows 大小写问题解决</title>
<link>https://baykier.github.io/post/vagrant-win-case-sensetive/</link>
<pubDate>Thu, 01 Mar 2018 00:00:00 +0000</pubDate>
<guid>https://baykier.github.io/post/vagrant-win-case-sensetive/</guid>
<description>
<h2 id="vagrant-windows-大小写问题解决">vagrant windows 大小写问题解决</h2>
<p>开发环境使用vagrant,以为这样能很好的解决开发中的坑,没想到还是中了不区分大小写的问题的坑,记录下来,防止踩坑</p>
<p>开发环境: host windwos 10
虚拟机: guest debian8
出现的问题: 工作中使用php开发的cli脚本,需要到线上服务器执行,本地写完了,执行后返回预期的结果,开开心心的到服务器一运行,发现居然没反应(ps 和框架的异常机制也有问题),
找了半天才发现是文件大小写的问题,由于使用vagrant在linux环境开发,就没有意识到这一点(默哀三秒。。。)然后查找相关资料,才发现使用virtualbox 默认挂载的目录是不区文件分大小写的
在guest中同样也是不区分,最开始的解决思路就是看看php能不能解决这个问题(让php跨平台的支持文件大小写)后来发现php底层是依赖与操作系统的,php本身无法解决,于是重点来了:
如何让windows+virtualbox中的vagrant支持区分文件大小写</p>
<h3 id="vagrant在windows-virtualbox-支持文件区分大小写">vagrant在windows+virtualbox 支持文件区分大小写</h3>
<p>要想让vagrant 在windows host中支持文件大小写,需求通过安装插件来支持:nfs</p>
<ol>
<li>打开cmd命令行或者git bash:</li>
</ol>
<pre><code>vagrant plugin install vagrant-winnfsd
</code></pre>
<p>等执行完成后进行下一步</p>
<ol>
<li>在Vagrantfile添加 挂载参数 type:&ldquo;nfs&rdquo;</li>
</ol>
<pre><code>config.vm.synced_folder &quot;./project&quot;, &quot;/project&quot;, type:&quot;nfs&quot;
</code></pre>
<ol>
<li>添加private_network支持(插件依赖 <a href="https://github.com/winnfsd/vagrant-winnfsd#activate-nfs-for-vagrant):">https://github.com/winnfsd/vagrant-winnfsd#activate-nfs-for-vagrant):</a></li>
</ol>
<pre><code>config.vm.network &quot;private_network&quot;, type: &quot;dhcp&quot;
</code></pre>
<ol>
<li>vagrant reload虚拟机</li>
</ol>
<pre><code>vagrant reload
</code></pre>
<h3 id="ok-到这一步-问题算是解决了-让我们愉快的玩耍吧">ok! 到这一步,问题算是解决了,让我们愉快的玩耍吧 :)</h3>
<h3 id="相关链接">相关链接</h3>
<ul>
<li><p><a href="https://github.com/winnfsd/vagrant-winnfsd#activate-nfs-for-vagrant">https://github.com/winnfsd/vagrant-winnfsd#activate-nfs-for-vagrant</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/26483867/how-to-handle-files-in-case-sensitive-way-in-vagrant-on-windows-host">https://stackoverflow.com/questions/26483867/how-to-handle-files-in-case-sensitive-way-in-vagrant-on-windows-host</a></p></li>
</ul>
</description>
</item>
<item>
<title>JavaScript跨域访问控制问题</title>
<link>https://baykier.github.io/post/js_cors/</link>
<pubDate>Mon, 11 Sep 2017 08:50:38 +0000</pubDate>
<guid>https://baykier.github.io/post/js_cors/</guid>
<description>
<h2 id="javascript跨域访问控制问题">JavaScript跨域访问控制问题</h2>
<h3 id="问题描述">问题描述</h3>
<ol>
<li><p><strong>情景一</strong>由于公司的文件上传采用单独的文件服务器管理,把上传文件操作做了统一抽象,形成了一个API接口,不管是前端(包括APP),
后端,采用文件上传时,均采用一个接口,重要的是文件上传API地址是单独的一台服务器。对于后端和APP端来说,还好
,但是对于前端(H5)来说,就存在跨域的请求问题</p></li>
<li><p><strong>情景二</strong>作为前端开发(H5),本地搭建测试环境,例如<code>http://localhost</code>,链接测试环境的接口<code>http://test.xxxxx.com</code>,这时候,由于
请求的也不是同一个服务器,也会存在跨域问题</p></li>
</ol>
<h3 id="什么是跨域访问">什么是跨域访问</h3>
<p>当一个资源从与该资源本身所在的服务器不同的域或端口请求一个资源时,资源会发起一个<strong>跨域 HTTP 请求</strong></p>
<h3 id="如何解决跨域请求问题">如何解决跨域请求问题</h3>
<p>要解决跨域问题,有两种方式:</p>
<ol>
<li>配置服务器,添加允许的跨域访问域名,从而使浏览器正常接收ajax返回的数据</li>
</ol>
<pre><code>server {
listen 80;
server_name test.com;
location /{
add_header 'Access-Control-Allow-Origin' 'http://a.com';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'POST';
}
}
</code></pre>
<ol>
<li>如果后端使用php,则可以在index.php入口文件简单修改:</li>
</ol>
<pre><code>// 指定允许其他域名访问
header('Access-Control-Allow-Origin:http:localhost');
header('Access-Control-Allow-Credentials:true');
// 响应类型
header('Access-Control-Allow-Methods:POST');
// 响应头设置
header('Access-Control-Allow-Headers:x-requested-with,content-type');
</code></pre>
<h3 id="相关阅读">相关阅读</h3>
<ul>
<li><a href="https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS">HTTP跨域访问控制</a></li>
<li><a href="http://blog.w2fzu.com/2016/11/21/2016-11-21-PHP-CORS/">PHP 解决 CORS 跨域问题</a></li>
</ul>
</description>
</item>
<item>
<title>php扩展模块加载顺序</title>
<link>https://baykier.github.io/post/php_ext_load_order/</link>
<pubDate>Wed, 30 Aug 2017 10:31:22 +0000</pubDate>
<guid>https://baykier.github.io/post/php_ext_load_order/</guid>
<description>
<h2 id="php扩展模块的加载顺序">php扩展模块的加载顺序</h2>
<h3 id="为啥会有这个问题">为啥会有这个问题?</h3>
<p>今天在安装php的扩展<a href="http://pecl.php.net/package/APM">apm</a>的时候,文档写着必须在json扩展加载之后再加载apm模块,原文如下:</p>
<pre><code>Activate the extension in the php configuration by adding:
extension=apm.so
Note: APM depends on JSON, so the apm.so extension must be loaded after JSON!
</code></pre>
<h3 id="那么php的扩展加载顺序是怎么的">那么php的扩展加载顺序是怎么的?</h3>
<p>按照php手册上面的说明,php扩展加载是写在php.ini文件中配置的,而php的配置文件是顺序解析的,这说明除了默认内核扩展,php的其他扩展模块
的加载顺序就是php.ini中的先后顺序,这是针对php.ini中的配置。对于ubuntu来说,php的扩展配置是单独放置在额外的配置目录,每一个扩展加载都是
一个配置文件,类似<a href="http://nginx.org/">nginx</a>的站点配置,以ubuntu-16.04-LTS为例:</p>
<p>如果我们要安装php的curl扩展:</p>
<pre><code>sudo apt update &amp;&amp; sudo apt install php7.0-curl
</code></pre>
<p>最终会在php的扩展目录安装curl.so(/usr/lib/php/20151012/),同时会在php的mods_available目录新增配置文件(curl.ini),这时候,php的
curl扩展还没有加载,需要将<code>curl.ini</code>软连接到<code>/etc/php/7.0/fpm/conf.d/</code>,重启php的fpm才会生效</p>
<h4 id="php扩展配置目录">php扩展配置目录</h4>
<p><img src="./images/ubuntu_php_7.0_mods_available.png" alt="php扩展配置目录" /></p>
<h4 id="php的fpm扩展加载目录">php的fpm扩展加载目录</h4>
<p><img src="./images/ubuntu_php_7.0_fpm_conf.d.png" alt="php的fpm扩展加载目录" /></p>
<p>那么问题来了,如果以这种方式加载php的扩展,扩展的加载顺序如何呢?</p>
<p>答案就是安装配置文件目录的<code>文件自然排序</code>顺序加载的.至于为什么,看了php的扩展加载目录前面的那个数字就明白了。</p>
<h3 id="相关阅读">相关阅读</h3>
<ul>
<li><a href="http://www.laruence.com/2009/08/18/1042.html">保证PHP扩展的依赖关系</a></li>
<li><a href="http://php.net/manual/zh/install.php">php的安装与配置</a></li>
</ul>
</description>
</item>
<item>
<title>nginx ssl 证书配置</title>
<link>https://baykier.github.io/post/nginx_ssl/</link>
<pubDate>Tue, 29 Aug 2017 05:23:25 +0000</pubDate>
<guid>https://baykier.github.io/post/nginx_ssl/</guid>
<description>
<h2 id="nginx-ssl证书配置">nginx ssl证书配置</h2>
<p>一般在开发环境中,ssl时没有必要设置的,但是因为测试需要用到https环境,所以就记录下来,当学习了。</p>
<h3 id="生成ssl证书">生成ssl证书</h3>
<p>https 需要证书,所需要的证书一般可以自己生成,这时候需要手动添加到浏览器,还有就是去证书网站申请,推荐使用
<a href="https://letsencrypt.org/">Let&rsquo;s Encrypt</a> (注:这种证书只能使用3个月的时间,过期需要再次申请)
我们这里仅需要自己手动生成证书就可以了</p>
<ol>
<li>生成密钥key,执行下面的命令,输入两次密码就可以了</li>
</ol>
<pre><code>openssl genrsa -des3 -out dev.key 1024
</code></pre>
<ol>
<li>利用密钥key生成证书crt文件,执行下面的命令,输入证书的参数就可以了</li>
</ol>
<pre><code>openssl req -new -x509 -key dev.key -out dev.crt -days 3650
</code></pre>
<p>证书的参数:</p>
<ul>
<li>Country Name 国家名字 (CN 即可)</li>
<li>State or Province Name 省或地区(BeiJing)</li>
<li>Locality Name 当地地区 (BeiJing)</li>
<li>Organization Name 机构名称 (develop Ltd)</li>
<li>Organizational Unit Name 组织机构单位 (develop)</li>
<li>Common Name 站点host (dev.com)</li>
<li>Email Address 邮箱</li>
</ul>
<ol>
<li>生成不需要密码的密钥,给nginx配置</li>
</ol>
<pre><code>openssl rsa -in dev.key -out dev.nopass.key
</code></pre>
<h3 id="配置nginx">配置nginx</h3>
<p>nginx 配置很简单,导入证书路径即可,下面是一个实例配置</p>
<pre><code>server {
listen 443;
server_name dev.cn;
ssl on;
ssl_certificate /var/project/conf/nginx/dev.crt;
ssl_certificate_key /var/project/conf/nginx/dev.nopass.key;
root /var/project/htdocs/dev/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name dev.borrow.cn;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.php$is_args?$args ;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php {
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
access_log /var/project/log/nginx/dev.cn-access.log;
error_log /var/project/log/nginx/dev.cn-error.log;
}
</code></pre>
<h2 id="相关阅读">相关阅读</h2>
<ul>
<li><a href="http://www.cnblogs.com/littlehann/p/3738141.html">证书介绍</a></li>
<li><a href="http://www.cnblogs.com/yjmyzz/p/openssl-tutorial.html">openssl、x509、crt、cer、key、csr、ssl、tls 这些都是什么鬼?</a></li>
</ul>
</description>
</item>
<item>
<title>php file_get_contents() 函数代理设置</title>
<link>https://baykier.github.io/post/php_proxy_file_get_contents/</link>
<pubDate>Wed, 21 Jun 2017 01:42:02 +0000</pubDate>
<guid>https://baykier.github.io/post/php_proxy_file_get_contents/</guid>
<description>
<h2 id="php-file-get-contents-函数代理设置">php file_get_contents() 函数代理设置</h2>
<h3 id="遇到的问题">遇到的问题</h3>
<p>昨天在使用file_get_contents()函数抓取图片内容的时候,出现超时的情况,而且图片无法获取到
据猜测,是网络的问题,有可能被GFW河蟹了,于是登上我的服务器测试一下,发现在服务器可以正常打开。
所以想到了如何给file_get_contents()函数设置代理,记录下来</p>
<h3 id="file-get-contents-代理设置">file_get_contents()代理设置</h3>
<p>下面摘自file_get_content()的<a href="http://php.net/manual/en/function.file-get-contents.php">php官方手册</a></p>
<pre><code>string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = 0 [, int $maxlen ]]]] )
</code></pre>
<p>其中,第三个参数<strong>context</strong>就是一个上下文资源参数,可以使用<a href="http://php.net/manual/en/function.stream-context-create.php">stream_context_create()</a>
来创建</p>
<p>具体代码如下:</p>
<pre><code>$context = stream_context_create(array(
'http' =&gt; array(
'proxy' =&gt; '[tcp|udp]&lt;proxy ip&gt;:&lt;proxy port&gt;',
'request_fulluri' =&gt; true,
),
));
//下面是简单的测试
$url = 'froyo.cc';
$content = file_get_contents($url,false,$context);
echo $content;
</code></pre>
<h3 id="相关参考">相关参考</h3>
<p>使用strea_context_create()函数的库很多,比如<a href="https://github.com/guzzle/guzzle">Guzzle</a></p>
<p>1.<a href="http://php.net/manual/zh/book.stream.php">php stream</a></p>
<p>2.<a href="https://www.oschina.net/translate/understanding-streams-in-php">理解php的流</a></p>
</description>
</item>
<item>
<title>homepage 的自动部署</title>
<link>https://baykier.github.io/post/auto_deploy/</link>
<pubDate>Mon, 05 Jun 2017 10:00:36 +0800</pubDate>
<guid>https://baykier.github.io/post/auto_deploy/</guid>
<description>
<h1 id="homepage自动部署">homepage自动部署</h1>
<h2 id="背景">背景</h2>
<p>首先交代一下背景,俺的博客是基于hugo的生成静态站点,代码放在github上面 对于<a href="https://gohugo.io/">hugo</a>
和<a href="https://github.com/">github</a>不是很了解的同学可以去了解一下。</p>
<p>下面是我写博客的大概流程:</p>
<p>1.在自己的个人电脑上写博客,用hugo生成静态站点测试无误后推送到github</p>
<pre><code># 新增博客
hugo new post/&lt;some_title&gt;.md
# 用编辑器编辑并测试
hugo server -w
# 生成静态站点
hugo
#推送到github
git push origin master
</code></pre>
<p>2.在服务器上面拉取更新站点</p>
<pre><code>cd /path/to/site
git pull origin master
</code></pre>
<p>经过上面的分析可以看出,对于服务器端的每次拉取可以写成一个脚本,利用github的hook机制,这样每次写完博客
测试ok直接推送就行了,省去每次登录服务器,再<code>git pull</code>的操作,这样岂不美哉!</p>
<h2 id="自动部署脚本原理">自动部署脚本原理</h2>
<p>其实对于这个机智(偷懒)的想法早就有了,直到昨天下午有时间,才完善了一下。网上有很多类似的代码,实现原理
大同小异,都是根据github的hook机制,需要注意的就是安全方面,具体流程如下面:</p>
<p>1.博客更新推送到github</p>
<p>2.github推送webhook到url</p>
<p>3.url里面验证推送的来源(确保安全),执行代码拉取完成更新</p>
<h2 id="编写php脚本-因为php是最好的语言么">编写php脚本(因为php是最好的语言么)</h2>
<p>代码可以在这里找到<a href="https://github.com/baykier/homepage/blob/master/froyo.cc/public/index.php">homepage自动部署脚本</a></p>