This file contains 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
#!/bin/bash | |
BS=64M | |
ROOT_DEV=/dev/mmcblk0 | |
BOOTFS_BACKUP=${ROOT_DEV}p3 | |
BOOTFS_TARGET=${ROOT_DEV}p1 | |
ROOTFS_BACKUP=${ROOT_DEV}p2 | |
ROOTFS_TARGET=${ROOT_DEV}p4 | |
print_yellow() { | |
echo -e "\033[1;33m${1}\033[0m" |
This file contains 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
COPY ( | |
WITH | |
-- Read the raw log line by line by abusing CSV parser | |
raw_log AS ( | |
FROM read_csv_auto('/tmp/log/access.log-20230904.gz', header=false, delim='\0') | |
) | |
, combined_log AS ( | |
SELECT regexp_extract(column0 | |
, '^(\S+) (\S+) (\S+) \[(.*?)\] "([A-Z]+?) (.*?) HTTP/(.*?)" (\d+) (\d+) "(.*?)" "(.*?)"$' | |
, [ 'ip', 'identity', 'userid', 'timestamp', 'method' |
This file contains 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
// Queues multiple asynchronous processes to run sequentially via promises | |
// Process can be added to the queue while other processes are running | |
var Sequence = function() {}; | |
Sequence.prototype.enqueue = function(fn) { | |
this.tail = this.tail ? this.tail.finally(fn) : fn(); | |
}; | |
// Usage |