Skip to content

Instantly share code, notes, and snippets.

@thn929
thn929 / server.properties
Created October 10, 2017 23:29
Kafka server props
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@thn929
thn929 / jq_tricks.sh
Last active November 10, 2022 15:58
jq tricks
#1: human-readable dates and timestamps within context
```bash
cat something.json | jq 'walk(if type == "object" then with_entries(if(.key | contains("date")) or (.key | contains("timestamp")) then {key, value: .value|.[0:10]|tonumber|todate} else . end) else . end)'
```
#2: Like above, but filters down to just the dates and timestamps, and displays the paths to each field
```bash
cat something.json | jq 'walk(if type == "object" then with_entries(if(.key | contains("date")) or (.key | contains("timestamp")) then {key, value: .value|.[0:10]|tonumber|todate} else . end) else . end)' | jq 'del(.. | .source_data?)' | jq -r 'paths(scalars) as $p | [ ( [ $p[] | tostring ] | join(".") ), ( getpath($p) | tojson )] | join(": ")' | grep 'date\|time'
```
@thn929
thn929 / gist:7b8087ef37ce209c91da8e12f71d25a2
Created September 27, 2024 17:07
HP m254dw Paper Types as of 2024.09.27
Any Type
Plain
HP Matte 90g
HP Matte 105g
HP Matte 120g
HP Matte 150g
HP Matte 200g
HP Glossy 120g
HP Glossy 150g
HT Tri Glossy 150g
@thn929
thn929 / gist:88a769faee2009597e9603bbf546323c
Last active December 22, 2024 23:51
HP m254dw paper sizes as of 2024.12.22
Any Size
Letter
Legal
Executive
Oficio 8.5 x 13 in.
4 x 6 in.
5 x 8 in.
A4
A5
A6