forked from englianhu/ali-zonghui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone.Rmd
514 lines (393 loc) · 18.6 KB
/
phone.Rmd
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
---
title: "💙🤍 ❤️🖤 💚💙"
subtitle: "📲 - *️⃣*️⃣*️⃣6️⃣4️⃣8️⃣2️⃣7️⃣7️⃣6️⃣ - 《踢出一个未来》🎶"
author: "®γσ ξηg <img src='figure/aaaa.jpg' width='12'>"
date: "`r lubridate::today('Asia/Tokyo')`"
output:
html_document:
mathjax: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
number_sections: yes
toc: yes
toc_depth: 4
toc_float:
collapsed: yes
smooth_scroll: yes
code_folding: hide
css: CSSBackgrounds.css
---
# ${\color{Black} \circledR} {\color{DarkGreen} \gamma} {\color{Red} \sigma} \; {\color{Blue} \xi} {\color{Red} \eta} {\color{Blue} g}$^[[Latex Equation](https://www.codecogs.com/latex/eqneditor.php)] 🎏^[[Emoji list](https://gist.github.com/rxaviers/7360908),[Colorised LaTEX formula](https://community.rstudio.com/t/colorised-latex-formula/84115/2?u=englianhu)]
<br>
![Quantitative Trading in Sportsbook and financial market](figure/soccer.jpg)
<audio controls loop autoplay src='music/kick-off a better future.mp3' controls></audio>
<br>
<iframe title="vimeo-player" src="https://player.vimeo.com/video/191464377" width="560" height="315" frameborder="0" allowfullscreen></iframe>
------
# Setting
## SCSS Setup
<style>
pre {
overflow-x: auto;
}
pre code {
word-wrap: normal;
white-space: pre;
}
.table-hover > tbody > tr:hover {
background-color: #8D918D;
}
</style>
```{r class.source = 'bg-success', class.output = 'bg-primary', message = FALSE, warning = FALSE}
# install.packages("remotes")
library('BBmisc', 'rmsfuns')
#remotes::install_github("rstudio/sass")
lib('sass')
```
```{scss class.source = 'bg-success', class.output = 'bg-primary'}
/* https://stackoverflow.com/a/66029010/3806250 */
h1 { color: #002C54; }
h2 { color: #2F496E; }
h3 { color: #375E97; }
h4 { color: #556DAC; }
h5 { color: #92AAC7; }
/* ----------------------------------------------------------------- */
/* https://gist.github.com/himynameisdave/c7a7ed14500d29e58149#file-broken-gradient-animation-less */
.hover01 {
/* color: #FFD64D; */
background: linear-gradient(155deg, #EDAE01 0%, #FFEB94 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155deg, #EDAE01 20%, #FFEB94 80%);
}
}
.hover02 {
color: #FFD64D;
background: linear-gradient(155deg, #002C54 0%, #4CB5F5 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155deg, #002C54 20%, #4CB5F5 80%);
}
}
.hover03 {
color: #FFD64D;
background: linear-gradient(155deg, #A10115 0%, #FF3C5C 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155deg, #A10115 20%, #FF3C5C 80%);
}
}
```
```{r global_options, class.source='hover01', class.output='hover02'}
## https://stackoverflow.com/a/36846793/3806250
options(width = 999)
knitr::opts_chunk$set(class.source = 'hover01', class.output = 'hover02', class.error = 'hover03')
## Set the timezone but not change the datetime
Sys.setenv(TZ = 'Asia/Tokyo')
## options(knitr.table.format = 'html') will set all kableExtra tables to be 'html', otherwise need to set the parameter on every single table.
options(warn = -1, knitr.table.format = 'html')#, digits.secs = 6)
## https://stackoverflow.com/questions/39417003/long-vectors-not-supported-yet-abnor-in-rmd-but-not-in-r-script
knitr::opts_chunk$set(cache = TRUE, warning = FALSE,
message = FALSE, cache.lazy = FALSE)
```
<br><br>
## Setup
```{r error=TRUE}
## https://www.ip138.com/sj
if(!suppressPackageStartupMessages(require('BBmisc'))) {
suppressWarnings(suppressMessages(install.packages('BBmisc')))
}
require('BBmisc')
pkgs <- c('rvest', 'RSelenium', 'reticulate', 'tidyverse', 'magrittr',
'RCurl', 'plumber', 'bigQueryR', 'xts', 'forecast', 'purrr',
'googleCloudRunner', 'plyr', 'chinese.misc', 'knitr', 'tidyr',
'kableExtra', 'plyr', 'dplyr', 'devtools', 'XML', 'xml2',
'formattable', 'lubridate')
suppressAll(lib(pkgs))
#(dependencies = TRUE, INSTALL_opts = '--no-lock')
lnk <- 'https://www.ip138.com/sj'
rm(pkgs)
#https://github.com/githubwwwjjj/chinese.misc
#options(tmp_chi_locale=NA)
options(tmp_chi_locale="Chinese (Traditional)_Taiwan.950")
```
<br>
## 中国电讯台
<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/ckgF2dNK1fc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<figure>
<img src='figure/易博通《少林足球主題曲》.jpg' alt='Trulli' style='width:30%'>
<figcaption>[《少林足球主題曲》🎶](https://multi-byte.com)
<img src='figure/中国电信《爱江山更爱美人》.jpg' alt='Trulli' style='width:30%'>
<figcaption>[《爱江山更爱美人》🎶](https://www.189.cn)
<img src='figure/中国联通《皇帝的烦恼》.jpg' alt='Trulli' style='width:32%'>
<figcaption>[《皇帝的烦恼》🎶](http://www.chinaunicom.com)
<img src='figure/中国移动《忘情水》.jpg' alt='Trulli' style='width:30%'>
<figcaption>[《忘情水》🎶](http://www.10086.cn)
<img src='figure/中国广电《兄弟干杯》.jpg' alt='Trulli' style='width:30%'>
<figcaption>[《兄弟干杯》🎶]()
<img src='figure/阿里通信《阿里山的姑娘》.jpg' alt='Trulli' style='width:30%'>
<figcaption>[《阿里山的姑娘》🎶](https://aliqin.tmall.com)
</figure>
<br>
[**通信大变天!第四大运营商来了,又是阿里巴巴!**](https://mp.weixin.qq.com/s/VeVG0AGXDULuhUDxe9tRbQ)
<br>
## 手机号前三码一览
<br>
- [手机号码段及归属地查询规则](https://blog.csdn.net/pzasdq/article/details/50587428?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~first_rank_v2~rank_v25-3-50587428.nonecase&utm_term=%E6%89%8B%E6%9C%BA%E5%8F%B7%E6%AE%B5%E6%9F%A5%E8%AF%A2&spm=1000.2123.3001.4430)
- [中国移动,联通,电信各手机号码前三位是多少?](https://zhidao.baidu.com/question/584943266.html)
- `广电192的号码有没有人用呢?...`^[[通信大变天!第四大运营商来了,又是阿里巴巴!](https://mp.weixin.qq.com/s/VeVG0AGXDULuhUDxe9tRbQ)]
```{python eval = FALSE}
## https://rstudio.github.io/reticulate/articles/python_packages.html
# create a new environment
conda_create()
mods <- c('scipy', 'numpy', 'pandas', 'lxml', 'bs4', 'selenium', 'time', 'string', 'random')
mods %>% llply(., function(x) {
tryCatch({
y <- conda_install(conda_list()[[1]][2], x)
y <- import(y)
}, error = function(e) {
NULL
})
})
# import SciPy (it will be automatically discovered in "r-reticulate")
modsip <- mods %>% llply(import)
# indicate that we want to use a specific condaenv
#use_condaenv(conda_list()[[1]][2])
# import SciPy (will use 'r-reticulate' as per call to use_condaenv)
#scipy <- import('scipy')
```
```{python eval = FALSE}
from selenium import webdriver
from bs4 import BeautifulSoup
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
url = 'https://www.imdb.com/search/title?release_date=2018&sort=num_votes,desc&page=1'
driver = webdriver.Chrome('/r-reticulate/chromedriver')
driver.get(url)
soup = BeautifulSoup(driver.page_source,"html.parser")
while True:
items = [itm.get_text(strip=True) for itm in soup.select('.lister-item-p6482776ent a[href^="/title/"]')]
print(items)
try:
driver.find_element_by_xpath('//a[p6482776ains(.,"Next")]').click()
soup = BeautifulSoup(driver.page_source,"html.parser")
except Exception: break
```
<br>
<br>
## 手机号查询
<br>
### 样本
<br>
[手机号码归属地查询](https://m.ip138.com/sj.asp)可以查询任何国内手机号。
```{r}
xxx <- read_html('view-source_https___m.ip138.com_sj.asp_mobile=1316482776.html') %>%
html_nodes('td') %>%
.[144:152] %>%
html_text(trim = T) %>%
str_replace_all('^<tr><td class=\"th\"|^<tr><td class=\"th\">|</td<td<span| width=\"36%\"|</td><td>|>|</span></td></tr>$|\\*', '') %>%
.[. != ''] %>%
str_split('<span')
xxx %>% data.frame %>%
t %>% data.frame %>%
as_tibble %>%
dplyr::rename('类别' = X1, '明细' = X2) %>%
kbl('html', caption = '手机号详情', escape = F, align = 'r') %>%
kable_styling(
bootstrap_options = c('striped', 'hover', 'condensed', 'responsive')) %>%
scroll_box(height = '400px')
```
<br>
### 靓号
```{python eval = FALSE}
import pandas as pd
import lxml
test = 'https://www.ip138.com/mobile.asp?mobile=1316482776&action=mobile'
tables = pd.read_html(test)
rankings = tables[-1]
rankings.iloc[:200]
```
```{r eval = FALSE}
#https://m.ip138.com/sj.asp?mobile=1316482776
#lnk <- c('https://m.ip138.com/mobile.asp?mobile=', '&action=mobile')
i <- sprintf("%03d", 1:999) %>%
paste0(6482776)
lnk <- paste0('https://m.ip138.com/sj.asp?mobile=', i)
rm(i)
p6482776 <- lnk %>%
llply(., function(ii) {
tryCatch({
ii %>% getURL %>%
read_html %>% html_table()
}, error = function(e) {
NULL
}) %>% unlist
})
p6482776[sapply(p6482776, is.null)] <- NULL
```
```{r eval = FALSE}
#https://m.ip138.com/sj.asp?mobile=1316482776
#lnk <- c('https://m.ip138.com/mobile.asp?mobile=', '&action=mobile')
i <- sprintf("%03d", 120:200) %>%
paste0(6482776)
lnk <- paste0('https://m.ip138.com/sj.asp?mobile=', i)
rm(i)
p6482776 <- lnk %>%
llply(., function(ii) {
tryCatch({
xxx <- ii %>% read_html() %>%
html_nodes('td') %>%
# .[144:152] %>%
html_text(trim = T)# %>%
#str_replace_all('^<tr><td class=\"th\"|^<tr><td class=\"th\">|</td<td<span| width=\"36%\"|</td><td>|>|</span></td></tr>$|\\*', '') %>%
#.[. != ''] %>%
#str_split('<span')
#xxx %<>% data.frame %>%
# t %>%
# as_tibble %>%
# dplyr::rename('种类' = V1, '明细' = V2)
cat('\nGet"', ii, '"');
xxx
}, error = function(e) {
cat('\n', ii, 'not exist');
NULL
})# %>% unlist
})
p6482776[sapply(p6482776, is.null)] <- NULL
p6482776 <- p6482776[sapply(p6482776, function(x) length(x)>1)]
p6482776 %<>% llply(., function(x) {
x %>%
str_replace_all('\\*', '') %>%
matrix(nc = 2, byrow = TRUE) %>%
data.frame %>%
as_tibble %>%
dplyr::rename('类别' = X1, '明细' = X2)
})
p6482776 %<>%
ldply(., function(x) {
x %>% t %>% data.frame %>%
mutate_at(1:ncol(.), funs(str_replace_all(., ' ', ''))) %>%
.[-1,]
}) %>% as_tibble %>%
mutate(`手机号码段` = as.numeric(X1),
`卡号归属地` = factor(X2),
`卡类型` = factor(X3),
`区号` = factor(X4),
`邮编` = as.numeric(X5)) %>%
.[-c(1:5)]
## https://rstudio-pubs-static.s3.amazonaws.com/406749_dc4af7298f934812b35b11631abb5ad5.html
saveRDS(p6482776, file = 'data/p6482776.rds')
```
```{r}
p6482776 <- read_rds('data/p6482776.rds')
p6482776 %>%
mutate(
手机号码段 = color_tile('white', 'darkgrey')(手机号码段),
卡类型 = if_else(
str_detect(卡类型, '联通'),
cell_spec(卡类型, background = 'black', color = 'red', italic = TRUE),
if_else(
str_detect(卡类型, '电信'),
cell_spec(卡类型, background = 'blue', color = 'white', italic = TRUE),
if_else(
str_detect(卡类型, '移动'),
cell_spec(卡类型, background = 'lightgreen', color = 'blue', italic = TRUE),
cell_spec(卡类型, background = 'gold', color = 'black'))
))) %>%
kbl('html', caption = '手机号详情', escape = F, align = 'r') %>%
kable_styling(
bootstrap_options = c('striped', 'hover', 'condensed', 'responsive')) %>%
scroll_box(height = '400px')
```
<br>
## 买号网
- [手机靓号网(网页版)](http://www.1686888.com)
- [手机靓号网(手机版)](http://m.1686888.com)
<br>
<br>
## 手机号维护网站
<br>
![[https://www.ding.com](https://www.ding.com/)可以设定7天、14天、28天、30天自动充值,跨越全球手机号。](figure/ding.png)
<https://www.dingconnect.com>当代理,维护全球手机号。
<br>
<br>
# 结论
<br>
## 年鉴
<br>
- [科学大家|赌博的乐趣与挑战:不确定性与统计推断](https://tech.sina.cn/scientist/2018-09-11/detail-ihiixyeu6001744.d.html)
- [年鉴|概率论与数理统计的前世今生](https://www.jianshu.com/p/37158001f8df)
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=16&end=41" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=84&end=114" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=174&end=219" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=305&end=342" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=376&end=410" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=526&end=553" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=580&end=606" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=636&end=666" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=702&end=728" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=785&end=820" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=850&end=880" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=895&end=919" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=1092&end=1123" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=1140&end=1172" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=1180&end=1207" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=1239&end=1256" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/09nf9O3IqDg?start=1268&end=1315" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
## 附录
- File creation date: 2020-10-18
- File latest updated date: `r lubridate::today('Asia/Tokyo')`
- `r R.version.string`
- [**rmarkdown**](https://github.com/rstudio/rmarkdown) package version: `r packageVersion('rmarkdown')`
- File version: 0.2.1
- Author Profile: [®γσ, ξηg Lιαη Ημ](https://github.com/scibrokes/owner)
- GitHub: [Source Code](https://github.com/englianhu/report)
- Additional session information
```{r info, warning=FALSE, error=TRUE, results='asis'}
suppressMessages(require('formattable', quietly = TRUE))
suppressMessages(require('knitr', quietly = TRUE))
suppressMessages(require('kableExtra', quietly = TRUE))
sys1 <- devtools::session_info()$platform |>
unlist() |>
{\(.) data.frame(row.names = 1:length(.),
Category = names(.), session_info = .)}()
sys2 <- data.frame(Sys.info()) |>
{\(.) data.frame(Category = row.names(.), Sys.info = .[,1])}()
#remarks, dim(sys1), dim(sys2)
if (nrow(sys1) == 11 & nrow(sys2) == 8) {
sys2 <- sys2 |>
{\(.) rbind(., data.frame(
Category = c('rmarkdown', 'rsconnect', 'Current time'),
Sys.info = c(as.character(getwd()),
as.character(packageVersion('rsconnect')),
paste(as.character(lubridate::now('Asia/Tokyo')), 'JST 🌏'))))}()
} else if (nrow(sys1) == 10 & nrow(sys2) == 8) {
sys1 %<>% rbind(., data.frame(Category = '', session_info = ''))
sys2 <- sys2 |>
{\(.) rbind(., data.frame(
Category = c('rmarkdown', 'rsconnect', 'Current time'),
Sys.info = c(as.character(getwd()),
as.character(packageVersion('rsconnect')),
paste(as.character(lubridate::now('Asia/Tokyo')), 'JST 🌏'))))}()
}
sys <- cbind(sys1, sys2) |>
{\(.)
kbl(., caption = 'Additional session information:')}() |>
{\(.)
kable_styling(., bootstrap_options = c('striped', 'hover', 'condensed', 'responsive'))}() |>
{\(.)
row_spec(., 0, background = 'DimGrey', color = 'yellow')}() |>
{\(.)
column_spec(., 1, background = 'CornflowerBlue', color = 'red')}() |>
{\(.)
column_spec(., 2, background = 'grey', color = 'black')}() |>
{\(.)
column_spec(., 3, background = 'CornflowerBlue', color = 'blue')}() |>
{\(.)
column_spec(., 4, background = 'grey', color = 'white')}() |>
{\(.)
row_spec(., 11, bold = TRUE, color = 'yellow', background = '#D7261E')}()
rm(sys1, sys2)
sys
```
---
<span style='color:RoyalBlue'>**Powered by - Copyright® Intellectual Property Rights of <img src='figure/scibrokes_trading.jpg' width='18'> [Sςιβrοκεrs Trαdιηg®️](http://www.scibrokes.com)経営企業**</span>