Skip to content

Instantly share code, notes, and snippets.

@jberkenbilt
jberkenbilt / jq-stream-length.txt
Last active November 6, 2022 14:23
jq command for stream lengths
qpdf --json-output sample.pdf - | \
jq -r '
.qpdf[1]|
to_entries|
.[]|
select(.value.stream)|
(.key + ": " + (.value.stream.data|@base64d|length|tostring))'
@jberkenbilt
jberkenbilt / jq-sample-pdf-stream-length-output.txt
Created November 6, 2022 14:23
Output of getting stream lengths from sample.pdf
obj:2 0 R: 1044
obj:42 0 R: 3497
obj:43 0 R: 136
obj:46 0 R: 244
obj:51 0 R: 3534
obj:54 0 R: 255
obj:56 0 R: 7402
obj:59 0 R: 265
obj:61 0 R: 5047
obj:64 0 R: 209
@jberkenbilt
jberkenbilt / rotate.py
Created September 26, 2023 13:02
RDS Proxy-aware secret rotation function
# Based on but significantly customzed from
# https://github.com/aws-samples/aws-secrets-manager-rotation-lambdas/
# blob/7de971e35b3770028d04b0fb6c6bd54e4c2551a6/
# SecretsManagerRDSPostgreSQLRotationMultiUser/lambda_function.py
# That has this copyright:
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# See https://docs.aws.amazon.com/secretsmanager/
# latest/userguide/rotate-secrets_how.html
Type Description Example
Null the null value null
Boolean true or false true
Number integer or floating point 123, 3.14159
Text string delimited by parentheses (potato)
Binary string hex delimited by angle brackets <243f6a8885>
Name starts with /, used as keys or labels /Span
Array list of other types in square brakets [(One) 2 /Three]
Dictionary name/value pairs surrounded by &lt;&lt; and &gt;&gt; &lt; &gt;&gt;
Char Hex UTF-8 UTF-16-BE UTF-16-LE
W 57 57 0057 5700
π 3c0 cf 80 03c0 c003
2022 e2 80 a2 2022 2220
🥔 1f954 f0 9f a5 94 d83e dd54 3ed8 54dd
%PDF-2.0
%¿÷¢þ
%QDF-1.0
1 0 obj
<<
/Pages 2 0 R
/Type /Catalog
>>
endobj
BT
/F1 14 Tf
1 0 0 1 72 720 Tm
(Positioned at 72 720 with Tm and showed with Tj) Tj
50 -18 Td
(Down 18, right 50 relative to start of previous line with Td) Tj
ET
BT
1 0 0 1 72 660 Tm
[(One Two) -1000 (with space after Two using TJ)] TJ
%% Page 1
3 0 obj
<<
/Contents 5 0 R
/MediaBox [
0
0
612
792
]
7 0 obj
<<
/Font 8 0 R
/ProcSet [
/PDF
/Text
]
>>
endobj
8 0 obj
<<
/F1 9 0 R
/F10 10 0 R
/F2 11 0 R
/F3 12 0 R
/F4 13 0 R
/F5 14 0 R
/F6 15 0 R
/F7 16 0 R