Skip to content

Instantly share code, notes, and snippets.

@vhbsouza
Last active March 10, 2021 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vhbsouza/b6a71c630c14236fb6a1b01676637fed to your computer and use it in GitHub Desktop.
Save vhbsouza/b6a71c630c14236fb6a1b01676637fed to your computer and use it in GitHub Desktop.
Sample Git Attributes File
# Encrypt the repository
# Remove/modify this line if the repository is meant to be open-source
*.* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.htm text
*.html text
*.xml text
*.txt text
*.ini text
*.inc text
.htaccess text
# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
# Auto detect text files and perform LF normalization
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
* text=auto
# Documents (about ASTEXTPLAIN: http://stackoverflow.com/questions/28146244/what-is-the-difference-between-diff-and-diff-astextplain)
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
#!/bin/sh -e
# minimalistic replacement for `run-mailcap --action=cat <file>`
if test "$#" != 1 ; then
echo "Usage: astextplain <file>" 1>&2
exit 1
fi
# XXX output encoding (UTF-8) hardcoded
case "$1" in
*.doc | *.DOC | *.dot | *.DOT)
antiword -m UTF-8 "$1" || cat "$1"
;;
*.docx | *.DOCX)
docx2txt "$1" -
;;
*.pdf | *.PDF)
pdftotext -layout "$1" -enc UTF-8 -
;;
# TODO add rtf support
*.rtf | *.RTF)
cat "$1"
;;
*)
echo "E: unsupported filetype $1" 1>&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment