Last active
April 5, 2020 17:50
-
-
Save proger/68552605b4c45cf601f22a837087342a to your computer and use it in GitHub Desktop.
Count messages by date from Telegram for macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # key encoding: https://github.com/peter-iakovlev/Postbox/blob/e9a40ac1b4f73e95187ab293fdd2fc261415de96/Postbox/MessageHistoryTable.swift#L345 | |
| # table name: https://github.com/peter-iakovlev/Postbox/blob/e9a40ac1b4f73e95187ab293fdd2fc261415de96/Postbox/Postbox.swift#L1181 | |
| sqlite3 ~/Library/Group*/*Telegram*/account*/postbox/db/db_sqlite 'select hex(key) from t7' \ | |
| | python3 -c 'import sys, struct, binascii, datetime; | |
| [print(datetime.date.fromtimestamp(struct.unpack(">qiii", binascii.unhexlify(k.strip()))[1])) | |
| for k in sys.stdin]' \ | |
| | sort -n | uniq -c | |
| gnuplot \ | |
| -p \ | |
| -e 'set term png size 1000,200 fontscale 0.5' \ | |
| -e 'set xdata time' -e 'set timefmt "%Y-%m-%d"' -e 'set xtics rotate 86400' -e 'set format x "%b %d"' \ | |
| -e "plot '-' using 2:1 pt 3" \ | |
| > plot.png | |
| # 35 2018-10-04 | |
| # 53 2018-10-05 | |
| # 89 2018-10-06 | |
| # 73 2018-10-07 | |
| # 67 2018-10-08 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment