diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-07 16:45:53 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-07 16:45:53 +0300 |
commit | 0f96ff8d3cce34ef7db3ccca81475acda0c9a877 (patch) | |
tree | 6ce881500a59ee39cb094abf0645ad2413da3515 | |
parent | README update (diff) | |
download | linux-home-0f96ff8d3cce34ef7db3ccca81475acda0c9a877.tar.gz linux-home-0f96ff8d3cce34ef7db3ccca81475acda0c9a877.zip |
add Sublime Text 3 settings
* .bashrc: shopt -s nullglob
* .bashrc: errexit error handling
-rw-r--r-- | .Sublime Text 3/Default (Windows).sublime-keymap | 6 | ||||
-rw-r--r-- | .Sublime Text 3/Preferences.sublime-settings | 30 | ||||
-rw-r--r-- | .bashrc | 104 |
3 files changed, 79 insertions, 61 deletions
diff --git a/.Sublime Text 3/Default (Windows).sublime-keymap b/.Sublime Text 3/Default (Windows).sublime-keymap new file mode 100644 index 0000000..1609b63 --- /dev/null +++ b/.Sublime Text 3/Default (Windows).sublime-keymap @@ -0,0 +1,6 @@ +[ + { + "keys": ["f5"], + "command": "revert" + } +] diff --git a/.Sublime Text 3/Preferences.sublime-settings b/.Sublime Text 3/Preferences.sublime-settings new file mode 100644 index 0000000..c26e551 --- /dev/null +++ b/.Sublime Text 3/Preferences.sublime-settings @@ -0,0 +1,30 @@ +{ + "always_show_minimap_viewport": true, + "auto_complete_commit_on_tab": true, + "color_scheme": "Packages/Color Scheme - Default/Dawn.tmTheme", + "detect_indentation": false, + "draw_indent_guides": false, + "draw_minimap_border": true, + "fallback_encoding": "Cyrillic (Windows 1251)", + "font_options": + [ + "no_italic", + "no_bold" + ], + "font_size": 11, + "highlight_line": true, + "highlight_modified_tabs": true, + "rulers": + [ + 79 + ], + "scroll_speed": 0, + "show_encoding": true, + "show_line_endings": true, + "smart_indent": false, + "translate_tabs_to_spaces": true, + "trim_trailing_white_space_on_save": true, + "word_wrap": false, + "hot_exit": false, + "remember_open_files": false, +} @@ -28,6 +28,7 @@ set -o pipefail set -o nounset +shopt -s nullglob # Shell Options # @@ -206,46 +207,28 @@ nwx_host=172.28.10.2 nwx_dev2=172.28.19.60 nwx_dev3=172.28.19.61 -list_files() { - local cmd='find . -type f' - if [ $# -gt 0 ]; then - cmd+="$( printf ' %q' '-(' )" - local fmask="$1" - cmd+="$( printf ' -iname %q' "$fmask" )" - shift - for fmask; do - cmd+="$( printf ' -o -iname %q' "$fmask" )" - done - cmd+="$( printf ' %q' '-)' )" +symlink_sublime_preferences() ( + set -o errexit + + local src_dir="$HOME/.Sublime Text 3" + local dest_dir="$APPDATA/Sublime Text 3/Packages/User" + + if [ ! -d "$dest_dir" ]; then + mkdir -p "$dest_dir" fi - eval "$cmd" -} -list_dirs() { - find . -type d | tail -n +2 | xargs realpath -} + find "$src_dir" -maxdepth 1 -type f -exec ln -fs {} "$dest_dir" \; +) -list_git_files() { - git ls-files -} +tighten_up_file_permissions_in_repo() ( + set -o errexit -list_git_dirs() { - { - list_git_files | xargs realpath | xargs dirname && realpath . - } | sort | uniq | tail -n +2 -} + git ls-files | xargs chmod 0600 -adjust_dotfiles_permissions() { - pushd ~ > /dev/null \ - && list_git_files | xargs chmod 0600 \ - && list_git_dirs | xargs chmod 0700 \ - && chmod 0700 .git \ - && pushd .git > /dev/null \ - && list_files | xargs chmod 0600 \ - && list_dirs | xargs chmod 0700 \ - && popd > /dev/null \ - && popd > /dev/null -} + { echo . ; git ls-files ; } | xargs dirname | sort | uniq | tail -n +2 | xargs chmod 0700 + + chmod 0700 .git +) alias dos2unix_='sed --binary --in-place '"'"'s/\(\r\?\)$//'"'" alias unix2dos_='sed --binary --in-place '"'"'s/\r\?$/\r/'"'" @@ -262,53 +245,52 @@ lint() { && ensure_eol_unix "$@" } -lint_all() { - local path - list_files "$@" | while read -r path ; do lint "$path" ; done -} - doslint() { rtrim_line_whitespace "$@" \ && rtrim_file_newlines_dos "$@" \ && ensure_eol_dos "$@" } -doslint_all() { - local path - list_files "$@" | while read -r path ; do doslint "$path" ; done -} +doslint_webapi() ( + set -o errexit -doslint_webapi() { local root_dir='/cygdrive/c/Netwrix Auditor/CurrentVersion-AuditCore-Dev/AuditCore/Sources' - pushd "$root_dir/Configuration" > /dev/null \ - && doslint_all 'WebAPI*.acinc' 'WebAPI*.acconf' \ - && popd > /dev/null \ - && pushd "$root_dir/Subsystems/PublicAPI" > /dev/null \ - && doslint_all '*.cpp' '*.h' \ - && popd > /dev/null -} -backup_repo() { + cd "$root_dir/Configuration" + doslint WebAPI*.acinc WebAPI*.acconf + + cd "$root_dir/Subsystems/PublicAPI" + local path + find . -type f -\( -iname '*.cpp' -o -iname '*.h' -\) | while read -r path ; do + doslint "$path" + done +) + +backup_repo() ( + set -o errexit + if [ $# -eq 1 ]; then local repo_dir_path="$1" - local backup_dir_path="$( realpath . )" || return $? + local backup_dir_path="$( realpath . )" elif [ $# -eq 2 ]; then local repo_dir_path="$1" local backup_dir_path="$2" else echo "Usage: $FUNCNAME REPO_DIR_PATH [BACKUP_DIR_PATH]" >&2 - return 1 + exit 1 fi - local zip_name="$( basename "$( realpath "$repo_dir_path" )" )_$( date -u +'%Y%m%dT%H%M%S' ).zip" || return $? + + local zip_name="$( basename "$( realpath "$repo_dir_path" )" )_$( date -u +'%Y%m%dT%H%M%S' ).zip" + git archive \ --format=zip -9 \ --output="$backup_dir_path/$zip_name" \ --remote="$repo_dir_path" \ HEAD -} +) backup_repo_dropbox() { - backup_repo "$@" "/cygdrive/c/Users/$( whoami )/Dropbox/backups" + backup_repo "$@" "$USERPROFILE/Dropbox/backups" } backup_repo_netwrix() { @@ -318,11 +300,11 @@ backup_repo_netwrix() { checksums_path='sha1sums.txt' update_checksums() { - list_files "$@" | xargs sha1sum > "$checksums_path" + sha1sum "$@" > "$checksums_path" } -update_distr_checksums() { - update_checksums '*.exe' '*.iso' +update_checksums_distr() { + update_checksums *.exe *.iso } verify_checksums() { |