Skip to content

Instantly share code, notes, and snippets.

@paugustyn-cbsi
Last active June 14, 2021 23:51
Show Gist options
  • Select an option

  • Save paugustyn-cbsi/a86e667e14cb670d0d20a045e6b19166 to your computer and use it in GitHub Desktop.

Select an option

Save paugustyn-cbsi/a86e667e14cb670d0d20a045e6b19166 to your computer and use it in GitHub Desktop.
bash tricks

Dates

# get UTC date (rfc-2822) for Unix epoch
date -Ru -r 0
# get Local time date for Unix epoch
date -R -r 0
# as above but for gdate and rfc-3339
gdate --rfc-3339=seconds -ud @0

## current UTC in epoch milliseconds
time=$(gdate +%s%N|cut -b1-13)

JQ

# map these that don't start their name with clip (negative regex)
cat content.json |jq  '.[] | {name: .name, id:.id, url:.asset_urls[0], description:.description} | select(.name | test("^clip")|not)'

# stringify JSON content
cat some-somple-metacontent.json|jq '.|tostring'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment