Skip to content

Instantly share code, notes, and snippets.

@brainwo
Last active August 2, 2023 14:14
Show Gist options
  • Save brainwo/e7967d39bcfc4521d8798efd802c06f3 to your computer and use it in GitHub Desktop.
Save brainwo/e7967d39bcfc4521d8798efd802c06f3 to your computer and use it in GitHub Desktop.
Useful shell recipes

System-wide color picker for Flutter, copied to clipboard

xcolor -c "Color.fromRGBO(%{r}, %{g}, %{b}, 1)" | tr -d '\n' | xclip -selection clipboard
  • xcolor
    https://github.com/Soft/xcolor
  • -c "Color.fromRGBO(%{r}, %{g}, %{b}, 1)"
    custom format for Flutter's Color.fromRGBO
  • tr -d '\n'
    trim whitespace
  • xclip -selection clipboard
    copy to clipboard
    default -s option from xcolor could fails in certain paste target

OCR from a screen region, reads English+Japanese+Trad.Chinese, copied to clipboard

maim -s -B /tmp/tesseractss.png && tesseract "/tmp/tesseractss.png" - -l eng+jpn+chi_tra | xclip -selection clipboard
  • maim
    https://github.com/naelstrof/maim
  • -s
    select a screen region
  • -B
    capture with background, if target is a window
  • "/tmp/tersseractss.png"
    save screenshot as temporary file
  • tesseract
    https://github.com/tesseract-ocr/tesseract
  • "/tmp/tesseractss.png"
    read previously saved screenshot
  • -
    output to stdout
  • -l eng+jpn+chi_tra
    (require installation) specify language to use
  • xclip -selection clipboard
    copy to clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment