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
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 建模查询的(
可以画出 plot
笑死我了 🤣 #Ruby #Haha
duangsuse::Echo
#Ruby 弄了半天我才知道 Ruby 里 Enumerator 还可以 with_index... 😂 还可以 map(Enumerator).with_index { |a, i| }...
require 'gnuplot'

xs = []; ys = []

_dataset = r.map { |it| it['published'] }
ps = _dataset.sort_by { |d| d.day }.reverse.each { |k| xs << k.day; ys << _dataset.count { |it| it.day == k.day } }

Gnuplot.open do |p|
Gnuplot::Plot.new(p) do |plot|

plot.title "duangsuse::Echo message publish time (all #{ys.size}, day from #{xs.min} to #{xs.max})"
plot.xlabel "day (1-31)"
plot.ylabel "messages count"

plot.data << Gnuplot::DataSet.new([xs, ys]) do |ds|
ds.with = "points"
ds.notitle
end
end
end

然后就可以画出类似下面的统计折线图: 🤔 #Ruby #Gnu #stat #Learn

需要注意的是,gnuplot 比较底层和原始,它不会自动帮你处理好数据集合排序(如果需要的话,比如这里就需要)
弄不好会生成瞎* 🐔 折线图,会包含『反折』的线条角度...

Ruby 的 gnuplot Gem 很简单,之需了解 DataSet 和 Plot、GnuPlot 程序命令行接口的抽象即可

Plot 是图座标系的抽象,包含 title(图表名)、xlabelylabel,也可以设置初始 xrange,它包含的折线们就是 data 数组

DataSet 就是要往 Plot 上画的点集合,每个新画上去的点都有一个 x value 和 y value(可以作为一个 xvalue, yvalue 数组传入 new),并且如果要连线就会和上一个点连接。
DataSet 可以指定是 with 'lines' 'points' 还是 'linespoints'
可以指定 linewidthtitle(这条折线的 title)也可以 notitle