All gists

jackz
Last active 2 hours ago
0 0 1
1 #!/bin/bash
2 K=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004
3 echo "$K" | wc -c
4 # generate secp384r1 key with provided K value
5 # 30 3E SEQUENCE, len 62
6 # 02 01 01 version = 1
7 # 04 30 <bytes of K value> privateKey OCTET STRING
8 # A0 07 06 05 2B 81 04 00 22 [0] parameters = secp384r
9 printf '303e0201010430%s%s' "$K" 'a00706052b81040022' | xxd -r -p > key.der \
10 && openssl ec -inform DER -in key.der -out private-key.pem \
jackz
Last active 1 month ago

https://unix.stackexchange.com/questions/587646/how-to-get-the-total-duration-of-all-video-files-in-current-folder-and-sub-direc

0 0 1
1 # Recursive all files in dir
2 exiftool -ext mp4 -r -n -q -p '${Duration;$_ = ConvertDuration(our $total += $_)}' . | tail -n 1
3
4 # More control
5 # calc-durs Replay_* - all files matching glob in single folder only
6 # calc-durations -r Replay_* - recursive in all folders
7 calc-durs() {
8 local -a files
9 if [[ "$1" == "-r" ]]; then
10 shift
jackz
Last active 5 months ago
0 0 1
1 rename table stats_games to stats_sessions;
2 create table stats_games
3 (
4 id int unsigned auto_increment primary key,
5 uuid uuid default uuid() not null comment 'legacy campaignID' unique,
6 date_start bigint not null comment 'unix timestamp',
7 date_start_finale int null comment 'unix timestamp of finale',
8 date_end bigint null comment 'unix timestamp',
9 duration_game bigint as (`date_end` - `date_start`) comment 'seconds of game',
10 duration_finale bigint as (`date_end` - `date_start_finale`) comment 'seconds of finale',