duangsuse::Echo
714 subscribers
4.24K photos
127 videos
583 files
6.46K links
import this:
美而不丑、明而不暗、短而不凡、长而不乱,扁平不宽,读而后码,行之天下,勿托地上天国。
异常勿吞,难过勿过,叹一真理。效率是很重要,盲目最是低效。
简明是可靠的先验,不是可靠的祭品。
知其变,守其恒,为天下式;穷其变,知不穷,得地上势。知变守恒却穷变知新,我认真理,我不认真。

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
#Ruby 滥用 Ruby
🤔 下面就是本 #Telegram Channel 的消息内容统计信息了
duangsuse::Echo
在 Ruby 里,要把它解析成 List & Object 的形式,只需要利用 Nokogiri: require 'nokogiri' plain = File.read('test.xml') doc = Nokogiri.parse(plain) root = doc.children[0] def collect_real_tags(xml) i = 1; ret = [] while i < xml.size ret << xml[i] i += 2 end …
可惜没有绘制成图表 plot 好看一些 🤔

r.size #=> 187

一共统计了 187 条消息。

r.sort_by { |it| it['published'] }.first['published']
=> 2019-03-24 11:22:00 +0800

第一条消息是
2019-03-24 11:22
发送的

r.sort_by { |it| it['published'] }.last['published']
=> 2019-04-05 20:06:00 +0800

最后一条消息是
2019-04-05 20:06
发送的


🔗 有 XXX 的消息条数

r.find_all { |it| it['body_type'] == 'HAS_HASHTAGS' }.size
=> 42
#Telegram Hashtag 的消息,一共有 42 条,约有 20% 的消息被打上了标签

r.find_all { |it| it['body_type'] == 'HAS_LINKS' }.size
=> 37
含链接的消息,一共有 37 条,约有 19% 的消息被打上了标签

r.find_all { |it| it['body_type'] == 'HAS_LINKS_AND_HASTAGS' }.size
=> 17
都有的消息有 17 条,占总消息的 9%

众所总周知,这种消息一般是很优秀的消息(跑),值得大家观摩,它们分别是:

r.sort_by { |it| it['debug']['no'] }

我们看到,第一条消息是 2019-03-24 11:22:00 的 AXMLParser 广播

https://t.me/dsuse/9512

它的总编号是 9512, 不过,因为零基数组微妙的差异(解析的时候用了两次零基数组),得加上 1 才可以

puts r.find_all { |it| it['body_type'] == 'HAS_LINKS_AND_HASTAGS' }.map { |m| "https://t.me/dsuse/#{m['debug']['no'] + 9511 +1}" }.sort.join("\n")

::
https://t.me/dsuse/9527
https://t.me/dsuse/9541
https://t.me/dsuse/9576
https://t.me/dsuse/9580
https://t.me/dsuse/9585
...

或者详细一点:
puts r.find_all { |it| it['body_type'] == 'HAS_LINKS_AND_HASTAGS' }.map { |m| "https://t.me/dsuse/#{m['debug']['no'] + 9511 +1}\n#{m['body'][0..50]}...\n" }.sort.join("\n")

https://t.me/dsuse/9527
#Ruby #Project 一个失败的尝试,但是我也了解了二进制 IO 的一些信息

https:/...

https://t.me/dsuse/9541
https://zhuanlan.zhihu.com/p/60171538

#dotNet

...

https://t.me/dsuse/9576
#Mozilla #ES6 #JavaScript #frontend #backend 啊,的确,不...

https://t.me/dsuse/9580
#tech #CS 来科普一打有趣的信息技术相关知识: 🤗

1. Windows 里的 A: B: ...

https://t.me/dsuse/9585
5. 手机和磁卡放在一起,会不会『消磁』?

== 对于磁卡来说,『消磁』是什么?
以磁性介质存储...

https://t.me/dsuse/9586
6. 世界上第一个网站是什么?

惊闻刘国梁荣当乒协主席,深感高兴。虽然我们未曾有过交集,但乒乓球运动...

https://t.me/dsuse/9605
https://github.com/duangsuse/RandomPicture 我必须得感谢自己...

https://t.me/dsuse/9621
我待会把坑填完... #Android #blogPOst

https://blog.yuuta.m...

https://t.me/dsuse/9637
效率.... 🤐

那既然已经花了很多时间就再多花一点(皮)

演示一下这个功能:

[DuangSU...

https://t.me/dsuse/9638
最后,快速了解一下 #Android 系统服务 (https://blog.yuuta.moe/201...

https://t.me/dsuse/9643
https://github.com/LineageOS/android_frameworks_bas...

https://t.me/dsuse/9645
#blog #recommended https://bindog.github.io/

...

https://t.me/dsuse/9654
#CS #fix 下面我来给大家解释一下停机问题和 NP 困难到底是什么,和我这里提到的 NP-har...

https://t.me/dsuse/9663
现在开始讲解方才 @drakeet 的排序问题

5 没有被手动排序过,5 排在 1 前面,4 被手动...

https://t.me/dsuse/9676
#Android 类似的设计详询 Android Input Methods (https://dev...

https://t.me/dsuse/9684
感谢 @haoyet @eGluZl 等热心用户的建议,YuutaW 主要参照 https://www...

https://t.me/dsuse/9689
#通知

我们的MTProxy已经上线,欢迎使用
点击这里设置代理 (https://t.me/pro...
修改了 SourceManager 相关的细节,正在发布新版本
duangsuse::Echo
可惜没有绘制成图表 plot 好看一些 🤔 r.size #=> 187 一共统计了 187 条消息。 r.sort_by { |it| it['published'] }.first['published'] => 2019-03-24 11:22:00 +0800 第一条消息是 2019-03-24 11:22 发送的 r.sort_by { |it| it['published'] }.last['published'] => 2019-04-05 20:06:00 +0800 最后一条消息是…
😃 那么,简而言之,我觉得有价值的信息:

def get_link(h); "https://t.me/dsuse/#{h['debug']['no'] + 9511 + 20}"; end

+ 一共统计了 187 条消息。

2019-03-24 11:22 - 2019-04-05 20:06,一共两个星期的时间里,本频道 @dsuse

+ 有 #Telegram Hashtag 的消息,一共有 42 条,约有 20% 的消息被打上了标签
+ 含链接的消息,一共有 37 条,约有 19% 的消息被打上了标签
+ 链接和 Tag 都有的消息有 17 条,占总消息的 9%

map { |h| [h['body'].size, h] }.sort_by { |it| it.first }.reverse
map { |h| [h['body'].size, h] }.sort_by { |it| it.first }.reverse.first[1]['links'].size

+ 187 条消息里,最长的消息是这条,它有 4475 个字 — 连链接都有 25 条! 🤪
+ 187 条消息里,折行最多的消息是这条,它有 4232 个字和 7 条链接。

sum { |it| it['body'].size } / size
+ duangsuse 的平均字数:359 字 / 消息

sum { |it| it['body'].lines.size } / size
+ duangsuse 的平均行数:11 行 / 消息

find_all { |it| it['header_type'] == 'REPLY' }.size
+ 过去的 187 条消息里,有 70 条都是回复,占总量 37%

find_all { |it| it['header_type'] == 'FORWARDED' }.size
+ 过去的 187 条消息里,有 45 是转发自其他频道或个人的,占总量 24%
当然,这 70 条都是回复本频道消息的。

a.uniq.map { |u| [u, a.count(u)] }.sort_by { |it| it.last }.reverse.to_h.each { |e| puts "#{e.first}: #{e.last}" }
+ 转发者和条数表如下:

IT 那点事 (YuutaW 鱼塔): 10
羽毛的小白板: 10
duangsuse Throws: 6
Rachel 碎碎念 (IFTTT): 5
Rachel 的消息发布站点 (Rachel Miracle.) via @like: 3
YSC 的频道: 2
duangsuse ¯\_(ツ)_/¯ |学渣 | 我爱学习 | ∈ [E²PROM, 范畴论]: 2
Doge: 2
YuutaW 鱼塔: 2
Rachel 碎碎念 (湘江一桥): 2
DogeSpeed广播: 1

😄 @haneko_daily 被转发的次数最多,继续努力!

sort_by { |it| it['hashtags'].size }.reverse
+ 具有最多标签的消息是这条,它有足足 8 条标签!

sort_by { |it| it['links'].size }.reverse.first
+ 具有最多链接的消息是这条,它有 25 条链接!同时也是字数最多的消息!

find_all { |it| it['header_type'] == 'A_PHOTO' }.size
过去 187 条消息里,一共有 29 条广播是单纯的一个照片 🖼
find_all { |it| it['header_type'] == 'A_ALBUM' }.size
过去 187 条消息里,一共有 5 条广播是照片集 📸
find_all { |it| it['header_type'] == 'IS_STICKER' }.size
可爱 🐱 的 duangsuse 在过去 187 条消息里使用了 28 个 sticker 抒发自己的感情,使用的表情这么多:
find_all { |it| it['header_type'] == 'IS_STICKER' }.collect { |it| it['ext'] }.yield_self { |r| r.uniq.map { |u| [u, r.count(u)] }.sort_by { |it| it.last }.reverse.to_h.each { |e| puts "#{e.first}: #{e.last}" } }

😔: 7
😳: 4
😲: 3
😡: 2
😑: 2
🙄: 2
😋: 2
😀: 2
😥: 2
🍹: 1
😐: 1

find_all { |it| it['header_type'] == 'HAS_FILE' }.size
duangsuse 在过去 187 条消息里发了 8 个文件,它们是:
find_all { |it| it['header_type'] == 'HAS_FILE' }.collect { |it| it['ext'] }
["axml.rb", "AndroidManifest.xml", "AndroidManifest.xml", "TextSort.kt", "RandomPicture.kt", "Vibrator.svg", "Vibrator.png", "Vibrator.svg"]

最火的
hashtags 组合:

collect { |it| it['hashtags'] }.yield_self { |r| r.uniq.map { |u| [u, r.count(u)] }.sort_by { |it| it.last }.reverse.to_h.each { |e| puts "#{e.first}: #{e.last}" } }

结果太长,在这里查看

所有 Hashtags:
hs = s.flatten.find_all { |it| it.is_a? Array }.flatten.map { |s| s.tr(" ", "") }
"#" + hs.uniq.join(' #')

#Android #zhihu #KDE #Low #Haha #life #tech #tencent #WeChat #weibo #share #tools #dev #Markups #Telegram #Hack #aop #Huawei #通知 #Freedom #sysadmin #GitHub #travis #CI #Sysadmin #Linux #Coolapk #Web #frontend #HTML #China #school #Microsoft #Life #VisualStudio #-} #OOP #web #geekapk #doge #CS #fix #CSharp #School #blog #recommended #bin #backend #Kotlin #Java #Share #svg #blogPOst #PL #JVM #Moha #code #ALgotithm #DuangsuseSB #GeekApk #SQL #Learn #wiki #Mozilla #ES6 #JavaScript #MoHa #Paper #haha #dotnet #bad #OOP_Delegates #Parallelism #dotNet #Csharp #Windows #performance #Channel #weekly #linux #Ruby #Project

以及他们的消息覆盖个数:
hs.yield_self { |r| r.uniq.map { |u| [u, r.count(u)] }.sort_by { |it| it.last }.reverse.to_h.each { |e| puts "#{e.first}: #{e.last}" } }

太长,这里看

== 非线性查询(当然和算法上那个没有关系啦,就是复杂一点的查询)

// 收集所有单 / 双数索引

ar = []; ar2 = []

i = 0 // 0 2 4 6
while i < self.size; ar << self[i]; i += 2; end
i = 1 // 1 3 5 7
while i < self.size; ar << self[i]; i += 2; end


aa = ar.zip(ar2)

我们将比较相邻两消息之间的关系。

aa.zip(aa.map { |ms| ms.last['published'] - ms.first['published'] }).sort_by { |p| p.last }.reverse

间隔最长的两条消息是这条这条,间隔 44880 秒(12 小时)

b.map { |h| [h.last, h.first.first['body'].size ] }.map { |a| a.last / a.first }.select { |it| not it.nan? and not it.infinite? }.sort.reverse

平均打字速度:7 字 / 秒 🤔

受到解析度(只到分钟)和浮点运算准确度的影响,有很多消息都是在间隔一分钟内发完的,统计结果可能不正确。

好啦,还有什么别的信息,请大家自己来发掘呗( 😝 比如说,我熬夜发过多少消息。
duangsuse::Echo
TextSort.kt
#Algorithm #fix 🤔 如果没有这次我还不知道这个弄错了
#paper http://www.cad.zju.edu.cn/home/vagblog/VAG_Work/echarts.pdf

没有什么内容,讲了一下核心策略性算法实现,大家可以随便看看。英文水平不需要很高,我觉得还是不错的
https://echarts.baidu.com/examples/

啊真好看,不过我还是想先用 plot 分析一下本频道的消息发送时间(跑
This media is not supported in your browser
VIEW IN TELEGRAM
不愧是大公司联合浙大高校出品!居然做了这么多图表,那群个人维护的都要被逼死了... emmm....
Qt 的 datavisual 模块也没有这么多组件,这哪里还是项目,分明是大型技术产品
#Algorithm https://github.com/aappleby/smhasher/
Hash 算法碰撞测试套件

== 不知道什么是 Hash 算法?

Hash 算法一般把某种数据『比如,一群二进制位,或者一群字节』映射到(或者根据...而生成)更短的数据(比如,把字符串映射到 32 位无符号整形)

基于 Hash 算法,我们可以实现 HashMap — 这是基本数据结构 List, Map, Set 三大里的一种,在即使是应用编程领域的重要性不言而喻(当然对一些计算机图形学和数学之类的可能 hashCode 用处少一些)。

你可以这么理解

hash("a") => 0xa8908f4ff
hash(1) => 0xfda23402
hash("b") => 0x5afd6a37

这样,如果要对比两个字符串,就不必比较所有字符 — 可以只比较散列值

衡量一个 hash 算法优劣的标准是:碰撞的概率有多大?
好的 hash 算法让输入均衡分配在目标散列空间里,而坏的 hash 算法会让散列到处冲突(不同的输入得到相同的函数值)

Kotlin 里面,对象是这么定义的:

package kotlin

open class Any {
open operator fun equals(other: Any?): Boolean
open fun toString(): String
open fun hashCode(): Int
}

虽然这种设计也被一些观点认为是无必要的,但 hashCode 的重要性这里可见一斑
这啥数据都有了... 不只是浮点? 还有网状图
树状图(就是数据结构里的树, tree. 有向无环图的一种)可以被展示成这样?
Image to Bar3D... 😵???
#CG 真好看,某些大型平台比如 OMP、AVX、SSE、MMX、OpenGL、CUDA 什么的必须学学了... 🤔

啥时候学某学长写个 SSE 优化的 Java CriticalNative 矩阵处理呢?

啥?居然是学姐?这么说我开始还记得是对的? 🌚
duangsuse::Echo
https://github.com/rdp/ruby_gnuplot 使用这个画 X axis: 时间点 Y axis: 消息条数
#Coolapk #stat 顺便推荐隔壁老酷安统计的(两年前了),unnamed 大佬好像把自己的统计删了... 🤔

不过我是拿 Ruby 内建的列表处理方法算了自己频道的小数据,他是用 SQL 建模查询的(