Skip to content

Instantly share code, notes, and snippets.

@mbierman
Created June 11, 2020 17:09
Show Gist options
  • Select an option

  • Save mbierman/5416e780be1a4eca8c970336a723dc26 to your computer and use it in GitHub Desktop.

Select an option

Save mbierman/5416e780be1a4eca8c970336a723dc26 to your computer and use it in GitHub Desktop.
This script cleans the 'config.js' for homebridge so you can share it for debugging purposes.
#!/usr/bin/env sh
cat config.json | sed \
-e 's|"username.*|"username":"*****",|g' \
-e 's|"pin.*|"pin": "*****"|g' \
-e 's|"IFTTTkey.*|"IFTTTkey:"*****",|g' \
-e 's|"IFTTTservice.*|"IFTTTservice: "*****",|g' \
-e 's|"ip": "192.*|"ip": "*****",|g' \
-e 's|"mac.*|"mac": "*****",|g' \
-e 's|"account.*|"account":"*****",|g' \
-e 's|"password.*|"password":"*****",|g' \
-e 's|"location".*|"location":"*****",|g' \
-e 's|"url": "https://.*|"url":"https://...",|g' \
-e 's|"Authorization": "Basic.*|" "Authorization": "Basic ****"},|g' \
-e 's|"latitude":.*|"latitude": ***,|g' \
-e 's|"longitude":.*|"longitude": ***,|g' \
-e 's|"access_token.*|"access_token":"****",|g' \
-e 's|"key.*|"key":"******",|g' \
-e 's|"locationCity.*|"locationCity": "*****",|g' \
-e 's|[0-9][0-9].[0-9][0-9],|*****|g' > config.clean.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment