←back to thread

756 points speckx | 1 comments | | HN request time: 0.205s | source
Show context
Noumenon72 ◴[] No.45675495[source]
While you're creating and testing aliases, it's handy to source your ~/.zshrc whenever you edit it:

    alias vz="vim ~/.zshrc && . ~/.zshrc"
I alias mdfind to grep my .docx files on my Mac:

    docgrep() {
      mdfind "\"$@\"" -onlyin /Users/xxxx/Notes 2> >(grep --invert-match ' \[UserQueryParser\] ' >&2) | grep -v -e '/Inactive/' | sort
    }
I use an `anon` function to anonymize my Mac clipboard when I want to paste something to the public ChatGPT, company Slack, private notes, etc. I ran it through itself before pasting it here, for example.

    anonymizeclipboard() {
      my_user_id=xxxx
      account_ids="1234567890|1234567890"  #regex
      corp_words="xxxx|xxxx|xxxx|xxxx|xxxx"  #regex
      project_names="xxxx|xxxx|xxxx|xxxx|xxxx"  # regex
      pii="xxxx|xxxx|xxxx|xxxx|xxxx|xxxx"  # regex
      hostnames="xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx|xxxx"  # regex
      # anonymize IPs
      pbpaste | sed -E -e 's/([0-9]{1,3})\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/\1.x.x.x/g' \
      -e "s/(${corp_words}|${project_names}|${my_user_id}|${pii}|${hostnames})/xxxx/g" -e "s/(${account_ids})/1234567890/g" | pbcopy
      pbpaste
    }

    alias anon=anonymizeclipboard
It prints the new clipboard to stdout so you can inspect what you'll be pasting for anything it missed.
replies(2): >>45676789 #>>45676978 #
1. xwowsersx ◴[] No.45676978[source]
ha! alias vz="vim ~/.zshrc && . ~.zshrc" is brilliant. Editing zshrc and sourcing is something I do pretty often. Never thought to alias