Skip to content

Instantly share code, notes, and snippets.

@Arathi
Arathi / cmppv2.lua
Last active January 2, 2024 11:39
Wireshark CMPP 2.0 协议插件
----------------
-- 报文结构定义
----------------
CMPPv2_Field_Protos = {
Command_Name = {
[0x00000001] = "CMPP_CONNECT",
[0x80000001] = "CMPP_CONNECT_RESP",
[0x00000002] = "CMPP_TERMINATE",
[0x80000002] = "CMPP_TERMINATE_RESP",
[0x00000004] = "CMPP_SUBMIT",
@mrqwer88
mrqwer88 / cl_clean.yaml
Last active May 17, 2020 17:52
clean old partitions in clickhouse
databases:
- logs: 7
- vms: 9
- statistics: 20
connect_line: '127.0.0.1'
log_file: 'cl_clean_partitions.log'
@alexey-milovidov
alexey-milovidov / rank.txt
Created July 22, 2016 00:03
Example of emulation of rank function with arrayEnumerateUniq.
milovidov@milovidov-xenial:~$ clickhouse-client
ClickHouse client version 1.1.53996.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.53996.
:) CREATE TABLE IF NOT EXISTS `employee` (
:-] `empid` Int32,
:-] `deptid` Int32,
:-] `salary` Int64
:-] ) ENGINE = Memory;
@alexey-milovidov
alexey-milovidov / rounding_time.txt
Created June 20, 2016 21:00
Example of rounding time to 5-second interval in ClickHouse.
:) SELECT toDateTime(intDiv(toUInt32(EventTime), 5) * 5) AS k, count(), uniq(UserID) FROM hits_layer WHERE CounterID = 29761725 AND EventDate = today() AND EventTime >= now() - 600 GROUP BY k ORDER BY k
SELECT
toDateTime(intDiv(toUInt32(EventTime), 5) * 5) AS k,
count(),
uniq(UserID)
FROM hits_layer
WHERE (CounterID = 29761725) AND (EventDate = today()) AND (EventTime >= (now() - 600))
GROUP BY k
ORDER BY k ASC