├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── lint-github-actions.yaml │ ├── lint-markdown.yaml │ ├── lint-yaml.yaml │ ├── test_macos_1.yml │ ├── test_macos_2.yml │ ├── test_macos_3.yml │ ├── test_macos_4.yml │ └── test_ubuntu.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── _bashrc ├── _gitconfig ├── _gitignore ├── _hgrc ├── _inputrc ├── _screenrc ├── _sshconfig ├── _vimrc ├── bashrc_includes ├── 50_prompt.bash ├── adb.bash ├── android_reverse_engineering_related_aliases.bash ├── bash_history_customization.bash ├── better_autocomplete.bash ├── custom_aliases.bash ├── git-completion.bash ├── gradle_autocomplete.bash └── p4_autocomplete.bash ├── bors.toml ├── gradle.properties ├── scripts ├── git-wtf └── starship.toml ├── setup ├── _macos ├── setup_cryptocurrencies.sh ├── setup_new_mac_machine.sh ├── setup_new_ubuntu_machine.sh └── solarized_dark.itermcolors.txt └── setup_dotfiles.sh /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # These are supported funding model platforms 3 | 4 | github: ashishb 5 | open_collective: ashishb 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/lint-github-actions.yaml: -------------------------------------------------------------------------------- 1 | # Generated by Gabo (https://github.com/ashishb/gabo) 2 | --- 3 | # Run this locally with act - https://github.com/nektos/act 4 | # act -j lintGitHubActions 5 | name: Lint GitHub Actions 6 | 7 | on: # yamllint disable-line rule:truthy 8 | push: 9 | branches: [master, main] 10 | paths: 11 | - ".github/workflows/**.yml" 12 | - ".github/workflows/**.yaml" 13 | pull_request: 14 | branches: [master, main] 15 | paths: 16 | - ".github/workflows/**.yml" 17 | - ".github/workflows/**.yaml" 18 | 19 | concurrency: 20 | group: ${{ github.workflow }}-${{ github.ref }} 21 | cancel-in-progress: true 22 | 23 | jobs: 24 | lintGitHubActionsWithActionLint: 25 | runs-on: ubuntu-latest 26 | timeout-minutes: 15 27 | 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@v4 31 | with: 32 | persist-credentials: false 33 | sparse-checkout: | 34 | .github/workflows 35 | sparse-checkout-cone-mode: false 36 | 37 | - name: Lint GitHub Actions 38 | uses: reviewdog/action-actionlint@v1 39 | 40 | - name: Check GitHub Actions with 'actionlint' 41 | # Ref: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions 42 | # shellcheck is too noisy and disabled 43 | run: | 44 | bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 45 | ./actionlint -color -shellcheck= 46 | shell: bash 47 | 48 | 49 | lintGitHubActionsForSecurity: 50 | runs-on: ubuntu-latest 51 | timeout-minutes: 15 52 | 53 | permissions: 54 | security-events: write 55 | contents: read 56 | actions: read 57 | 58 | steps: 59 | - name: Checkout repository 60 | uses: actions/checkout@v4 61 | with: 62 | persist-credentials: false 63 | sparse-checkout: | 64 | .github/workflows 65 | sparse-checkout-cone-mode: false 66 | 67 | - name: Setup Rust 68 | uses: actions-rust-lang/setup-rust-toolchain@v1 69 | 70 | - name: Install zizmor 71 | run: cargo install zizmor 72 | 73 | - name: Run zizmor on GitHub Actions 74 | run: zizmor .github/workflows/* 75 | -------------------------------------------------------------------------------- /.github/workflows/lint-markdown.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Run this locally with act - https://github.com/nektos/act 3 | # act -j lintMarkdown 4 | name: Lint Markdown 5 | 6 | on: # yamllint disable-line rule:truthy 7 | push: 8 | branches: [master] 9 | paths: 10 | - '**.md' 11 | - '.github/workflows/lint-markdown.yaml' 12 | pull_request: 13 | branches: [master] 14 | paths: 15 | - '**.md' 16 | - '.github/workflows/lint-markdown.yaml' 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | lintMarkdown: 24 | runs-on: ubuntu-latest 25 | timeout-minutes: 15 26 | 27 | steps: 28 | - name: Checkout code 29 | uses: actions/checkout@v4 30 | with: 31 | persist-credentials: false 32 | 33 | - name: Set up Ruby 34 | # See https://github.com/ruby/setup-ruby#versioning 35 | uses: ruby/setup-ruby@v1 36 | with: 37 | ruby-version: 3.0 38 | 39 | - name: Install dependencies 40 | run: gem install mdl 41 | 42 | - name: Run tests 43 | run: mdl -r ~MD013,~MD029,~MD033 README.md 44 | -------------------------------------------------------------------------------- /.github/workflows/lint-yaml.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Run this locally with act - https://github.com/nektos/act 3 | # act -j lintYaml 4 | name: Lint YAML 5 | 6 | on: # yamllint disable-line rule:truthy 7 | push: 8 | branches: [master] 9 | paths: 10 | - '**.yml' 11 | - '**.yaml' 12 | - '.github/workflows/**.yml' 13 | - '.github/workflows/**.yaml' 14 | pull_request: 15 | branches: [master] 16 | paths: 17 | - '**.yml' 18 | - '**.yaml' 19 | - '.github/workflows/**.yml' 20 | - '.github/workflows/**.yaml' 21 | 22 | concurrency: 23 | group: ${{ github.workflow }}-${{ github.ref }} 24 | cancel-in-progress: true 25 | 26 | jobs: 27 | lintYaml: 28 | runs-on: ubuntu-latest 29 | timeout-minutes: 15 30 | 31 | steps: 32 | - name: Checkout code 33 | uses: actions/checkout@v4 34 | with: 35 | persist-credentials: false 36 | 37 | - name: Check YAML files with linter 38 | uses: ibiqlik/action-yamllint@v3 39 | with: 40 | # All files under base dir 41 | file_or_dir: "." 42 | config_data: | 43 | extends: default 44 | yaml-files: 45 | - '*.yaml' 46 | - '*.yml' 47 | rules: 48 | document-start: 49 | level: warning 50 | line-length: 51 | level: warning 52 | new-line-at-end-of-file: 53 | level: warning 54 | trailing-spaces: 55 | level: warning 56 | -------------------------------------------------------------------------------- /.github/workflows/test_macos_1.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Test Setup dotfiles on Mac OS 3 | 4 | on: # yamllint disable-line rule:truthy 5 | push: 6 | branches: ["master", "main"] 7 | paths: 8 | - ".github/workflows/test_macos_1.yml" 9 | - "setup_dotfiles.sh" 10 | - "_*" 11 | - "gradle.properties" 12 | pull_request: 13 | branches: ["master", "main"] 14 | paths: 15 | - ".github/workflows/test_macos_1.yml" 16 | - "setup_dotfiles.sh" 17 | - "_*" 18 | - "gradle.properties" 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | test_macos: 26 | 27 | runs-on: macos-latest 28 | timeout-minutes: 15 29 | 30 | steps: 31 | - name: Checkout code 32 | uses: actions/checkout@v4 33 | with: 34 | persist-credentials: false 35 | 36 | - name: Install coreutils 37 | run: | 38 | set -eo pipefail 39 | export CI=1 40 | brew install coreutils # For tac 41 | - name: Run setup dotfiles 42 | run: | 43 | set -eo pipefail 44 | export CI=1 45 | bash setup_dotfiles.sh # Test dotfile setup 46 | -------------------------------------------------------------------------------- /.github/workflows/test_macos_2.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Test setup Mac machine with packages 3 | 4 | on: # yamllint disable-line rule:truthy 5 | pull_request: 6 | branches: ["main", "master"] 7 | paths: 8 | - ".github/workflows/test_macos_2.yml" 9 | - "setup/setup_new_mac_machine.sh" 10 | push: 11 | branches: ["main", "master"] 12 | paths: 13 | - ".github/workflows/test_macos_2.yml" 14 | - "setup/setup_new_mac_machine.sh" 15 | 16 | concurrency: 17 | group: ${{ github.workflow }}-${{ github.ref }} 18 | cancel-in-progress: true 19 | 20 | jobs: 21 | testMacSetup: 22 | 23 | runs-on: macos-latest 24 | timeout-minutes: 60 25 | 26 | steps: 27 | - name: Checkout code 28 | uses: actions/checkout@v4 29 | with: 30 | persist-credentials: false 31 | 32 | - name: Run Setup new Mac machine script 33 | run: | 34 | set -eo pipefail 35 | export CI=1 36 | # Test Mac OS package installation 37 | bash setup/setup_new_mac_machine.sh 38 | -------------------------------------------------------------------------------- /.github/workflows/test_macos_3.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Test Setup Mac OS-specific config 3 | 4 | on: # yamllint disable-line rule:truthy 5 | push: 6 | branches: ["main", "master"] 7 | paths: 8 | - ".github/workflows/test_macos_3.yml" 9 | - "setup/_macos" 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | macOsConfig: 17 | 18 | runs-on: macos-latest 19 | timeout-minutes: 15 20 | 21 | steps: 22 | - name: Checkout code 23 | uses: actions/checkout@v4 24 | with: 25 | persist-credentials: false 26 | 27 | - name: Run _macos script 28 | run: | 29 | set -eo pipefail 30 | export CI=1 31 | sudo bash setup/_macos 32 | -------------------------------------------------------------------------------- /.github/workflows/test_macos_4.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Test Setup Vim on Mac OS 3 | 4 | on: # yamllint disable-line rule:truthy 5 | pull_request: 6 | branches: ["main", "master"] 7 | paths: 8 | - ".github/workflows/test_macos_4.yml" 9 | - "setup_dotfiles.sh" 10 | - "_vimrc" 11 | push: 12 | branches: ["main", "master"] 13 | paths: 14 | - ".github/workflows/test_macos_4.yml" 15 | - "setup_dotfiles.sh" 16 | - "_vimrc" 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | test_mac_vim: 24 | 25 | runs-on: macos-latest 26 | timeout-minutes: 15 27 | 28 | steps: 29 | - name: Checkout code 30 | uses: actions/checkout@v4 31 | with: 32 | persist-credentials: false 33 | 34 | - name: Install new vim 35 | run: | 36 | set -eo pipefail 37 | export CI=1 38 | vim --version 39 | # The real effect of this installation happens only when a new 40 | # shell is opened in the next step 41 | brew install coreutils 42 | brew install vim # To install new Vim 43 | vim --version 44 | - name: Run setup dotfiles 45 | run: | 46 | git submodule update --init 47 | bash setup_dotfiles.sh # to setup .vimrc file 48 | - name: Install vim plugins 49 | run: | 50 | vim --version 51 | # Install all vim bundles 52 | vim +PluginInstall +qall 53 | -------------------------------------------------------------------------------- /.github/workflows/test_ubuntu.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Test complete dotfile setup on Ubuntu 3 | 4 | on: # yamllint disable-line rule:truthy 5 | pull_request: 6 | branches: ["main", "master"] 7 | paths: 8 | - ".github/workflows/test_ubuntu.yml" 9 | - "setup_dotfiles.sh" 10 | - "_vimrc" 11 | - "setup/setup_new_ubuntu_machine.sh" 12 | push: 13 | branches: ["main", "master"] 14 | paths: 15 | - ".github/workflows/test_ubuntu.yml" 16 | - "setup_dotfiles.sh" 17 | - "_vimrc" 18 | - "setup/setup_new_ubuntu_machine.sh" 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | testAllOnUbuntu: 26 | 27 | runs-on: ubuntu-latest 28 | timeout-minutes: 15 29 | 30 | steps: 31 | - uses: actions/checkout@v4 32 | with: 33 | persist-credentials: false 34 | 35 | - name: Run setup_dotfiles.sh 36 | run: | 37 | set -e 38 | export CI=1 39 | git submodule update --init 40 | bash setup_dotfiles.sh 41 | - name: Run setup_new_ubuntu_machine.sh 42 | run: | 43 | set -e 44 | export CI=1 45 | bash setup/setup_new_ubuntu_machine.sh # Test Ubuntu-specific setup 46 | - name: Run setup vim 47 | run: | 48 | set -e 49 | export CI=1 50 | vim +PluginInstall +qall # Install all vim bundles 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _vim/.netrwhist 2 | _vim/bundle/SearchComplete/ 3 | _vim/bundle/YankRing.vim/ 4 | _vim/bundle/groovy.vim/ 5 | _vim/bundle/indentLine/ 6 | _vim/bundle/javacomplete/ 7 | _vim/bundle/jedi-vim/ 8 | _vim/bundle/jshint.vim/ 9 | _vim/bundle/rainbow_parentheses.vim/ 10 | _vim/bundle/syntastic/ 11 | _vim/bundle/tagbar/ 12 | _vim/bundle/tlib_vim/ 13 | _vim/bundle/vim-addon-mw-utils/ 14 | _vim/bundle/vim-airline/ 15 | _vim/bundle/vim-colors-solarized/ 16 | _vim/bundle/vim-css-color/ 17 | _vim/bundle/vim-easymotion/ 18 | _vim/bundle/vim-fugitive/ 19 | _vim/bundle/vim-gitgutter/ 20 | _vim/bundle/vim-indent-guides/ 21 | _vim/bundle/vim-java-unused-imports/ 22 | _vim/bundle/vim-javascript/ 23 | _vim/bundle/vim-json/ 24 | _vim/bundle/vim-markdown/ 25 | _vim/bundle/vim-protobuf/ 26 | _vim/bundle/vim-snipmate/ 27 | _vim/bundle/vim-snippets/ 28 | _vim/bundle/logcat/ 29 | _vim/bundle/vim-git/ 30 | _vim/bundle/kotlin-vim/ 31 | _vim/bundle/vim-airline-themes/ 32 | _vim/bundle/vim-graphql/ 33 | _vim/bundle/vim-solidity/ 34 | _vim/bundle/typescript-vim/ 35 | _vim/bundle/python-syntax/ 36 | _vim/doc 37 | _vim/ftdetect 38 | _vim/ftplugin 39 | _vim/nerdtree_plugin 40 | _vim/plugin 41 | _vim/syntax 42 | bashrc_includes/local_aliases.bash 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vundle"] 2 | path = _vim/bundle/vundle 3 | url = https://github.com/gmarik/vundle.git 4 | [submodule "jedi"] 5 | path = _vim/bundle/jedi-vim/jedi 6 | url = https://github.com/davidhalter/jedi.git 7 | [submodule "vim-fugitive"] 8 | path = _vim/bundle/vim-fugitive 9 | url = http://github.com/tpope/vim-fugitive.git 10 | [submodule "syntastic"] 11 | path = _vim/bundle/syntastic 12 | url = https://github.com/scrooloose/syntastic.git 13 | [submodule "_vim/bundle/vim-snipmate"] 14 | path = _vim/bundle/vim-snipmate 15 | url = https://github.com/msanders/snipmate.vim.git 16 | [submodule "vim-addon-mw-utils"] 17 | path = _vim/bundle/vim-addon-mw-utils 18 | url = https://github.com/MarcWeber/vim-addon-mw-utils.git 19 | [submodule "tlib_vim"] 20 | path = _vim/bundle/tlib_vim 21 | url = https://github.com/tomtom/tlib_vim.git 22 | [submodule "vim-snippets"] 23 | path = _vim/bundle/vim-snippets 24 | url = https://github.com/honza/vim-snippets.git 25 | [submodule "bashrc_includes/z"] 26 | path = bashrc_includes/z 27 | url = https://github.com/rupa/z 28 | [submodule "bashrc_includes/maven-bash-completion"] 29 | path = bashrc_includes/maven-bash-completion 30 | url = https://github.com/juven/maven-bash-completion 31 | [submodule "bashrc_includes/yarn-completion"] 32 | path = bashrc_includes/yarn-completion 33 | url = https://github.com/dsifford/yarn-completion 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles [![](https://img.shields.io/badge/Quality-A%2B-brightgreen.svg)](https://img.shields.io/badge/Quality-A%2B-brightgreen.svg) 2 | 3 | [![Lint Markdown](https://github.com/ashishb/dotfiles/actions/workflows/lint-markdown.yaml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/lint-markdown.yaml) 4 | [![Lint YAML](https://github.com/ashishb/dotfiles/actions/workflows/lint-yaml.yaml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/lint-yaml.yaml) 5 | [![Lint GitHub Actions](https://github.com/ashishb/dotfiles/actions/workflows/lint-github-actions.yaml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/lint-github-actions.yaml) 6 | 7 | [![Test Setup Mac OS](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_3.yml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_3.yml) 8 | [![Test setup Mac machine](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_2.yml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_2.yml) 9 | [![Test Setup dotfiles on Mac OS](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_1.yml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_1.yml) 10 | [![Test Setup Vim on Mac OS](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_4.yml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/test_macos_4.yml) 11 | [![Test Ubuntu](https://github.com/ashishb/dotfiles/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/ashishb/dotfiles/actions/workflows/test_ubuntu.yml) 12 | 13 | 1. `setup_dotfiles.sh` - Automate the dotfiles setup with this one (Warning: the 14 | script does not always work) 15 | 16 | 2. `setup/setup_cryptocurrencies.sh` - Cryptocurrencies development related packages ([ethereum](https://www.ethereum.org/), [solidity](https://solidity.readthedocs.io/en/v0.5.11/), [truffle](https://www.trufflesuite.com/) etc.) 17 | 18 | 2. `_bashrc` - bashrc file (it primarily sources files in bashrc includes) 19 | 20 | 3. `_gitconfig` - git config file 21 | 22 | 4. `_macos` - macOS config file (one time setup file based on Mathias's file) 23 | 24 | 5. `_screenrc` - several productivity improvements to GNU screen 25 | 26 | 6. `scripts` - some random scripts 27 | 28 | 8. `_vimrc` - vim config file 29 | 30 | 9. `_vim` - vim config dir, it contains several vim related stuff 31 | 32 | 10. `setup` - contains one time setup scripts for Mac, GNU/Linux and Nexus 5. 33 | 34 | 11. `bashrc_includes` - contains several bash improvements (git friendly prompt, adb auto completion, p4 auto completion, git auto completion, android reverse engineering aliases etc.) 35 | 36 | ## Usage 37 | 38 | ### For setting up Mac OS 39 | 40 | ```bash 41 | git clone https://github.com/ashishb/dotfiles && \ 42 | cd dotfiles && \ 43 | git submodule update --init && \ 44 | bash setup_dotfiles.sh && \ 45 | bash setup/setup_new_mac_machine.sh && \ 46 | bash setup/_macos && \ 47 | vim +BundleInstall +qall 48 | ``` 49 | 50 | ### For setting up GNU/Linux 51 | 52 | ```bash 53 | git clone https://github.com/ashishb/dotfiles && \ 54 | cd dotfiles && \ 55 | git submodule update --init && \ 56 | bash setup_dotfiles.sh && \ 57 | bash setup/setup_new_ubuntu_machine.sh && \ 58 | vim +BundleInstall +qall 59 | ``` 60 | 61 | Note: My GNU/Linux setup scripts are stale since I have not used GNU/Linux in a while. 62 | -------------------------------------------------------------------------------- /_bashrc: -------------------------------------------------------------------------------- 1 | # vi: ft=sh 2 | #### Bash customization. #### 3 | export EDITOR="vim" 4 | export PS1="\w $ " 5 | export CLICOLOR=yes # Enable color ls output 6 | export TERM=xterm-color # Flag terminal as color-capable 7 | export GREP_OPTIONS='--color=auto' 8 | # Ref: http://excid3.com/blog/how-to-fix-esc-in-your-terminal/#.UkHeamSZ3d6 9 | export LESS="-eirMX" 10 | # Enable X11 tunneling through ssh 11 | if [ -z $DISPLAY ]; then export DISPLAY=":0.0"; fi 12 | export P4DIFF=vimdiff p4 diff # Use vimdiff for P4 diff. 13 | 14 | #### Add some paths to $PATH. #### 15 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 16 | BASHRC_INCLUDES=$DIR/bashrc_includes 17 | export PATH=$PATH:$DIR/scripts 18 | 19 | # Bring homebrew, Ruby, and Rust binary packages into path 20 | export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" 21 | export PATH="/opt/homebrew/bin:$PATH" 22 | export PATH="/opt/homebrew/opt/ruby/bin:$PATH" 23 | export PATH="$PATH:/Users/ashishb/.cargo/bin" 24 | export PATH="$PATH:$HOME/go/bin/" 25 | export PATH="$PATH:/Applications/PyCharm CE.app/Contents/MacOS" 26 | export PATH="$PATH:/Applications/GoLand.app/Contents/MacOS" 27 | export PATH="$PATH:$HOME/.local/bin" 28 | alias charm=pycharm 29 | alias rbm=rubymine 30 | alias gl=goland 31 | 32 | # A function to change title (works in iTerm). 33 | function title { 34 | echo -ne "\033]0;"$*"\007" 35 | } 36 | 37 | #### Source more scripts. #### 38 | # Bash history customizations. 39 | source $BASHRC_INCLUDES/bash_history_customization.bash 40 | 41 | # For homebrew on Mac. 42 | if [[ `uname -s` == "Darwin" ]]; then 43 | if [ -f $(brew --prefix)/etc/bash_completion ]; then 44 | . $(brew --prefix)/etc/bash_completion 45 | fi 46 | fi 47 | 48 | # Makefile auto-completion 49 | complete -W "\`grep -oE '^[a-zA-Z0-9_.-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_.-]*$//'\`" make 50 | 51 | # Go sub-modules should always be enabled now 52 | export GO111MODULE=on 53 | # Disable homrew analytics (https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md) 54 | export HOMEBREW_NO_ANALYTICS=1 55 | # Disable Gatekeeper's quarantine - https://github.com/Homebrew/homebrew-cask/issues/52128#issuecomment-422436221 56 | export HOMEBREW_CASK_OPTS=--no-quarantine 57 | 58 | alias start_web_server='echo Starting webserver at http://$(ipconfig getifaddr en0):8000 && python -m SimpleHTTPServer 8000' 59 | alias docker_image_size_mac='Docker image size:" "$(du -shc ~/Library/Containers/com.docker.docker/ | tail -n 1 | cut -f1)' 60 | alias docker_cache_size='du -shc /Users/ashishb/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw' 61 | 62 | # Other MacOS directories to look at when disk is full 63 | # ~/Library/Caches 64 | # ~/Library/Caches/JetBrains/ - this contains lots of stray IntelliJ installations 65 | # ~/Library/Logs 66 | 67 | # export JAVA_HOME=$(/usr/libexec/java_home -v1.8) 68 | # export JAVA_HOME=$(/usr/libexec/java_home -v12) 69 | 70 | # Hide Java icon (https://bia.is/android-dev-tip-hide-that-annoying-java-icon/) 71 | export JAVA_TOOL_OPTIONS="-Dapple.awt.UIElement=true" 72 | 73 | # Due to some issue, this produces "nospace: unbound variable" under `set -o nounset`. 74 | # Therefore, I have to put it outside that. 75 | if [ -f /usr/local/share/bash-completion/bash_completion ]; then 76 | . /usr/local/share/bash-completion/bash_completion 77 | fi 78 | # Ref: http://robertmuth.blogspot.com/2012/08/better-bash-scripting-in-15-minutes.html 79 | set -o nounset 80 | 81 | # Better auto complete. 82 | source $BASHRC_INCLUDES/better_autocomplete.bash 83 | # adb auto-completion. 84 | source $BASHRC_INCLUDES/adb.bash 85 | # git auto-completion. 86 | source $BASHRC_INCLUDES/git-completion.bash 87 | # Yarn auto-completion 88 | source $BASHRC_INCLUDES/yarn-completion/yarn-completion.bash 89 | # Custom aliases to improve productivity. 90 | source $BASHRC_INCLUDES/custom_aliases.bash 91 | # Source local aliases. 92 | touch $BASHRC_INCLUDES/local_aliases.bash && source $BASHRC_INCLUDES/local_aliases.bash 93 | set +o nounset 94 | # Keep these two files out of nounset (I will fix them some day). 95 | # An interesting bash prompt. 96 | #source $BASHRC_INCLUDES/50_prompt.bash 97 | eval "$(starship init bash)" 98 | # Source 'z' - easy jumping around without providing full path names. 99 | source $BASHRC_INCLUDES/z/z.sh 100 | 101 | # Obsolete ones 102 | # # p4 auto-completion 103 | # source $BASHRC_INCLUDES/p4_autocomplete.bash 104 | # # Maven (mvn) auto-completion. 105 | # source $BASHRC_INCLUDES/maven-bash-completion/bash_completion.bash 106 | # # gradle auto-completion 107 | # source $BASHRC_INCLUDES/gradle_autocomplete.bash 108 | # # Custom aliases for android reverse engineering. 109 | # source $BASHRC_INCLUDES/android_reverse_engineering_related_aliases.bash 110 | -------------------------------------------------------------------------------- /_gitconfig: -------------------------------------------------------------------------------- 1 | # vi: ft=gitconfig 2 | # Include this in your ~/.gitconfig via 3 | # [include] 4 | # path = 5 | [branch] 6 | autosetuprebase = always 7 | [column] 8 | ui = auto 9 | [commit] 10 | gpgsign = true 11 | verbose = true 12 | [core] 13 | editor = vim 14 | pager = delta 15 | # Treat spaces before tabs, lines that are indented with 8 or more spaces, and all kinds of trailing whitespace as an error 16 | whitespace = space-before-tab,indent-with-non-tab,trailing-space 17 | [interactive] 18 | diffFilter = delta --color-only 19 | [delta] 20 | navigate = true # use n and N to move between diff sections 21 | light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal) 22 | # features = collared-trogon 23 | syntax-theme = Solarized (dark) 24 | line-numbers = true 25 | decorations = true 26 | # side-by-side = true 27 | 28 | [user] 29 | name = Ashish Bhatia 30 | email = ashishb@ashishb.net 31 | [diff] 32 | algorithm = histogram 33 | mnemonicprefix = true 34 | tool = diffmerge 35 | noprefix = true 36 | colorMoved = default 37 | [difftool "diffmerge"] 38 | cmd = /usr/local/bin/diffmerge \"$LOCAL\" \"$REMOTE\" 39 | [difftool] 40 | prompt = false 41 | [init] 42 | defaultBranch = master 43 | # Produces interactive prompt that I don't like 44 | #[help] 45 | # autocorrect = prompt 46 | [merge] 47 | # Include summaries of merged commits in newly created merge commit messages 48 | log = true 49 | tool = p4mergetool 50 | conflictstyle = diff3 51 | [mergetool "p4mergetool"] 52 | cmd = /opt/homebrew-cask/Caskroom/p4merge/2014.1/p4merge.app/Contents/Resources/launchp4merge $PWD/$BASE $PWD/$REMOTE $PWD/$LOCAL $PWD/$MERGED 53 | trustExitCode = false 54 | [mergetool] 55 | keepBackup = false 56 | [grep] 57 | extendRegexp = true 58 | lineNumber = true 59 | [push] 60 | default = simple 61 | autoSetupRemote = true 62 | followtags = true 63 | [pull] 64 | conflictstyle = diff3 65 | rebase = true 66 | [alias] 67 | st = status 68 | ci = commit 69 | cip = !git commit --amend && git push -f 70 | br = branch 71 | co = checkout 72 | # Checks out the default branch - master or main 73 | com = !git checkout $(git remote show origin | sed -n '/HEAD branch/s/.*: //p') 74 | df = diff --color-words --word-diff-regex=. 75 | lg = log -p 76 | hist = log -20 --pretty=format:"%C(yellow)%h%Creset\\%C(green)%ar%C(cyan)%d\\ %Creset%s%C(yellow)\\ [%cn]" --graph --decorate --all 77 | # Pull the default branch - master or main 78 | pom = !git pull origin $(git remote show origin | sed -n '/HEAD branch/s/.*: //p') 79 | spp = !git stash && git pom && git stash pop 80 | recentbranches = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' 81 | [color] 82 | ui = auto 83 | branch = auto 84 | diff = auto 85 | status = auto 86 | [color "branch"] 87 | current = yellow black 88 | local = yellow 89 | remote = magenta 90 | [color "diff"] 91 | meta = yellow bold 92 | frag = magenta bold 93 | old = red reverse 94 | new = green reverse 95 | whitespace = white reverse 96 | [color "status"] 97 | added = yellow 98 | changed = green 99 | untracked = cyan reverse 100 | branch = magenta 101 | [transfer] 102 | fsckobjects = true 103 | [fetch] 104 | fsckobjects = true 105 | prune = true 106 | prunetags = true 107 | [receive] 108 | fsckObjects = true 109 | [url "git@github.com:"] 110 | insteadOf = https://github.com/ 111 | -------------------------------------------------------------------------------- /_gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/f8ac87bd8f39ff8dd148f571f338d8e558410695/Global/vim.gitignore 2 | 3 | [._]*.s[a-w][a-z] 4 | [._]s[a-w][a-z] 5 | *.un~ 6 | Session.vim 7 | .netrwhist 8 | *~ 9 | 10 | 11 | -------------------------------------------------------------------------------- /_hgrc: -------------------------------------------------------------------------------- 1 | [alias] 2 | bm = bookmarks 3 | st = status 4 | ci = commit 5 | co = checkout 6 | lg = log -p 7 | -------------------------------------------------------------------------------- /_inputrc: -------------------------------------------------------------------------------- 1 | # Enable case-insensitive tab completion 2 | set completion-ignore-case On 3 | 4 | # Show all possible completions immediately if ambiguous 5 | set show-all-if-ambiguous On 6 | 7 | # Display file types with colors (like `ls --color`) 8 | set colored-stats On 9 | 10 | # Set the length of the common prefix displayed during completion 11 | set completion-prefix-display-length 3 12 | 13 | # Disable the terminal bell sound 14 | set bell-style none 15 | 16 | "\e[A": history-search-backward 17 | "\e[B": history-search-forward 18 | "\e[1;5D": backward-word 19 | "\e[1;5C": forward-word 20 | -------------------------------------------------------------------------------- /_screenrc: -------------------------------------------------------------------------------- 1 | # C-a :source .screenrc 2 | 3 | termcapinfo xterm* ti@:te@ 4 | startup_message off 5 | vbell off 6 | autodetach on 7 | altscreen on 8 | shelltitle "$ |bash" 9 | defscrollback 10000 10 | defutf8 on 11 | nonblock on 12 | 13 | hardstatus alwayslastline 14 | hardstatus string '%{= kw}[ %{= kb}%H%{= kw} ][%= %{= kw}%?%-Lw%?%{= kW}%n*%f %t%?%?%{= kw}%?%+Lw%?%?%= ][ %{r}%l%{w} ]%{w}[%{r} %d/%m/%y %C %A %{w}]%{w}' 15 | 16 | # C-a :q will quit. 17 | bind 'q' quit 18 | 19 | # syntax: screen -t label order command 20 | screen -t screen0 0 21 | -------------------------------------------------------------------------------- /_sshconfig: -------------------------------------------------------------------------------- 1 | Host * 2 | StrictHostKeyChecking no 3 | ServerAliveInterval 240 4 | 5 | -------------------------------------------------------------------------------- /_vimrc: -------------------------------------------------------------------------------- 1 | set tabstop=2 2 | " Sets the text width in the file to 80 characters. 3 | " Leads to automatic line breaks after 80 characters. 4 | " set textwidth=80 5 | set shiftwidth=2 6 | "This is for python code. 7 | set foldmethod=indent 8 | set foldlevel=20 9 | set expandtab 10 | set hlsearch 11 | set incsearch 12 | " Show line numbers. 13 | set number 14 | " Enable mouse. 15 | set mouse=a 16 | " Use system clipboard. 17 | set clipboard=unnamed 18 | " show context above/below cursorline. 19 | set scrolloff=3 20 | syntax on 21 | " The new regex engine crashes with syntax on, force old engine for now. 22 | " https://www.reddit.com/r/vim/comments/22cxmp/vim_74_crashes_when_syntax_is_turned_on/cglpo5u 23 | set regexpengine=1 24 | " watch for file changes 25 | set autoread 26 | filetype indent plugin on 27 | " Show redline beyond 80 characters 28 | " match ErrorMsg '\%>80v.\+' 29 | "Show matching parentheses 30 | set showmatch 31 | " Use F2 to toggle paste mode. 32 | set pastetoggle= 33 | " Enable per-directory .vimrc files and disable unsafe commands in them. 34 | set exrc 35 | " Commented since this does not seem to work due to plugins. 36 | " set secure 37 | " NERD Tree mapped to F3. 38 | nmap :NERDTreeToggle 39 | let NERDChristmasTree=1 40 | let NERDTreeHighlightCursorline=1 41 | let NERDTreeShowBookmarks=1 42 | let NERDTreeShowHidden=1 43 | let NERDTreeQuitOnOpen=1 44 | " Map \\ to hide highlight. 45 | map :noh 46 | " Auto complete functions. 47 | set cf 48 | " Aut complete vim commands. 49 | set wildmenu 50 | set wildmode=list:longest,full 51 | " Turn off annoying bell. 52 | set visualbell 53 | " https://stackoverflow.com/questions/3534028/mac-terminal-vim-will-only-use-backspace-when-at-the-end-of-a-line 54 | set backspace=indent,eol,start 55 | " Disable modelines as a security caution 56 | " https://security.stackexchange.com/questions/36001/vim-modeline-vulnerabilities 57 | set modelines=0 58 | set nomodeline 59 | 60 | " For GNU/Linux 61 | set rtp+=/usr/local/lib/python2.7/dist-packages/Powerline-beta-py2.7.egg/powerline/bindings/vim/ 62 | " For Mac 63 | set rtp+=/Library/Python/2.7/site-packages/powerline/bindings/vim 64 | " Always show statusline 65 | set laststatus=2 66 | " Use 256 colours (Use this setting only if your terminal supports 256 67 | " colours) 68 | set t_Co=256 69 | cnoremap sudow w !sudo tee % >/dev/null 70 | set rtp+=~/.vim/bundle/vundle/ 71 | call vundle#rc() 72 | " Use airline (powerline installation is weird and rarely works). 73 | Plugin 'vim-airline/vim-airline' 74 | Plugin 'vim-airline/vim-airline-themes' 75 | " Python auto-completion plugin. 76 | Bundle 'davidhalter/jedi-vim' 77 | let g:jedi#popup_on_dot = 0 78 | let g:jedi#use_splits_not_buffers = "bottom" 79 | " Git wrapper for vim. 80 | Bundle 'tpope/vim-fugitive' 81 | " Syntax checking. 82 | " Bundle 'scrooloose/syntastic' 83 | " let g:syntastic_java_javac_classpath = '/usr/local/Cellar/android-sdk/22.6.2/platforms/android-19/android.jar' 84 | " For snippets. 85 | " vim-addon-mw-utils and tlib_vim are needed by snipmate. 86 | " Bundle "MarcWeber/vim-addon-mw-utils" 87 | " Bundle "tomtom/tlib_vim" 88 | " Bundle "garbas/vim-snipmate" 89 | " An awesome collection of snippets. 90 | Bundle "honza/vim-snippets" 91 | 92 | " Enable rainbow-colored parentheses. 93 | Bundle "kien/rainbow_parentheses.vim" 94 | " This seems to be failing with 95 | " `Not an editor command: RainbowParenthesesToggle` 96 | " au VimEnter * RainbowParenthesesToggle 97 | " au Syntax * RainbowParenthesesLoadRound 98 | " au Syntax * RainbowParenthesesLoadSquare 99 | " au Syntax * RainbowParenthesesLoadBraces 100 | 101 | " Disable SearchComplete - it is buggy and interferes with ability to arrow 102 | " up/down the search histroy. 103 | " Enable tab based auto-completion in search command. 104 | " Bundle "SearchComplete" 105 | " Shows the yanks with YRshow command. 106 | Bundle "YankRing.vim" 107 | " Allows arbitrary navigation using \\w-followed-by-highlighted-char. 108 | Bundle "Lokaltog/vim-easymotion" 109 | " Not used for now. 110 | " " Enable language checking with LanguageToolCheck command. 111 | " Bundle "LanguageTool" 112 | " let g:languagetool_jar=$HOME . "/.vim/LanguageTool-2.2/languagetool-standalone.jar" 113 | " Bundle for CSS coloring. 114 | Bundle "skammer/vim-css-color" 115 | " Displays CTags in side bar. 116 | Bundle "majutsushi/tagbar" 117 | nmap :TagbarToggle 118 | Bundle "altercation/vim-colors-solarized" 119 | " solarized looks good on Mac (not on Linux) 120 | let s:uname = system("echo -n \"$(uname)\"") 121 | if s:uname == "Darwin" 122 | "colorscheme solarized 123 | else 124 | colorscheme default 125 | endif 126 | set background=dark 127 | " Show indentation clearly. 128 | Bundle 'Yggdroot/indentLine' 129 | Bundle "eventualbuddha/vim-protobuf" 130 | " Bundle "rmanalan/jshint.vim" 131 | Bundle "pangloss/vim-javascript" 132 | " Bundle "nathanaelkane/vim-indent-guides" 133 | let g:indentLine_char = '|' 134 | let g:indent_guides_enable_on_vim_startup = 1 135 | let g:indent_guides_auto_colors = 0 136 | let g:indentLine_color_light = 1 137 | Bundle "airblade/vim-gitgutter" 138 | let g:gitgutter_max_signs=10000 139 | " Fix for gitgutter on solarized theme 140 | " https://github.com/airblade/vim-gitgutter/issues/164 141 | highlight clear SignColumn 142 | highlight GitGutterAdd ctermfg=darkgreen 143 | highlight GitGutterChange ctermfg=yellow 144 | highlight GitGutterDelete ctermfg=red 145 | highlight GitGutterChangeDelete ctermfg=yellow 146 | " Commented since none of this seems to work for now. 147 | " " For android development. 148 | " Robo is probably obsolete and broken. 149 | " Bundle "robo" 150 | " Bundle "bpowell/vim-android" 151 | " "Added by android-vim: 152 | " set tags+=/Users/ashishbhatia/.vim/tags 153 | " Bundle 'vim-scripts/javacomplete' 154 | " autocmd Filetype java setlocal omnifunc=javacomplete#Complete 155 | " let g:SuperTabDefaultCompletionType = 'context' 156 | " autocmd Filetype java setlocal omnifunc=javacomplete#CompleteParamsInfo 157 | " setlocal completefunc=javacomplete#CompleteParamsInfo 158 | Bundle "akhaku/vim-java-unused-imports" 159 | " JSON syntax coloring. 160 | " au BufNewFile,BufRead *.json set filetype=json 161 | " Smali syntax coloring 162 | au BufNewFile,BufRead *.smali set filetype=smali 163 | " Disable for now, since it makes the syntax convoluted by hiding various 164 | " elements like double-quotes 165 | " Bundle "elzr/vim-json" 166 | " Disable since it is slow 167 | " Bundle "tpope/vim-markdown" 168 | 169 | " Disable this since it is slow. 170 | " " Groovy syntax highlighting 171 | " Bundle "vim-scripts/groovy.vim" 172 | " " gradle syntax highlighting 173 | " au BufNewFile,BufRead *.gradle set filetype=groovy 174 | 175 | " aidl syntax highlighting 176 | au BufNewFile,BufRead *.aidl set filetype=java 177 | " Highlight trailing whitespace. 178 | highlight ExtraWhitespace ctermbg=red guibg=red 179 | " let g:vjde_completion_key='' 180 | " let g:vjde_install_path='/Users/ashishb/src/dotfiles/_vim/bundle/Vim-JDE/' 181 | " Bundle "Vim-JDE" 182 | " Bundle "Valloric/YouCompleteMe" 183 | Bundle "naseer/logcat" 184 | au BufNewFile,BufRead *.logcat set filetype=logcat 185 | Bundle "tpope/vim-git" 186 | au FileType gitcommit set spell 187 | Plugin 'jparise/vim-graphql' 188 | 189 | " Python 190 | Plugin 'vim-python/python-syntax' 191 | 192 | " Kotlin 193 | Plugin 'udalov/kotlin-vim' 194 | au BufNewFile,BufRead *.kt set filetype=kotlin 195 | au BufNewFile,BufRead *.kts set filetype=kotlin 196 | 197 | " JAD files are generated by JAD decompiler 198 | au BufNewFile,BufRead *.jad set filetype=java 199 | 200 | " Solidity 201 | Plugin 'tomlion/vim-solidity' 202 | au BufNewFile,BufRead *.sol set filetype=solidity 203 | " Typescript 204 | Plugin 'leafgarland/typescript-vim' 205 | au BufNewFile,BufRead *.ts set filetype=typescript 206 | au BufNewFile,BufRead *.tsx set filetype=typescript 207 | 208 | 209 | if &diff 210 | " Ignore whitespaces in vimdiff 211 | " diff mode 212 | set diffopt+=iwhite 213 | " Make it more readable - https://stackoverflow.com/a/17183382 214 | highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red 215 | highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red 216 | highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red 217 | highlight DiffText cterm=bold ctermfg=10 ctermbg=190 gui=none guifg=bg guibg=Red 218 | endif 219 | -------------------------------------------------------------------------------- /bashrc_includes/50_prompt.bash: -------------------------------------------------------------------------------- 1 | # My awesome bash prompt 2 | # 3 | # Copyright (c) 2012 "Cowboy" Ben Alman 4 | # Licensed under the MIT license. 5 | # http://benalman.com/about/license/ 6 | # 7 | # Example: 8 | # [master:!?][cowboy@CowBook:~/.dotfiles] 9 | # [11:14:45] $ 10 | # 11 | # Read more (and see a screenshot) in the "Prompt" section of 12 | # https://github.com/cowboy/dotfiles 13 | 14 | # ANSI CODES - SEPARATE MULTIPLE VALUES WITH ; 15 | # 16 | # 0 reset 4 underline 17 | # 1 bold 7 inverse 18 | # 19 | # FG BG COLOR FG BG COLOR 20 | # 30 40 black 34 44 blue 21 | # 31 41 red 35 45 magenta 22 | # 32 42 green 36 46 cyan 23 | # 33 43 yellow 37 47 white 24 | 25 | if [[ ! "${prompt_colors[@]}" ]]; then 26 | prompt_colors=( 27 | "36" # information color 28 | "37" # bracket color 29 | "31" # error color 30 | ) 31 | 32 | if [[ "$SSH_TTY" ]]; then 33 | # connected via ssh 34 | prompt_colors[0]="32" 35 | elif [[ "$USER" == "root" ]]; then 36 | # logged in as root 37 | prompt_colors[0]="35" 38 | fi 39 | fi 40 | 41 | # Inside a prompt function, run this alias to setup local $c0-$c9 color vars. 42 | alias prompt_getcolors='prompt_colors[9]=; local i; for i in ${!prompt_colors[@]}; do local c$i="\[\e[0;${prompt_colors[$i]}m\]"; done' 43 | 44 | # Exit code of previous command. 45 | function prompt_exitcode() { 46 | prompt_getcolors 47 | [[ $1 != 0 ]] && echo " $c2$1$c9" 48 | } 49 | 50 | # Git status. 51 | function prompt_git() { 52 | prompt_getcolors 53 | local status output flags 54 | status="$(git status 2>/dev/null)" 55 | [[ $? != 0 ]] && return; 56 | output="$(echo "$status" | awk '/# Initial commit/ {print "(init)"}')" 57 | [[ "$output" ]] || output="$(echo "$status" | awk '/# On branch/ {print $4}')" 58 | [[ "$output" ]] || output="$(git branch --format='%(refname:short)')" 59 | flags="$( 60 | echo "$status" | awk 'BEGIN {r=""} \ 61 | /^# Changes to be committed:$/ {r=r "+"}\ 62 | /^# Changes not staged for commit:$/ {r=r "!"}\ 63 | /^# Untracked files:$/ {r=r "?"}\ 64 | END {print r}' 65 | )" 66 | if [[ "$flags" ]]; then 67 | output="$output$c1:$c0$flags" 68 | fi 69 | echo "$c1[$c0$output$c1]$c9" 70 | } 71 | 72 | # SVN info. 73 | function prompt_svn() { 74 | prompt_getcolors 75 | local info="$(svn info . 2> /dev/null)" 76 | local last current 77 | if [[ "$info" ]]; then 78 | last="$(echo "$info" | awk '/Last Changed Rev:/ {print $4}')" 79 | current="$(echo "$info" | awk '/Revision:/ {print $2}')" 80 | echo "$c1[$c0$last$c1:$c0$current$c1]$c9" 81 | fi 82 | } 83 | 84 | # Maintain a per-execution call stack. 85 | prompt_stack=() 86 | trap 'prompt_stack=("${prompt_stack[@]}" "$BASH_COMMAND")' DEBUG 87 | 88 | function prompt_command() { 89 | local exit_code=$? 90 | # If the first command in the stack is prompt_command, no command was run. 91 | # Set exit_code to 0 and reset the stack. 92 | [[ "${prompt_stack[0]}" == "prompt_command" ]] && exit_code=0 93 | prompt_stack=() 94 | 95 | # Manually load z here, after $? is checked, to keep $? from being clobbered. 96 | [[ "$(type -t _z)" ]] && _z --add "$(pwd -P 2>/dev/null)" 2>/dev/null 97 | 98 | # While the simple_prompt environment var is set, disable the awesome prompt. 99 | [[ "$simple_prompt" ]] && PS1='\n$ ' && return 100 | 101 | prompt_getcolors 102 | # http://twitter.com/cowboy/status/150254030654939137 103 | PS1="" ##\n" 104 | # svn: [repo:lastchanged] 105 | # PS1="$PS1$(prompt_svn)" 106 | # git: [branch:flags] 107 | PS1="$PS1$(prompt_git)" 108 | # misc: [cmd#:hist#] 109 | # PS1="$PS1$c1[$c0#\#$c1:$c0!\!$c1]$c9" 110 | # path: [user@host:path] 111 | # PS1="$PS1$c1[$c0\u$c1@$c0\h$c1:$c0\w$c1]$c9" 112 | PS1="$PS1$c1[$c0\w$c1]$c9" 113 | PS1="$PS1" 114 | # date: [HH:MM:SS] 115 | PS1="$c1[$c0$(date +"%H$c1:$c0%M$c1:$c0%S")$c1]$PS1" 116 | # exit code: 127 117 | PS1="$PS1$(prompt_exitcode "$exit_code")" 118 | PS1="$PS1 \$ " 119 | } 120 | 121 | PROMPT_COMMAND="prompt_command" 122 | -------------------------------------------------------------------------------- /bashrc_includes/adb.bash: -------------------------------------------------------------------------------- 1 | # /* vim: set ai ts=4 ft=sh: */ 2 | # 3 | # Copyright 2011, The Android Open Source Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | _adb() { 19 | unset -v have 20 | type $1 &> /dev/null && have="yes" 21 | 22 | if [ "$have" != "yes" ]; then 23 | return 24 | fi 25 | 26 | local where i cur serial 27 | COMPREPLY=() 28 | 29 | serial="${ANDROID_SERIAL:-none}" 30 | where=OPTIONS 31 | for ((i=1; i <= COMP_CWORD; i++)); do 32 | cur="${COMP_WORDS[i]}" 33 | case "${cur}" in 34 | -s) 35 | where=OPT_SERIAL 36 | ;; 37 | -p) 38 | where=OPT_PATH 39 | ;; 40 | -*) 41 | where=OPTIONS 42 | ;; 43 | *) 44 | if [[ $where == OPT_SERIAL ]]; then 45 | where=OPT_SERIAL_ARG 46 | elif [[ $where == OPT_SERIAL_ARG ]]; then 47 | serial=${cur} 48 | where=OPTIONS 49 | else 50 | where=COMMAND 51 | break 52 | fi 53 | ;; 54 | esac 55 | done 56 | 57 | if [[ $where == COMMAND && $i -ge $COMP_CWORD ]]; then 58 | where=OPTIONS 59 | fi 60 | 61 | OPTIONS="-d -e -s -p" 62 | COMMAND="devices connect disconnect push pull sync shell emu logcat lolcat forward jdwp install uninstall bugreport help version start-server kill-server get-state get-serialno status-window remount reboot reboot-bootloader root usb tcpip" 63 | 64 | case $where in 65 | OPTIONS|OPT_SERIAL|OPT_PATH) 66 | COMPREPLY=( $(compgen -W "$OPTIONS $COMMAND" -- "$cur") ) 67 | ;; 68 | OPT_SERIAL_ARG) 69 | local devices=$(command adb devices '2>' /dev/null | grep -v "List of devices" | awk '{ print $1 }') 70 | COMPREPLY=( $(compgen -W "${devices}" -- ${cur}) ) 71 | ;; 72 | COMMAND) 73 | if [[ $i -eq $COMP_CWORD ]]; then 74 | COMPREPLY=( $(compgen -W "$COMMAND" -- "$cur") ) 75 | else 76 | i=$((i+1)) 77 | case "${cur}" in 78 | install) 79 | _adb_cmd_install "$serial" $i 80 | ;; 81 | pull) 82 | _adb_cmd_pull "$serial" $i 83 | ;; 84 | push) 85 | _adb_cmd_push "$serial" $i 86 | ;; 87 | reboot) 88 | if [[ $COMP_CWORD == $i ]]; then 89 | args="bootloader recovery" 90 | COMPREPLY=( $(compgen -W "${args}" -- "${COMP_WORDS[i]}") ) 91 | fi 92 | ;; 93 | shell) 94 | _adb_cmd_shell "$serial" $i 95 | ;; 96 | uninstall) 97 | _adb_cmd_uninstall "$serial" $i 98 | ;; 99 | esac 100 | fi 101 | ;; 102 | esac 103 | 104 | return 0 105 | } 106 | 107 | _adb_cmd_install() { 108 | local serial i cur where 109 | 110 | serial=$1 111 | i=$2 112 | 113 | where=OPTIONS 114 | for ((; i <= COMP_CWORD; i++)); do 115 | cur="${COMP_WORDS[i]}" 116 | case "${cur}" in 117 | -*) 118 | where=OPTIONS 119 | ;; 120 | *) 121 | where=FILE 122 | break 123 | ;; 124 | esac 125 | done 126 | 127 | cur="${COMP_WORDS[COMP_CWORD]}" 128 | if [[ $where == OPTIONS ]]; then 129 | COMPREPLY=( $(compgen -W "-l -r -s" -- "${cur}") ) 130 | return 131 | fi 132 | 133 | _adb_util_complete_local_file "${cur}" '!*.apk' 134 | } 135 | 136 | _adb_cmd_push() { 137 | local serial IFS=$'\n' i cur 138 | 139 | serial=$1 140 | i=$2 141 | 142 | cur="${COMP_WORDS[COMP_CWORD]}" 143 | 144 | if [[ $COMP_CWORD == $i ]]; then 145 | _adb_util_complete_local_file "${cur}" 146 | elif [[ $COMP_CWORD == $(($i+1)) ]]; then 147 | if [ "${cur}" == "" ]; then 148 | cur="/" 149 | fi 150 | _adb_util_list_files $serial "${cur}" 151 | fi 152 | } 153 | 154 | _adb_cmd_pull() { 155 | local serial IFS=$'\n' i cur 156 | 157 | serial=$1 158 | i=$2 159 | 160 | cur="${COMP_WORDS[COMP_CWORD]}" 161 | 162 | if [[ $COMP_CWORD == $i ]]; then 163 | if [ "${cur}" == "" ]; then 164 | cur="/" 165 | fi 166 | _adb_util_list_files $serial "${cur}" 167 | elif [[ $COMP_CWORD == $(($i+1)) ]]; then 168 | _adb_util_complete_local_file "${cur}" 169 | fi 170 | } 171 | 172 | _adb_cmd_shell() { 173 | local serial IFS=$'\n' i cur 174 | local -a args 175 | 176 | serial=$1 177 | i=$2 178 | 179 | cur="${COMP_WORDS[i]}" 180 | if [ "$serial" != "none" ]; then 181 | args=(-s $serial) 182 | fi 183 | 184 | if [[ $i -eq $COMP_CWORD && ${cur:0:1} != "/" ]]; then 185 | paths=$(command adb ${args[@]} shell echo '$'PATH 2> /dev/null | tr -d '\r' | tr : '\n') 186 | COMMAND=$(command adb ${args[@]} shell ls $paths '2>' /dev/null | tr -d '\r' | { 187 | while read -r tmp; do 188 | command=${tmp##*/} 189 | printf '%s\n' "$command" 190 | done 191 | }) 192 | COMPREPLY=( $(compgen -W "$COMMAND" -- "$cur") ) 193 | return 0 194 | fi 195 | 196 | i=$((i+1)) 197 | case "$cur" in 198 | ls) 199 | _adb_shell_ls $serial $i 200 | ;; 201 | /*) 202 | _adb_util_list_files $serial "$cur" 203 | ;; 204 | *) 205 | COMPREPLY=( ) 206 | ;; 207 | esac 208 | 209 | return 0 210 | } 211 | 212 | _adb_cmd_uninstall() { 213 | local serial i where cur packages 214 | 215 | serial=$1 216 | i=$2 217 | if [ "$serial" != "none" ]; then 218 | args=(-s $serial) 219 | fi 220 | 221 | where=OPTIONS 222 | for ((; i <= COMP_CWORD; i++)); do 223 | cur="${COMP_WORDS[i]}" 224 | case "${cur}" in 225 | -*) 226 | where=OPTIONS 227 | ;; 228 | *) 229 | where=FILE 230 | break 231 | ;; 232 | esac 233 | done 234 | 235 | cur="${COMP_WORDS[COMP_CWORD]}" 236 | if [[ $where == OPTIONS ]]; then 237 | COMPREPLY=( $(compgen -W "-k" -- "${cur}") ) 238 | fi 239 | 240 | packages="$( 241 | command adb ${args[@]} shell pm list packages '2>' /dev/null 2> /dev/null | tr -d '\r' | { 242 | while read -r tmp; do 243 | local package=${tmp#package:} 244 | echo -n "${package} " 245 | done 246 | } 247 | )" 248 | 249 | COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${packages}" -- "${cur}") ) 250 | } 251 | 252 | _adb_shell_ls() { 253 | local serial i cur file 254 | local -a args 255 | 256 | serial=$1 257 | i=$2 258 | if [ "$serial" != "none" ]; then 259 | args=(-s $serial) 260 | fi 261 | 262 | where=OPTIONS 263 | for ((; i <= COMP_CWORD; i++)); do 264 | cur="${COMP_WORDS[i]}" 265 | case "${cur}" in 266 | -*) 267 | where=OPTIONS 268 | ;; 269 | *) 270 | where=FILE 271 | break 272 | ;; 273 | esac 274 | done 275 | 276 | file="${COMP_WORDS[COMP_CWORD]}" 277 | if [[ ${file} == "" ]]; then 278 | file="/" 279 | fi 280 | 281 | case $where in 282 | OPTIONS) 283 | COMPREPLY=( $(compgen -W "$OPTIONS" -- "$cur") ) 284 | _adb_util_list_files $serial "$file" 285 | ;; 286 | FILE) 287 | _adb_util_list_files $serial "$file" 288 | ;; 289 | esac 290 | 291 | return 0 292 | } 293 | 294 | _adb_util_list_files() { 295 | local serial dir IFS=$'\n' 296 | local -a toks 297 | local -a args 298 | 299 | serial="$1" 300 | file="$2" 301 | 302 | if [ "$serial" != "none" ]; then 303 | args=(-s $serial) 304 | fi 305 | 306 | toks=( ${toks[@]-} $( 307 | command adb ${args[@]} shell ls -dF ${file}"*" '2>' /dev/null 2> /dev/null | tr -d '\r' | { 308 | while read -r tmp; do 309 | filetype=${tmp%% *} 310 | filename=${tmp:${#filetype}+1} 311 | if [[ ${filetype:${#filetype}-1:1} == d ]]; then 312 | printf '%s/\n' "$filename" 313 | else 314 | printf '%s\n' "$filename" 315 | fi 316 | done 317 | } 318 | )) 319 | 320 | # Since we're probably doing file completion here, don't add a space after. 321 | if [[ $(type -t compopt) = "builtin" ]]; then 322 | compopt -o nospace 323 | fi 324 | 325 | COMPREPLY=( ${COMPREPLY[@]:-} "${toks[@]}" ) 326 | } 327 | 328 | _adb_util_complete_local_file() 329 | { 330 | local file xspec i j 331 | local -a dirs files 332 | 333 | file=$1 334 | xspec=$2 335 | 336 | # Since we're probably doing file completion here, don't add a space after. 337 | if [[ $(type -t compopt) = "builtin" ]]; then 338 | compopt -o plusdirs 339 | if [[ "${xspec}" == "" ]]; then 340 | COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -f -- "${cur}") ) 341 | else 342 | compopt +o filenames 343 | COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -f -X "${xspec}" -- "${cur}") ) 344 | fi 345 | else 346 | # Work-around for shells with no compopt 347 | 348 | dirs=( $(compgen -d -- "${cur}" ) ) 349 | 350 | if [[ "${xspec}" == "" ]]; then 351 | files=( ${COMPREPLY[@]:-} $(compgen -f -- "${cur}") ) 352 | else 353 | files=( ${COMPREPLY[@]:-} $(compgen -f -X "${xspec}" -- "${cur}") ) 354 | fi 355 | 356 | COMPREPLY=( $( 357 | for i in "${files[@]}"; do 358 | local skip= 359 | for j in "${dirs[@]}"; do 360 | if [[ $i == $j ]]; then 361 | skip=1 362 | break 363 | fi 364 | done 365 | [[ -n $skip ]] || printf "%s\n" "$i" 366 | done 367 | )) 368 | 369 | COMPREPLY=( ${COMPREPLY[@]:-} $( 370 | for i in "${dirs[@]}"; do 371 | printf "%s/\n" "$i" 372 | done 373 | )) 374 | fi 375 | } 376 | 377 | 378 | if [[ $(type -t compopt) = "builtin" ]]; then 379 | complete -F _adb adb 380 | else 381 | complete -o nospace -F _adb adb 382 | fi 383 | -------------------------------------------------------------------------------- /bashrc_includes/android_reverse_engineering_related_aliases.bash: -------------------------------------------------------------------------------- 1 | # Android reverse-engineering related aliases. 2 | if [ "$(uname)" == "Darwin" ]; then 3 | alias jd-gui="open -a jd-gui" 4 | # These are for compiling native android code. 5 | # Based on brew installs of android-sdk and android-ndk. 6 | export ANDROID_SDK_HOME=`echo $(brew --cellar)/android-sdk` 7 | # Gradle needs this. 8 | export ANDROID_HOME=${ANDROID_SDK_HOME} 9 | export ANDROID_NDK_HOME=`echo $(brew --cellar)/android-ndk` 10 | export PATH=$PATH:$ANDROID_NDK_HOME 11 | # For gradle wrapper. 12 | export PATH=$PATH:$ANDROID_SDK_HOME/tools/templates/gradle/wrapper 13 | SYSROOT_ARM=${ANDROID_NDK_HOME}/platforms/android-14/arch-arm 14 | SYSROOT_X86=${ANDROID_NDK_HOME}/platforms/android-14/arch-x86 15 | ARM_GCC="${ANDROID_NDK_HOME}/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86/bin/arm-linux-androideabi-gcc" 16 | X86_GCC="${ANDROID_NDK_HOME}/toolchains/x86-4.8/prebuilt/darwin-x86/bin/i686-linux-android-gcc" 17 | alias ANDROID_CC="$ARM_GCC --sysroot=$SYSROOT_ARM " #-B /usr/local/google/android_src_code/system/core/include" 18 | alias ANDROID_CC_X86="$X86_GCC --sysroot=$SYSROOT_X86 " 19 | else 20 | export ANDROID_SDK_HOME=$HOME/android_sdk 21 | # On mac, these are installed via homebrew. 22 | # TODO(ashishb): On GNU/Linux, install it using some package manager as well. 23 | alias apktool="java -jar $HOME/tools/android/apktool.jar" 24 | alias dex2jar=$HOME/tools/android/dex2jar-0.0.9.15/d2j-dex2jar.sh 25 | alias jd-gui="$HOME/AndroidTools/jd-gui/jd-gui" 26 | fi 27 | 28 | export ANDROID_HVPROTO=ddm # For Hierarchy viewer 29 | alias burp="java -jar $HOME/Tools/burpsuite_free_v1.6.jar" 30 | alias printcert="keytool -printcert -file" 31 | alias signapk="jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore alias_name" 32 | alias android_screendump="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g'" 33 | alias android_get_id='adb shell content query --uri content://settings/secure --projection name:value | grep android_id' 34 | alias android_locale_change="adb shell am start -n 'com.android.settings/.Settings\$LocalePickerActivity'" 35 | alias android_dev_options="adb shell am start -n com.android.settings/.DevelopmentSettings" 36 | alias adbt="adb logcat -v time" 37 | alias aapt="/usr/local/Caskroom/android-sdk/4333796/build-tools/27.0.3/aapt" 38 | alias aapt2="/usr/local/Caskroom/android-sdk/4333796/build-tools/27.0.3/aapt2" 39 | alias apksigner="/usr/local/Caskroom/android-sdk/4333796/build-tools/27.0.3/apksigner" 40 | 41 | function update_android_id(){ 42 | # Update the android id. 43 | # TODO(ashishb): Add a different query for devices where sqlite3 is not present 44 | # but content binary is present. 45 | adb shell sqlite3 \ 46 | /data/data/com.android.providers.settings/databases/settings.db \ 47 | "update 'secure' set value=\"${1}\" where name='android_id'" 48 | # Now soft_reboot. 49 | adb shell setprop ctl.restart surfaceflinger 50 | adb shell setprop ctl.restart zygote 51 | } 52 | 53 | # TODO(ashishb): Add jadx tool to the list. 54 | # https://github.com/skylot/jadx 55 | 56 | # Source: https://gist.github.com/tyvsmith/6056422 57 | function dex-method-count() { 58 | cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"' 59 | } 60 | 61 | function dex-method-count-by-package() { 62 | dir=$(mktemp -d -t dex) 63 | baksmali $1 -o $dir 64 | for pkg in `find $dir/* -type d`; do 65 | smali $pkg -o $pkg/classes.dex 66 | count=$(dex-method-count $pkg/classes.dex) 67 | name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.') 68 | echo -e "$count\t$name" 69 | done 70 | rm -rf $dir 71 | } 72 | 73 | function dex-field-count(){ 74 | cat $1 | head -c 84 | tail -c 4 | hexdump -e '1/4 "%d\n"' 75 | } 76 | 77 | function dex-field-count-by-package() { 78 | dir=$(mktemp -d -t dex) 79 | baksmali $1 -o $dir 80 | for pkg in `find $dir/* -type d`; do 81 | smali $pkg -o $pkg/classes.dex 82 | count=$(dex-field-count $pkg/classes.dex) 83 | name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.') 84 | echo -e "$count\t$name" 85 | done 86 | rm -rf $dir 87 | } 88 | -------------------------------------------------------------------------------- /bashrc_includes/bash_history_customization.bash: -------------------------------------------------------------------------------- 1 | ## Bash History customizations. 2 | # Avoid duplicates. 3 | export HISTCONTROL=ignoredups:erasedups 4 | # Append (not ovewrite) history entries. 5 | shopt -s histappend 6 | # Larger bash history (default is 500) 7 | export HISTFILESIZE=10000 8 | export HISTSIZE=10000 9 | -------------------------------------------------------------------------------- /bashrc_includes/better_autocomplete.bash: -------------------------------------------------------------------------------- 1 | # Show auto-completion on first tab (default is second tab). 2 | bind 'set show-all-if-ambiguous on' 3 | # No empty command completion. 4 | shopt -s no_empty_cmd_completion 5 | # SSH auto-completion based on entries in known_hosts. 6 | if [[ -e ~/.ssh/known_hosts ]]; then 7 | # complete -o default -W "$(cat ~/.ssh/known_hosts | sed 's/[, ].*//' | sort | uniq | grep -v '[0-9]')" ssh scp sftp 8 | complete -o default -W \ 9 | "echo $(cat ~/.ssh/config | grep 'Host ' | sort | uniq | cut -d' ' -f2) \ 10 | $(cat ~/.ssh/known_hosts | cut -d ' ' -f1 | grep ',' | cut -d ',' -f1)" \ 11 | ssh scp sftp 12 | fi 13 | # When completing cd and rmdir, only dirs should be possible option (default is 14 | # all files on Mac). 15 | complete -d cd rmdir 16 | # Better completion for killall. 17 | _killall() 18 | { 19 | local cur prev 20 | COMPREPLY=() 21 | cur=${COMP_WORDS[COMP_CWORD]} 22 | 23 | # Get a list of processes 24 | #+ (the first sed evaluation 25 | #+ takes care of swapped out processes, the second 26 | #+ takes care of getting the basename of the process). 27 | COMPREPLY=( $( ps -u $USER -o comm | \ 28 | sed -e '1,1d' -e 's#[]\[]##g' -e 's#^.*/##'| \ 29 | awk '{if ($0 ~ /^'$cur'/) print $0}' )) 30 | 31 | return 0 32 | } 33 | complete -F _killall killall 34 | 35 | -------------------------------------------------------------------------------- /bashrc_includes/custom_aliases.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Several custom aliases to improve productivity. 3 | # force X11 tunneling through ssh 4 | alias ssh='ssh -Y' 5 | # Some more aliases. 6 | alias ..='cd ..' 7 | # Pretty printed python,html,css etc. code. 8 | alias cat=bat 9 | alias d="du -h -d=1" 10 | alias df="df -h" 11 | alias grep='GREP_COLOR="1;37;45" LANG=C grep --color=auto' 12 | alias httpdump="sudo tcpdump -i en0 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" 13 | alias publicip="curl -s http://checkip.dyndns.com/ | sed 's/[^0-9\.]//g'" 14 | alias localip="ipconfig getifaddr en0" 15 | # List all make targets. 16 | alias make_list="make -qp | sed -n -e 's/^\([^.#[:space:]][^:[:space:]]*\): .*/\1/p'" 17 | alias jq_non_empty="jq 'del(..|select(. == null))' | jq 'del(..|select(. == 0))' | jq 'del(..|select(. == \"\"))'" 18 | 19 | # Ref: https://serverfault.com/a/1123925/1053189 20 | alias delete_unused_cloud_run="gcloud run revisions list --filter=\"status.conditions.type:Active AND status.conditions.status:'False'\" --format='value(metadata.name)' | xargs -r -L1 gcloud run revisions delete --quiet" 21 | 22 | # Usage: kotin_run foo.kt to compile foo.kt into foo.kt.jar and run it with the optional 23 | ktr () { kotlinc "$1" -include-runtime -d "$1".jar && java -jar "$1".jar "${@:2}"; } 24 | 25 | # Usage: ghurl , will open the file on github.com. Respects branch name and repo name. 26 | # Filename can contain a fragment like "#L11" to highlight line 11 or "L22-L34" to hightlight from 27 | # line 22 to line 34. 28 | function ghurl() 29 | { 30 | domain='https://github.com' && 31 | # Get the repo name and remove ".git" from the end 32 | repo=$(git config --get remote.origin.url | cut -d: -f2 | rev | cut -d. -f2- | rev) && 33 | # Fallback to master branch 34 | remoteBranch=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo 'master') && 35 | # Remove origin prefix 36 | remoteBranch=${remoteBranch#origin/} && 37 | currentDir=$PWD && 38 | gitTopLevel=$(git rev-parse --show-toplevel) && 39 | # Remove git base directory from the path. 40 | pathRelativeToBaseRepo=${currentDir#${gitTopLevel}}/${1} && 41 | # echo Remote branch is ${remoteBranch} && 42 | # echo current Dir is ${currentDir} && 43 | # echo gitTopLevel is ${gitTopLevel} && 44 | # echo pathRelativeToBaseRepo is ${pathRelativeToBaseRepo} 45 | url=${domain}/${repo}/tree/${remoteBranch}/${pathRelativeToBaseRepo} && 46 | # echo url is ${url} && 47 | open "${url}" 48 | } 49 | 50 | function stargazer() 51 | { 52 | domain='https://starcharts.herokuapp.com/' && 53 | # Get the repo name and remove ".git" from the end 54 | repo=$(git config --get remote.origin.url | cut -d: -f2 | rev | cut -d. -f2- | rev) && 55 | url=${domain}/${repo} 56 | open "${url}" 57 | } 58 | 59 | # Usage: ghpr , will open the pull request on github.com. Respects repo name. 60 | # GitHub uses a single counter for pull requests and issues, so, even an issue can open via this mechanism. 61 | function ghpr() 62 | { 63 | domain='https://github.com' && 64 | # Get the repo name and remove ".git" from the end 65 | repo=$(git config --get remote.origin.url | cut -d: -f2 | rev | cut -d. -f2- | rev) && 66 | url=${domain}/${repo}/pull/${1} && 67 | # echo url is ${url} && 68 | open "${url}" 69 | } 70 | 71 | # Mac OS only 72 | function restart_bluetooth() 73 | { 74 | # Source: https://gist.github.com/nicolasembleton/afc19940da26716f8e90 75 | sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 76 | sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 77 | } 78 | 79 | 80 | alias myghpr="gh pr --me --link" 81 | alias myghissues="open https://github.com/issues/assigned" 82 | 83 | # Tree 84 | if [ ! -x "$(command -v tree 2>/dev/null)" ] 85 | then 86 | alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" 87 | fi 88 | # Mac style pbcopy and pbpaste on linux. 89 | command -v xsel 1>/dev/null && 90 | alias pbcopy='xsel --clipboard --input' && 91 | alias pbpaste='xsel --clipboard --output' 92 | 93 | # Mac-specific settings. 94 | if [[ $(uname -s) == "Darwin" ]]; then 95 | # Lock the screen (when going away from keyboard) 96 | alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" 97 | # Update everything. 98 | alias update='sudo softwareupdate -i -a; brew update; 99 | brew upgrade; brew cleanup; 100 | sudo npm update npm -g; sudo npm update -g; 101 | sudo gem update --system; sudo gem update' 102 | # Set the iTerm tab title to current dir. 103 | export PROMPT_COMMAND='echo -ne "\033]0;${PWD/#$HOME/~}\007"' 104 | fi 105 | 106 | # Resize and shrink photos before uploading them to my website 107 | function resize_for_website { 108 | full_filename="$1" 109 | filename=$(basename -- "$full_filename") 110 | extension="${filename##*.}" 111 | filename_no_extension="${filename%.*}" 112 | resized_file_name="${filename_no_extension}_resized.${extension}" 113 | magick "${full_filename}" -resize 1500x1500 "$resized_file_name" 114 | echo "Resized ${filename} to ${resized_file_name}" 115 | du -shc "${filename}" "${resized_file_name}" 116 | } 117 | export -f resize_for_website 118 | 119 | # https://stackoverflow.com/a/73108928 120 | function dockersize { 121 | docker manifest inspect -v "$1" | jq -c 'if type == "array" then .[] else . end | select(.Descriptor.platform.architecture != "unknown")' | jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ ( .OCIManifest // .SchemaV2Manifest ).layers[].size ] | add ) ] | join(" ")' | numfmt --to iec --format '%.2f' --field 2 | sort | column -t ; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /bashrc_includes/gradle_autocomplete.bash: -------------------------------------------------------------------------------- 1 | _gradle() 2 | { 3 | local cur=${COMP_WORDS[COMP_CWORD]} 4 | local gradle_cmd='gradle' 5 | if [[ -x ./gradlew ]]; then 6 | gradle_cmd='./gradlew' 7 | fi 8 | if [[ -x ../gradlew ]]; then 9 | gradle_cmd='../gradlew' 10 | fi 11 | 12 | local commands='' 13 | local cache_dir="$HOME/.gradle_tabcompletion" 14 | mkdir -p $cache_dir 15 | 16 | # TODO: include the gradle version in the checksum? It's kinda slow 17 | #local gradle_version=$($gradle_cmd --version --quiet --no-color | grep '^Gradle ' | sed 's/Gradle //g') 18 | 19 | local gradle_files_checksum=''; 20 | if [[ -f build.gradle ]]; then # top-level gradle file 21 | if [[ -x `which md5` ]]; then # mac 22 | local all_gradle_files=$(find . -name build.gradle 2>/dev/null) 23 | gradle_files_checksum=$(md5 -q -s "$(md5 -q $all_gradle_files)") 24 | else # linux 25 | gradle_files_checksum=($(find . -name build.gradle | xargs md5sum | md5sum)) 26 | fi 27 | else # no top-level gradle file 28 | gradle_files_checksum='no_gradle_files' 29 | fi 30 | if [[ -f $cache_dir/$gradle_files_checksum ]]; then # cached! yay! 31 | commands=$(cat $cache_dir/$gradle_files_checksum) 32 | else # not cached! boo-urns! 33 | commands=$($gradle_cmd --no-color --quiet tasks | grep ' - ' | awk '{print $1}' | tr '\n' ' ') 34 | if [[ ! -z $commands ]]; then 35 | echo $commands > $cache_dir/$gradle_files_checksum 36 | fi 37 | fi 38 | COMPREPLY=( $(compgen -W "$commands" -- $cur) ) 39 | } 40 | complete -F _gradle gradle -------------------------------------------------------------------------------- /bashrc_includes/p4_autocomplete.bash: -------------------------------------------------------------------------------- 1 | # auto completion for the p4 (Perforce) command. 2 | # by torstein.k.johansen@gmail.com 3 | 4 | cache_dir=$HOME/.p4.d 5 | if [ ! -e $cache_dir ]; then 6 | mkdir $cache_dir 7 | fi 8 | 9 | p4_branches_cache_file=$cache_dir/branches.cache 10 | p4_users_cache_file=$cache_dir/users.cache 11 | p4_commands_cache_file=$cache_dir/commands.cache 12 | 13 | function get_branches() 14 | { 15 | if [ ! -r $p4_branches_cache_file ]; then 16 | p4 branches | awk 'NF>3 {print $2}'> $p4_branches_cache_file 17 | fi 18 | 19 | echo $(cat $p4_branches_cache_file) 20 | } 21 | 22 | function get_users() 23 | { 24 | if [ ! -r $p4_users_cache_file ]; then 25 | p4 users | awk 'NF>3 {print $1}' > $p4_users_cache_file 26 | fi 27 | 28 | echo $(cat $p4_users_cache_file) 29 | } 30 | 31 | function get_commands() 32 | { 33 | if [ ! -r $p4_commands_cache_file ]; then 34 | p4 help commands | awk 'NF>3 {print $1}' > $p4_commands_cache_file 35 | fi 36 | 37 | echo $(cat $p4_commands_cache_file) 38 | } 39 | 40 | function get_depot_completion() 41 | { 42 | echo $( 43 | # in case someone actually has /[/]depot/ on their file system 44 | # and have enabled globastar, we disable it here just to be 45 | # safe. 46 | shopt -u globstar 47 | completions=$(p4 files ${1}* 2>/dev/null) 48 | completions=${completions}" "$(p4 dirs ${1}* 2>/dev/null) 49 | echo $completions 50 | ) 51 | } 52 | 53 | _p4_commands() 54 | { 55 | local cur=${COMP_WORDS[COMP_CWORD]} 56 | local prev=${COMP_WORDS[COMP_CWORD-1]} 57 | 58 | commands="$(get_commands) ... //depot" 59 | 60 | # default completions is the list of commands 61 | completions=$commands 62 | 63 | case "$prev" in 64 | add) 65 | completions="-c -f -n -t" 66 | ;; 67 | annotate) 68 | completions="-a -c -i -q -d -dw" 69 | ;; 70 | branch) 71 | completions="-f -d -o -i $(get_branches)" 72 | ;; 73 | change) 74 | completions="-f -s -d -o -i" 75 | ;; 76 | changes) 77 | completions="-i -t -l -L -c -m -s -u" 78 | ;; 79 | changelist) 80 | completions="-f -s -d -o -i" 81 | ;; 82 | changelists) 83 | completions="-i -t -l -L -c -m -s -u" 84 | ;; 85 | client) 86 | completions="-f -t -d -o -i" 87 | ;; 88 | counter) 89 | completions="-f -d" 90 | ;; 91 | delete) 92 | completions="-c -n" 93 | ;; 94 | depot) 95 | completions="-d -o -i" 96 | ;; 97 | describe) 98 | completions="-dn -dc -ds -du -db -dw -s" 99 | ;; 100 | diff) 101 | completions="... -dn -dc -ds -du -db -dw -dl -f -sa -sd -se -sr -t" 102 | ;; 103 | edit) 104 | completions="-c -n -t" 105 | ;; 106 | integrate) 107 | completions="-c -d -Dt -Ds -Di -f -h -i -I -o -r -t -v -b -s -n" 108 | ;; 109 | resolve) 110 | completions="-af -am -as -at -ay -db -dw -f -n -o -t -v" 111 | ;; 112 | resolved) 113 | completions="-o" 114 | ;; 115 | revert) 116 | completions="-a -n -k -c ..." 117 | ;; 118 | sync) 119 | completions="-f -n -k" 120 | ;; 121 | -s) 122 | completions="@" 123 | ;; 124 | -t) 125 | # file types 126 | base_types="text binary symlink apple apple resource unicode utf16" 127 | modifiers="w x ko k l C D F S Sn m X" 128 | completions="" 129 | for el in $base_types; do 130 | for ele in $modifiers; do 131 | completions=$completions" "${el}"+"${ele} 132 | done 133 | done 134 | 135 | ;; 136 | -b) 137 | completions=$(get_branches) 138 | ;; 139 | changes) 140 | completions="... -u" 141 | ;; 142 | -u) 143 | completions=$(get_users) 144 | ;; 145 | user) 146 | completions=$(get_users) 147 | ;; 148 | esac 149 | 150 | if [[ "$cur" == //depot/* && -z "$P4_DISABLE_DEPOT_COMPLETION" ]]; then 151 | completions=$(get_depot_completion $cur) 152 | fi 153 | 154 | COMPREPLY=( $(compgen -W "$completions" -- $cur) ) 155 | } 156 | 157 | complete -o default -F _p4_commands p4 158 | -------------------------------------------------------------------------------- /bors.toml: -------------------------------------------------------------------------------- 1 | status = [ 2 | "continuous-integration/travis-ci/push", 3 | ] 4 | # The default is one hour. 5 | timeout_sec = 7200 6 | delete_merged_branches = true 7 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 3 | org.gradle.parallel=true 4 | org.gradle.configureondemand=true 5 | -------------------------------------------------------------------------------- /scripts/git-wtf: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | HELP = < 56 | .git-wtfrc" and edit it. The config file is a YAML file that specifies the 57 | integration branches, any branches to ignore, and the max number of commits to 58 | display when --all-commits isn't used. git-wtf will look for a .git-wtfrc file 59 | starting in the current directory, and recursively up to the root. 60 | 61 | IMPORTANT NOTE: all local branches referenced in .git-wtfrc must be prefixed 62 | with heads/, e.g. "heads/master". Remote branches must be of the form 63 | remotes//. 64 | EOS 65 | 66 | COPYRIGHT = <. 68 | This program is free software: you can redistribute it and/or modify it 69 | under the terms of the GNU General Public License as published by the Free 70 | Software Foundation, either version 3 of the License, or (at your option) 71 | any later version. 72 | 73 | This program is distributed in the hope that it will be useful, but WITHOUT 74 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 75 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 76 | more details. 77 | 78 | You can find the GNU General Public License at: http://www.gnu.org/licenses/ 79 | EOS 80 | 81 | require 'yaml' 82 | CONFIG_FN = ".git-wtfrc" 83 | 84 | class Numeric; def pluralize s; "#{to_s} #{s}" + (self != 1 ? "s" : "") end end 85 | 86 | if ARGV.delete("--help") || ARGV.delete("-h") 87 | puts USAGE 88 | exit 89 | end 90 | 91 | $long = ARGV.delete("--long") || ARGV.delete("-l") 92 | $short = ARGV.delete("--short") || ARGV.delete("-s") 93 | $all = ARGV.delete("--all") || ARGV.delete("-a") 94 | $all_commits = ARGV.delete("--all-commits") || ARGV.delete("-A") 95 | $dump_config = ARGV.delete("--dump-config") 96 | $key = ARGV.delete("--key") || ARGV.delete("-k") 97 | $show_relations = ARGV.delete("--relations") || ARGV.delete("-r") 98 | 99 | ARGV.each { |a| abort "Error: unknown argument #{a}." if a =~ /^--/ } 100 | 101 | def find_file fn 102 | while true 103 | return fn if File.exist? fn 104 | fn2 = File.join("..", fn) 105 | return nil if File.expand_path(fn2) == File.expand_path(fn) 106 | fn = fn2 107 | end 108 | end 109 | 110 | ## find config file 111 | $config = { "integration-branches" => %w(heads/master heads/next heads/edge), "ignore" => [], "max_commits" => 5 }.merge begin 112 | fn = find_file CONFIG_FN 113 | if fn && (h = YAML::load_file(fn)) # yaml turns empty files into false 114 | h["integration-branches"] ||= h["versions"] # support old nomenclature 115 | h 116 | else 117 | {} 118 | end 119 | end 120 | 121 | if $dump_config 122 | puts $config.to_yaml 123 | exit 124 | end 125 | 126 | want_color = `git config color.wtf` 127 | want_color = `git config color.ui` if want_color.empty? 128 | $color = case want_color.chomp 129 | when "yes"; true 130 | when "auto"; $stdout.tty? 131 | end 132 | 133 | def red s; $color ? "\033[31m#{s}\033[0m" : s end 134 | def green s; $color ? "\033[32m#{s}\033[0m" : s end 135 | def yellow s; $color ? "\033[33m#{s}\033[0m" : s end 136 | def cyan s; $color ? "\033[36m#{s}\033[0m" : s end 137 | def grey s; $color ? "\033[1;30m#{s}\033[0m" : s end 138 | def purple s; $color ? "\033[35m#{s}\033[0m" : s end 139 | 140 | ## the set of commits in 'to' that aren't in 'from'. 141 | ## if empty, 'to' has been merged into 'from'. 142 | def commits_between from, to 143 | if $long 144 | `git log --pretty=format:"- %s [#{yellow "%h"}] (#{purple "%ae"}; %ar)" #{from}..#{to}` 145 | else 146 | `git log --pretty=format:"- %s [#{yellow "%h"}]" #{from}..#{to}` 147 | end.split(/[\r\n]+/) 148 | end 149 | 150 | def show_commits commits, prefix=" " 151 | if commits.empty? 152 | puts "#{prefix} none" 153 | else 154 | max = $all_commits ? commits.size : $config["max_commits"] 155 | max -= 1 if max == commits.size - 1 # never show "and 1 more" 156 | commits[0 ... max].each { |c| puts "#{prefix}#{c}" } 157 | puts grey("#{prefix}... and #{commits.size - max} more (use -A to see all).") if commits.size > max 158 | end 159 | end 160 | 161 | def ahead_behind_string ahead, behind 162 | [ahead.empty? ? nil : "#{ahead.size.pluralize 'commit'} ahead", 163 | behind.empty? ? nil : "#{behind.size.pluralize 'commit'} behind"]. 164 | compact.join("; ") 165 | end 166 | 167 | def widget merged_in, remote_only=false, local_only=false, local_only_merge=false 168 | left, right = case 169 | when remote_only; %w({ }) 170 | when local_only; %w{( )} 171 | else %w([ ]) 172 | end 173 | middle = case 174 | when merged_in && local_only_merge; green("~") 175 | when merged_in; green("x") 176 | else " " 177 | end 178 | print left, middle, right 179 | end 180 | 181 | def show b 182 | have_both = b[:local_branch] && b[:remote_branch] 183 | 184 | pushc, pullc, oosync = if have_both 185 | [x = commits_between(b[:remote_branch], b[:local_branch]), 186 | y = commits_between(b[:local_branch], b[:remote_branch]), 187 | !x.empty? && !y.empty?] 188 | end 189 | 190 | if b[:local_branch] 191 | puts "Local branch: " + green(b[:local_branch].sub(/^heads\//, "")) 192 | 193 | if have_both 194 | if pushc.empty? 195 | puts "#{widget true} in sync with remote" 196 | else 197 | action = oosync ? "push after rebase / merge" : "push" 198 | puts "#{widget false} NOT in sync with remote (you should #{action})" 199 | show_commits pushc unless $short 200 | end 201 | end 202 | end 203 | 204 | if b[:remote_branch] 205 | puts "Remote branch: #{cyan b[:remote_branch]} (#{b[:remote_url]})" 206 | 207 | if have_both 208 | if pullc.empty? 209 | puts "#{widget true} in sync with local" 210 | else 211 | action = pushc.empty? ? "merge" : "rebase / merge" 212 | puts "#{widget false} NOT in sync with local (you should #{action})" 213 | show_commits pullc unless $short 214 | end 215 | end 216 | end 217 | 218 | puts "\n#{red "WARNING"}: local and remote branches have diverged. A merge will occur unless you rebase." if oosync 219 | end 220 | 221 | def show_relations b, all_branches 222 | ibs, fbs = all_branches.partition { |name, br| $config["integration-branches"].include?(br[:local_branch]) || $config["integration-branches"].include?(br[:remote_branch]) } 223 | if $config["integration-branches"].include? b[:local_branch] 224 | puts "\nFeature branches:" unless fbs.empty? 225 | fbs.each do |name, br| 226 | next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch]) 227 | next if br[:ignore] 228 | local_only = br[:remote_branch].nil? 229 | remote_only = br[:local_branch].nil? 230 | name = if local_only 231 | purple br[:name] 232 | elsif remote_only 233 | cyan br[:name] 234 | else 235 | green br[:name] 236 | end 237 | 238 | ## for remote_only branches, we'll compute wrt the remote branch head. otherwise, we'll 239 | ## use the local branch head. 240 | head = remote_only ? br[:remote_branch] : br[:local_branch] 241 | 242 | remote_ahead = b[:remote_branch] ? commits_between(b[:remote_branch], head) : [] 243 | local_ahead = b[:local_branch] ? commits_between(b[:local_branch], head) : [] 244 | 245 | if local_ahead.empty? && remote_ahead.empty? 246 | puts "#{widget true, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is merged in" 247 | elsif local_ahead.empty? 248 | puts "#{widget true, remote_only, local_only, true} #{name} merged in (only locally)" 249 | else 250 | behind = commits_between head, (br[:local_branch] || br[:remote_branch]) 251 | ahead = remote_only ? remote_ahead : local_ahead 252 | puts "#{widget false, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is NOT merged in (#{ahead_behind_string ahead, behind})" 253 | show_commits ahead unless $short 254 | end 255 | end 256 | else 257 | puts "\nIntegration branches:" unless ibs.empty? # unlikely 258 | ibs.sort_by { |v, br| v }.each do |v, br| 259 | next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch]) 260 | next if br[:ignore] 261 | local_only = br[:remote_branch].nil? 262 | remote_only = br[:local_branch].nil? 263 | name = remote_only ? cyan(br[:name]) : green(br[:name]) 264 | 265 | ahead = commits_between v, (b[:local_branch] || b[:remote_branch]) 266 | if ahead.empty? 267 | puts "#{widget true, local_only} merged into #{name}" 268 | else 269 | #behind = commits_between b[:local_branch], v 270 | puts "#{widget false, local_only} NOT merged into #{name} (#{ahead.size.pluralize 'commit'} ahead)" 271 | show_commits ahead unless $short 272 | end 273 | end 274 | end 275 | end 276 | 277 | ## first, index registered remotes 278 | remotes = `git config --get-regexp ^remote\.\*\.url`.split(/[\r\n]+/).inject({}) do |hash, l| 279 | l =~ /^remote\.(.+?)\.url (.+)$/ or next hash 280 | hash[$1] ||= $2 281 | hash 282 | end 283 | 284 | ## next, index followed branches 285 | branches = `git config --get-regexp ^branch\.`.split(/[\r\n]+/).inject({}) do |hash, l| 286 | case l 287 | when /branch\.(.*?)\.remote (.+)/ 288 | name, remote = $1, $2 289 | 290 | hash[name] ||= {} 291 | hash[name].merge! :remote => remote, :remote_url => remotes[remote] 292 | when /branch\.(.*?)\.merge ((refs\/)?heads\/)?(.+)/ 293 | name, remote_branch = $1, $4 294 | hash[name] ||= {} 295 | hash[name].merge! :remote_mergepoint => remote_branch 296 | end 297 | hash 298 | end 299 | 300 | ## finally, index all branches 301 | remote_branches = {} 302 | `git show-ref`.split(/[\r\n]+/).each do |l| 303 | sha1, ref = l.chomp.split " refs/" 304 | 305 | if ref =~ /^heads\/(.+)$/ # local branch 306 | name = $1 307 | next if name == "HEAD" 308 | branches[name] ||= {} 309 | branches[name].merge! :name => name, :local_branch => ref 310 | elsif ref =~ /^remotes\/(.+?)\/(.+)$/ # remote branch 311 | remote, name = $1, $2 312 | remote_branches["#{remote}/#{name}"] = true 313 | next if name == "HEAD" 314 | ignore = !($all || remote == "origin") 315 | 316 | branch = name 317 | if branches[name] && branches[name][:remote] == remote 318 | # nothing 319 | else 320 | name = "#{remote}/#{branch}" 321 | end 322 | 323 | branches[name] ||= {} 324 | branches[name].merge! :name => name, :remote => remote, :remote_branch => "#{remote}/#{branch}", :remote_url => remotes[remote], :ignore => ignore 325 | end 326 | end 327 | 328 | branches.each do |k, b| 329 | next unless b[:remote] && b[:remote_mergepoint] 330 | b[:remote_branch] = if b[:remote] == "." 331 | b[:remote_mergepoint] 332 | else 333 | t = "#{b[:remote]}/#{b[:remote_mergepoint]}" 334 | remote_branches[t] && t # only if it's still alive 335 | end 336 | end 337 | 338 | show_dirty = ARGV.empty? 339 | targets = if ARGV.empty? 340 | [`git symbolic-ref HEAD`.chomp.sub(/^refs\/heads\//, "")] 341 | else 342 | ARGV.map { |x| x.sub(/^heads\//, "") } 343 | end.map { |t| branches[t] or abort "Error: can't find branch #{t.inspect}." } 344 | 345 | targets.each do |t| 346 | show t 347 | show_relations t, branches if $show_relations || t[:remote_branch].nil? 348 | end 349 | 350 | modified = show_dirty && `git ls-files -m` != "" 351 | uncommitted = show_dirty && `git diff-index --cached HEAD` != "" 352 | 353 | puts KEY if $key 354 | 355 | puts if modified || uncommitted 356 | puts "#{red "NOTE"}: working directory contains modified files." if modified 357 | puts "#{red "NOTE"}: staging area contains staged but uncommitted files." if uncommitted 358 | 359 | # the end! 360 | -------------------------------------------------------------------------------- /scripts/starship.toml: -------------------------------------------------------------------------------- 1 | format = '''[$time]($style)[$git_branch]($style)[$git_status]($style)[$directory]($style) ''' 2 | add_newline = false 3 | 4 | [time] 5 | format = '\[[$time]($style)\]' 6 | # format = '[\[$(date +%H:%M:%S)\]]' 7 | style = 'green' 8 | disabled = false 9 | 10 | [git_branch] 11 | format = '\[[$branch]($style)\]' 12 | style = 'blue' 13 | 14 | # Ref: https://starship.rs/config/#git-status 15 | [git_status] 16 | conflicted = " 💥 " 17 | diverged = "" # I don't care about this 18 | untracked = "" # I don't care about this 19 | 20 | [directory] 21 | format = '\[[$path]($style)\]' 22 | style = 'yellow' 23 | fish_style_pwd_dir_length = 3 24 | 25 | [golang] 26 | format = 'via [$symbol($version )($mod_version )]($style)' 27 | 28 | [status] 29 | style = 'blue' 30 | symbol = '🔴 ' 31 | success_symbol = '🟢' 32 | #format = '[\[$symbol$common_meaning$signal_name$maybe_int\]]($style) ' 33 | format = '\[[$int]($style)\]' 34 | map_symbol = true 35 | disabled = false 36 | -------------------------------------------------------------------------------- /setup/_macos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ~/.macos — https://mths.be/macos 4 | 5 | # Close any open System Preferences panes, to prevent them from overriding 6 | # settings we’re about to change 7 | osascript -e 'tell application "System Preferences" to quit' 8 | 9 | # Ask for the administrator password upfront 10 | sudo -v 11 | 12 | # Keep-alive: update existing `sudo` time stamp until `.macos` has finished 13 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 14 | 15 | ############################################################################### 16 | # General UI/UX # 17 | ############################################################################### 18 | 19 | # Set computer name (as done via System Preferences → Sharing) 20 | # COMPUTER_NAME="ashishb-mbp" 21 | #sudo scutil --set ComputerName $COMPUTER_NAME 22 | #sudo scutil --set HostName $COMPUTER_NAME 23 | #sudo scutil --set LocalHostName $COMPUTER_NAME 24 | #sudo defaults write 25 | # /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME 26 | 27 | # Set standby delay to 24 hours (default is 1 hour) 28 | sudo pmset -a standbydelay 86400 29 | 30 | # Disable the sound effects on boot 31 | sudo nvram SystemAudioVolume=" " 32 | 33 | # Disable transparency in the menu bar and elsewhere on Yosemite 34 | defaults write com.apple.universalaccess reduceTransparency -bool true 35 | 36 | # Menu bar: show remaining battery time (on pre-10.8); hide percentage 37 | defaults write com.apple.menuextra.battery ShowPercent -string "NO" 38 | defaults write com.apple.menuextra.battery ShowTime -string "YES" 39 | 40 | # Set highlight color to green 41 | defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" 42 | 43 | # Set sidebar icon size to medium 44 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 45 | 46 | # Always show scrollbars 47 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 48 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 49 | 50 | # Disable the over-the-top focus ring animation 51 | defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false 52 | 53 | # Disable smooth scrolling 54 | # (Uncomment if you’re on an older Mac that messes up the animation) 55 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 56 | 57 | # Increase window resize speed for Cocoa applications 58 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 59 | 60 | # Expand save panel by default 61 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 62 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 63 | 64 | # Expand print panel by default 65 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 66 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 67 | 68 | # Save to disk (not to iCloud) by default 69 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 70 | 71 | # Automatically quit printer app once the print jobs complete 72 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 73 | 74 | # Disable the “Are you sure you want to open this application?” dialog 75 | defaults write com.apple.LaunchServices LSQuarantine -bool false 76 | 77 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 78 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 79 | 80 | # Display ASCII control characters using caret notation in standard text views 81 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 82 | defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 83 | 84 | # Disable Resume system-wide 85 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 86 | 87 | # Disable automatic termination of inactive apps 88 | defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 89 | 90 | # Disable the crash reporter 91 | #defaults write com.apple.CrashReporter DialogType -string "none" 92 | 93 | # Set Help Viewer windows to non-floating mode 94 | defaults write com.apple.helpviewer DevMode -bool true 95 | 96 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 97 | # Commented out, as this is known to cause problems in various Adobe apps :( 98 | # See https://github.com/mathiasbynens/dotfiles/issues/237 99 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 100 | 101 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 102 | # in the login window 103 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 104 | 105 | # Restart automatically if the computer freezes 106 | sudo systemsetup -setrestartfreeze on 107 | 108 | # Never go into computer sleep mode 109 | sudo systemsetup -setcomputersleep Off > /dev/null 110 | 111 | # Disable Notification Center and remove the menu bar icon 112 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 113 | 114 | # Disable automatic capitalization as it’s annoying when typing code 115 | defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false 116 | 117 | # Disable smart dashes as they’re annoying when typing code 118 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 119 | 120 | # Disable automatic period substitution as it’s annoying when typing code 121 | defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false 122 | 123 | # Disable smart quotes as they’re annoying when typing code 124 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 125 | 126 | # Disable auto-correct 127 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 128 | 129 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 130 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 131 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 132 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 133 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 134 | 135 | ############################################################################### 136 | # SSD-specific tweaks # 137 | ############################################################################### 138 | 139 | # Disable hibernation (speeds up entering sleep mode) 140 | sudo pmset -a hibernatemode 0 141 | 142 | # Remove the sleep image file to save disk space 143 | sudo rm /private/var/vm/sleepimage 144 | # Create a zero-byte file instead… 145 | sudo touch /private/var/vm/sleepimage 146 | # …and make sure it can’t be rewritten 147 | sudo chflags uchg /private/var/vm/sleepimage 148 | 149 | ############################################################################### 150 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 151 | ############################################################################### 152 | 153 | # Trackpad: enable tap to click for this user and for the login screen 154 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 155 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 156 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 157 | 158 | # Trackpad: map bottom right corner to right-click 159 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 160 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 161 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 162 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 163 | 164 | # Disable “natural” (Lion-style) scrolling 165 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 166 | 167 | # Increase sound quality for Bluetooth headphones/headsets 168 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 169 | 170 | # Enable full keyboard access for all controls 171 | # (e.g. enable Tab in modal dialogs) 172 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 173 | 174 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 175 | defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 176 | defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 177 | # Follow the keyboard focus while zoomed in 178 | defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 179 | 180 | # Disable press-and-hold for keys in favor of key repeat 181 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 182 | 183 | # Set a blazingly fast keyboard repeat rate 184 | defaults write NSGlobalDomain KeyRepeat -int 1 185 | defaults write NSGlobalDomain InitialKeyRepeat -int 10 186 | 187 | # Set language and text formats 188 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 189 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 190 | defaults write NSGlobalDomain AppleLanguages -array "en" 191 | defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" 192 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 193 | defaults write NSGlobalDomain AppleMetricUnits -bool true 194 | 195 | # Show language menu in the top right corner of the boot screen 196 | sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true 197 | 198 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 199 | sudo systemsetup -settimezone "Europe/Brussels" > /dev/null 200 | 201 | # Stop iTunes from responding to the keyboard media keys 202 | #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 203 | 204 | ############################################################################### 205 | # Screen # 206 | ############################################################################### 207 | 208 | # Require password immediately after sleep or screen saver begins 209 | defaults write com.apple.screensaver askForPassword -int 1 210 | defaults write com.apple.screensaver askForPasswordDelay -int 0 211 | 212 | # Save screenshots to the desktop 213 | defaults write com.apple.screencapture location -string "${HOME}/Desktop" 214 | 215 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 216 | defaults write com.apple.screencapture type -string "png" 217 | 218 | # Disable shadow in screenshots 219 | defaults write com.apple.screencapture disable-shadow -bool true 220 | 221 | # Enable subpixel font rendering on non-Apple LCDs 222 | # Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 223 | defaults write NSGlobalDomain AppleFontSmoothing -int 1 224 | 225 | # Enable HiDPI display modes (requires restart) 226 | sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 227 | 228 | ############################################################################### 229 | # Finder # 230 | ############################################################################### 231 | 232 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 233 | defaults write com.apple.finder QuitMenuItem -bool true 234 | 235 | # Finder: disable window animations and Get Info animations 236 | defaults write com.apple.finder DisableAllAnimations -bool true 237 | 238 | # Set Desktop as the default location for new Finder windows 239 | # For other paths, use `PfLo` and `file:///full/path/here/` 240 | defaults write com.apple.finder NewWindowTarget -string "PfDe" 241 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" 242 | 243 | # Show icons for hard drives, servers, and removable media on the desktop 244 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 245 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 246 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 247 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 248 | 249 | # Finder: show hidden files by default 250 | #defaults write com.apple.finder AppleShowAllFiles -bool true 251 | 252 | # Finder: show all filename extensions 253 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 254 | 255 | # Finder: show status bar 256 | defaults write com.apple.finder ShowStatusBar -bool true 257 | 258 | # Finder: show path bar 259 | defaults write com.apple.finder ShowPathbar -bool true 260 | 261 | # Display full POSIX path as Finder window title 262 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 263 | 264 | # Keep folders on top when sorting by name 265 | defaults write com.apple.finder _FXSortFoldersFirst -bool true 266 | 267 | # When performing a search, search the current folder by default 268 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 269 | 270 | # Disable the warning when changing a file extension 271 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 272 | 273 | # Enable spring loading for directories 274 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 275 | 276 | # Remove the spring loading delay for directories 277 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 278 | 279 | # Avoid creating .DS_Store files on network or USB volumes 280 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 281 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 282 | 283 | # Disable disk image verification 284 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 285 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 286 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 287 | 288 | # Automatically open a new Finder window when a volume is mounted 289 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 290 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 291 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 292 | 293 | # Show item info near icons on the desktop and in other icon views 294 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 295 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 296 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 297 | 298 | # Show item info to the right of the icons on the desktop 299 | /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 300 | 301 | # Enable snap-to-grid for icons on the desktop and in other icon views 302 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 303 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 304 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 305 | 306 | # Increase grid spacing for icons on the desktop and in other icon views 307 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 308 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 309 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 310 | 311 | # Increase the size of icons on the desktop and in other icon views 312 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 313 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 314 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 315 | 316 | # Use list view in all Finder windows by default 317 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` 318 | defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 319 | 320 | # Disable the warning before emptying the Trash 321 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 322 | 323 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 324 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 325 | 326 | # Show the ~/Library folder 327 | chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library 328 | 329 | # Show the /Volumes folder 330 | sudo chflags nohidden /Volumes 331 | 332 | # Remove Dropbox’s green checkmark icons in Finder 333 | file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 334 | [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 335 | 336 | # Expand the following File Info panes: 337 | # “General”, “Open with”, and “Sharing & Permissions” 338 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 339 | General -bool true \ 340 | OpenWith -bool true \ 341 | Privileges -bool true 342 | 343 | ############################################################################### 344 | # Dock, Dashboard, and hot corners # 345 | ############################################################################### 346 | 347 | # Enable highlight hover effect for the grid view of a stack (Dock) 348 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 349 | 350 | # Set the icon size of Dock items to 36 pixels 351 | defaults write com.apple.dock tilesize -int 36 352 | 353 | # Change minimize/maximize window effect 354 | defaults write com.apple.dock mineffect -string "scale" 355 | 356 | # Minimize windows into their application’s icon 357 | defaults write com.apple.dock minimize-to-application -bool true 358 | 359 | # Enable spring loading for all Dock items 360 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 361 | 362 | # Show indicator lights for open applications in the Dock 363 | defaults write com.apple.dock show-process-indicators -bool true 364 | 365 | # Wipe all (default) app icons from the Dock 366 | # This is only really useful when setting up a new Mac, or if you don’t use 367 | # the Dock to launch apps. 368 | #defaults write com.apple.dock persistent-apps -array 369 | 370 | # Show only open applications in the Dock 371 | #defaults write com.apple.dock static-only -bool true 372 | 373 | # Don’t animate opening applications from the Dock 374 | defaults write com.apple.dock launchanim -bool false 375 | 376 | # Speed up Mission Control animations 377 | defaults write com.apple.dock expose-animation-duration -float 0.1 378 | 379 | # Don’t group windows by application in Mission Control 380 | # (i.e. use the old Exposé behavior instead) 381 | defaults write com.apple.dock expose-group-by-app -bool false 382 | 383 | # Disable Dashboard 384 | defaults write com.apple.dashboard mcx-disabled -bool true 385 | 386 | # Don’t show Dashboard as a Space 387 | defaults write com.apple.dock dashboard-in-overlay -bool true 388 | 389 | # Don’t automatically rearrange Spaces based on most recent use 390 | defaults write com.apple.dock mru-spaces -bool false 391 | 392 | # Remove the auto-hiding Dock delay 393 | defaults write com.apple.dock autohide-delay -float 0 394 | # Remove the animation when hiding/showing the Dock 395 | defaults write com.apple.dock autohide-time-modifier -float 0 396 | 397 | # Automatically hide and show the Dock 398 | defaults write com.apple.dock autohide -bool true 399 | 400 | # Make Dock icons of hidden applications translucent 401 | defaults write com.apple.dock showhidden -bool true 402 | 403 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 404 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 405 | 406 | # Reset Launchpad, but keep the desktop wallpaper intact 407 | find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 408 | 409 | # Add iOS & Watch Simulator to Launchpad 410 | sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" 411 | sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" 412 | 413 | # Add a spacer to the left side of the Dock (where the applications are) 414 | #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 415 | # Add a spacer to the right side of the Dock (where the Trash is) 416 | #defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' 417 | 418 | # Hot corners 419 | # Possible values: 420 | # 0: no-op 421 | # 2: Mission Control 422 | # 3: Show application windows 423 | # 4: Desktop 424 | # 5: Start screen saver 425 | # 6: Disable screen saver 426 | # 7: Dashboard 427 | # 10: Put display to sleep 428 | # 11: Launchpad 429 | # 12: Notification Center 430 | # Top left screen corner → Mission Control 431 | 432 | # Mathias had this in Top left corner, I hated it (since menu bar is in top left 433 | # as well). Therefore, I changed it to bottom-right. 434 | defaults write com.apple.dock wvous-br-corner -int 2 435 | defaults write com.apple.dock wvous-br-modifier -int 0 436 | # Top right screen corner → Desktop 437 | defaults write com.apple.dock wvous-tr-corner -int 4 438 | defaults write com.apple.dock wvous-tr-modifier -int 0 439 | # Bottom left screen corner → Start screen saver 440 | defaults write com.apple.dock wvous-bl-corner -int 5 441 | defaults write com.apple.dock wvous-bl-modifier -int 0 442 | 443 | ############################################################################### 444 | # Safari & WebKit # 445 | ############################################################################### 446 | 447 | # Privacy: don’t send search queries to Apple 448 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 449 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 450 | 451 | # Press Tab to highlight each item on a web page 452 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 453 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 454 | 455 | # Show the full URL in the address bar (note: this still hides the scheme) 456 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 457 | 458 | # Set Safari’s home page to `about:blank` for faster loading 459 | defaults write com.apple.Safari HomePage -string "about:blank" 460 | 461 | # Prevent Safari from opening ‘safe’ files automatically after downloading 462 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 463 | 464 | # Allow hitting the Backspace key to go to the previous page in history 465 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 466 | 467 | # Hide Safari’s bookmarks bar by default 468 | defaults write com.apple.Safari ShowFavoritesBar -bool false 469 | 470 | # Hide Safari’s sidebar in Top Sites 471 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 472 | 473 | # Disable Safari’s thumbnail cache for History and Top Sites 474 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 475 | 476 | # Enable Safari’s debug menu 477 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 478 | 479 | # Make Safari’s search banners default to Contains instead of Starts With 480 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 481 | 482 | # Remove useless icons from Safari’s bookmarks bar 483 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 484 | 485 | # Enable the Develop menu and the Web Inspector in Safari 486 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 487 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 488 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 489 | 490 | # Add a context menu item for showing the Web Inspector in web views 491 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 492 | 493 | # Enable continuous spellchecking 494 | defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true 495 | # Disable auto-correct 496 | defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false 497 | 498 | # Disable AutoFill 499 | defaults write com.apple.Safari AutoFillFromAddressBook -bool false 500 | defaults write com.apple.Safari AutoFillPasswords -bool false 501 | defaults write com.apple.Safari AutoFillCreditCardData -bool false 502 | defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false 503 | 504 | # Warn about fraudulent websites 505 | defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true 506 | 507 | # Disable plug-ins 508 | defaults write com.apple.Safari WebKitPluginsEnabled -bool false 509 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false 510 | 511 | # Disable Java 512 | defaults write com.apple.Safari WebKitJavaEnabled -bool false 513 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false 514 | 515 | # Block pop-up windows 516 | defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false 517 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false 518 | 519 | # Disable auto-playing video 520 | #defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false 521 | #defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false 522 | #defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false 523 | #defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false 524 | 525 | # Enable “Do Not Track” 526 | defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true 527 | 528 | # Update extensions automatically 529 | defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true 530 | 531 | ############################################################################### 532 | # Mail # 533 | ############################################################################### 534 | 535 | # Disable send and reply animations in Mail.app 536 | defaults write com.apple.mail DisableReplyAnimations -bool true 537 | defaults write com.apple.mail DisableSendAnimations -bool true 538 | 539 | # Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app 540 | defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 541 | 542 | # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 543 | defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9" 544 | 545 | # Display emails in threaded mode, sorted by date (oldest at the top) 546 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 547 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 548 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 549 | 550 | # Disable inline attachments (just show the icons) 551 | defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 552 | 553 | # Disable automatic spell checking 554 | defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 555 | 556 | ############################################################################### 557 | # Spotlight # 558 | ############################################################################### 559 | 560 | # Hide Spotlight tray-icon (and subsequent helper) 561 | #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 562 | # Disable Spotlight indexing for any volume that gets mounted and has not yet 563 | # been indexed before. 564 | # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 565 | sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 566 | # Change indexing order and disable some search results 567 | # Yosemite-specific search results (remove them if you are using macOS 10.9 or older): 568 | # MENU_DEFINITION 569 | # MENU_CONVERSION 570 | # MENU_EXPRESSION 571 | # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) 572 | # MENU_WEBSEARCH (send search queries to Apple) 573 | # MENU_OTHER 574 | defaults write com.apple.spotlight orderedItems -array \ 575 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 576 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 577 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 578 | '{"enabled" = 1;"name" = "PDF";}' \ 579 | '{"enabled" = 1;"name" = "FONTS";}' \ 580 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 581 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 582 | '{"enabled" = 0;"name" = "CONTACT";}' \ 583 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 584 | '{"enabled" = 0;"name" = "IMAGES";}' \ 585 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 586 | '{"enabled" = 0;"name" = "MUSIC";}' \ 587 | '{"enabled" = 0;"name" = "MOVIES";}' \ 588 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 589 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 590 | '{"enabled" = 0;"name" = "SOURCE";}' \ 591 | '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \ 592 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 593 | '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 594 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 595 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 596 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 597 | # Load new settings before rebuilding the index 598 | killall mds > /dev/null 2>&1 599 | # Make sure indexing is enabled for the main volume 600 | sudo mdutil -i on / > /dev/null 601 | # Rebuild the index from scratch 602 | sudo mdutil -E / > /dev/null 603 | 604 | ############################################################################### 605 | # Terminal & iTerm 2 # 606 | ############################################################################### 607 | 608 | # Only use UTF-8 in Terminal.app 609 | defaults write com.apple.terminal StringEncodings -array 4 610 | 611 | # Use a modified version of the Solarized Dark theme by default in Terminal.app 612 | osascript < /dev/null && sudo tmutil disablelocal 685 | 686 | ############################################################################### 687 | # Activity Monitor # 688 | ############################################################################### 689 | 690 | # Show the main window when launching Activity Monitor 691 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 692 | 693 | # Visualize CPU usage in the Activity Monitor Dock icon 694 | defaults write com.apple.ActivityMonitor IconType -int 5 695 | 696 | # Show all processes in Activity Monitor 697 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 698 | 699 | # Sort Activity Monitor results by CPU usage 700 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 701 | defaults write com.apple.ActivityMonitor SortDirection -int 0 702 | 703 | ############################################################################### 704 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 705 | ############################################################################### 706 | 707 | # Enable the debug menu in Address Book 708 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 709 | 710 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 711 | defaults write com.apple.dashboard devmode -bool true 712 | 713 | # Enable the debug menu in iCal (pre-10.8) 714 | defaults write com.apple.iCal IncludeDebugMenu -bool true 715 | 716 | # Use plain text mode for new TextEdit documents 717 | defaults write com.apple.TextEdit RichText -int 0 718 | # Open and save files as UTF-8 in TextEdit 719 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 720 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 721 | 722 | # Enable the debug menu in Disk Utility 723 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 724 | defaults write com.apple.DiskUtility advanced-image-options -bool true 725 | 726 | # Auto-play videos when opened with QuickTime Player 727 | defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true 728 | 729 | ############################################################################### 730 | # Mac App Store # 731 | ############################################################################### 732 | 733 | # Enable the WebKit Developer Tools in the Mac App Store 734 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 735 | 736 | # Enable Debug Menu in the Mac App Store 737 | defaults write com.apple.appstore ShowDebugMenu -bool true 738 | 739 | # Enable the automatic update check 740 | defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true 741 | 742 | # Check for software updates daily, not just once per week 743 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 744 | 745 | # Download newly available updates in background 746 | defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 747 | 748 | # Install System data files & security updates 749 | defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 750 | 751 | # Automatically download apps purchased on other Macs 752 | defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 753 | 754 | # Turn on app auto-update 755 | defaults write com.apple.commerce AutoUpdate -bool true 756 | 757 | # Allow the App Store to reboot machine on macOS updates 758 | defaults write com.apple.commerce AutoUpdateRestartRequired -bool true 759 | 760 | ############################################################################### 761 | # Photos # 762 | ############################################################################### 763 | 764 | # Prevent Photos from opening automatically when devices are plugged in 765 | defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true 766 | 767 | ############################################################################### 768 | # Messages # 769 | ############################################################################### 770 | 771 | # Disable automatic emoji substitution (i.e. use plain text smileys) 772 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 773 | 774 | # Disable smart quotes as it’s annoying for messages that contain code 775 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 776 | 777 | # Disable continuous spell checking 778 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 779 | 780 | ############################################################################### 781 | # Google Chrome & Google Chrome Canary # 782 | ############################################################################### 783 | 784 | # Disable the all too sensitive backswipe on trackpads 785 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 786 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 787 | 788 | # Disable the all too sensitive backswipe on Magic Mouse 789 | defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 790 | defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 791 | 792 | # Use the system-native print preview dialog 793 | defaults write com.google.Chrome DisablePrintPreview -bool true 794 | defaults write com.google.Chrome.canary DisablePrintPreview -bool true 795 | 796 | # Expand the print dialog by default 797 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 798 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 799 | 800 | ############################################################################### 801 | # GPGMail 2 # 802 | ############################################################################### 803 | 804 | # Disable signing emails by default 805 | defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false 806 | 807 | ############################################################################### 808 | # Opera & Opera Developer # 809 | ############################################################################### 810 | 811 | # Expand the print dialog by default 812 | defaults write com.operasoftware.Opera PMPrintingExpandedStateForPrint2 -boolean true 813 | defaults write com.operasoftware.OperaDeveloper PMPrintingExpandedStateForPrint2 -boolean true 814 | 815 | ############################################################################### 816 | # SizeUp.app # 817 | ############################################################################### 818 | 819 | # Start SizeUp at login 820 | defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true 821 | 822 | # Don’t show the preferences window on next start 823 | defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false 824 | 825 | ############################################################################### 826 | # Sublime Text # 827 | ############################################################################### 828 | 829 | # Install Sublime Text settings 830 | cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null 831 | 832 | ############################################################################### 833 | # Spectacle.app # 834 | ############################################################################### 835 | 836 | # Set up my preferred keyboard shortcuts 837 | cp -r init/spectacle.json ~/Library/Application\ Support/Spectacle/Shortcuts.json 2> /dev/null 838 | 839 | ############################################################################### 840 | # Transmission.app # 841 | ############################################################################### 842 | 843 | # Use `~/Documents/Torrents` to store incomplete downloads 844 | defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 845 | defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 846 | 847 | # Use `~/Downloads` to store completed downloads 848 | defaults write org.m0k.transmission DownloadLocationConstant -bool true 849 | 850 | # Don’t prompt for confirmation before downloading 851 | defaults write org.m0k.transmission DownloadAsk -bool false 852 | defaults write org.m0k.transmission MagnetOpenAsk -bool false 853 | 854 | # Don’t prompt for confirmation before removing non-downloading active transfers 855 | defaults write org.m0k.transmission CheckRemoveDownloading -bool true 856 | 857 | # Trash original torrent files 858 | defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 859 | 860 | # Hide the donate message 861 | defaults write org.m0k.transmission WarningDonate -bool false 862 | # Hide the legal disclaimer 863 | defaults write org.m0k.transmission WarningLegal -bool false 864 | 865 | # IP block list. 866 | # Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ 867 | defaults write org.m0k.transmission BlocklistNew -bool true 868 | defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" 869 | defaults write org.m0k.transmission BlocklistAutoUpdate -bool true 870 | 871 | # Randomize port on launch 872 | defaults write org.m0k.transmission RandomPort -bool true 873 | 874 | ############################################################################### 875 | # Twitter.app # 876 | ############################################################################### 877 | 878 | # Disable smart quotes as it’s annoying for code tweets 879 | defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false 880 | 881 | # Show the app window when clicking the menu bar icon 882 | defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 883 | 884 | # Enable the hidden ‘Develop’ menu 885 | defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true 886 | 887 | # Open links in the background 888 | defaults write com.twitter.twitter-mac openLinksInBackground -bool true 889 | 890 | # Allow closing the ‘new tweet’ window by pressing `Esc` 891 | defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true 892 | 893 | # Show full names rather than Twitter handles 894 | defaults write com.twitter.twitter-mac ShowFullNames -bool true 895 | 896 | # Hide the app in the background if it’s not the front-most window 897 | defaults write com.twitter.twitter-mac HideInBackground -bool true 898 | 899 | ############################################################################### 900 | # Tweetbot.app # 901 | ############################################################################### 902 | 903 | # Bypass the annoyingly slow t.co URL shortener 904 | defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true 905 | 906 | ############################################################################### 907 | # Kill affected applications # 908 | ############################################################################### 909 | 910 | for app in "Activity Monitor" \ 911 | "Address Book" \ 912 | "Calendar" \ 913 | "cfprefsd" \ 914 | "Contacts" \ 915 | "Dock" \ 916 | "Finder" \ 917 | "Google Chrome Canary" \ 918 | "Google Chrome" \ 919 | "Mail" \ 920 | "Messages" \ 921 | "Opera" \ 922 | "Photos" \ 923 | "Safari" \ 924 | "SizeUp" \ 925 | "Spectacle" \ 926 | "SystemUIServer" \ 927 | "Terminal" \ 928 | "Transmission" \ 929 | "Tweetbot" \ 930 | "Twitter" \ 931 | "iCal"; do 932 | killall "${app}" &> /dev/null 933 | done 934 | echo "Done. Note that some of these changes require a logout/restart to take effect." 935 | -------------------------------------------------------------------------------- /setup/setup_cryptocurrencies.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # Google's Go Language 5 | brew install golang 6 | # Parity (Ethereum client) is written in this 7 | brew install cmake rust 8 | # Solidity compiler 9 | brew tap ethereum/ethereum 10 | brew install solidity 11 | # Truffle for testing and deploying Solidity contracts 12 | npm install -g truffle 13 | # Web3 for Ethereum 14 | npm install -g web3 15 | # Solidity linter 16 | npm install -g solhint 17 | # Use Type script in lieu of Javascript for code maintainability 18 | npm install -g typescript 19 | npm install -g tslist # Type script linter 20 | # EVM decompiler 21 | sudo pip3 install panoramix-decompiler 22 | 23 | # brew install kubernetes-cli 24 | # brew install kubernetes-helm 25 | 26 | 27 | # Good places to learn 28 | # https://medium.com/coinmonks/an-analysis-of-a-couple-ethereum-honeypot-contracts-5c07c95b0a8d 29 | # https://chainshot.com 30 | # https://cryptozombies.io 31 | # https://capturetheether.com/ 32 | # https://github.com/OpenZeppelin/ethernaut 33 | # https://qed-it.com/2017/07/11/challenge-one-the-functionality-of-zk-snark - ZK Snarks 34 | 35 | # Debugger 36 | # https://medium.com/tenderly/how-to-debug-solidity-smart-contracts-with-tenderly-and-truffle-da995cfe098f 37 | 38 | # Pakala symbolic executor 39 | # https://www.palkeo.com/en/projets/ethereum/pakala.html 40 | 41 | # Attack tool 42 | # https://github.com/b-mueller/scrooge-mcetherface 43 | -------------------------------------------------------------------------------- /setup/setup_new_mac_machine.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | if test ${CI:-}; then 5 | set -x # For better debugging 6 | # Source: https://discuss.circleci.com/t/brew-link-step-failing-on-python-dependency/33925/8?u=ashishb 7 | export HOMEBREW_NO_AUTO_UPDATE=1 8 | fi 9 | 10 | # Check for Homebrew, 11 | # Install if we don't have it 12 | if test ! $(which brew); then 13 | echo "Installing homebrew..." 14 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 15 | echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ashishb/.zprofile 16 | eval "$(/opt/homebrew/bin/brew shellenv)" 17 | fi 18 | 19 | # Turn off analytics 20 | brew analytics off 21 | 22 | # Update homebrew recipes 23 | brew update 24 | 25 | # Install it early on as other packages might depend on it and might install 26 | # a different version of Python otherwise 27 | brew install python@3.12 28 | # Poetry package manager 29 | brew install poetry 30 | 31 | brew install rust 32 | # Find unused poetry packages (warning: this does return false positives!) 33 | cargo install poetry-udeps --locked 34 | 35 | # A better searcher for git repos since it skips over files which are listed in .gitignore 36 | brew install rg 37 | # rg is much better 38 | # brew install ag 39 | # A better file finder than find 40 | # I moved to ag (silver searcher) 41 | # brew install ack # A replacement for grep. 42 | 43 | # Better than find 44 | brew install fd 45 | brew install bash # Install latest version of Bash. 46 | brew install shellcheck # Linter for shell scripts 47 | # Install new version of bash completion for this 48 | brew install bash-completion@2 49 | # Install GNU core utilities (those that come with macOS are outdated) 50 | # Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`. 51 | # coreutils is already installed on Travis CI. Don't fail if we fail to install this. 52 | brew install coreutils 53 | brew install mmv # Move multiple files 54 | brew install bat # Better than cat. Supports syntax highlighting. 55 | brew install ctags 56 | # This is useful for extracting EXIF data out of images 57 | brew install exiftool 58 | # Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed 59 | brew install findutils 60 | # Duplicate file search and removal 61 | brew install fdupes 62 | # .gitignore boilerplate code (example: "gibo python textmate"). 63 | brew install gibo 64 | brew install hexedit 65 | # Do I need this? 66 | # brew install jsonpp 67 | brew install imagemagick 68 | # This is not available anymore. 69 | # brew install lighthttpd # Needed for running "git instaweb". 70 | brew install nmap 71 | brew install ssh-copy-id # Easy way to set up key based login. 72 | # Remove sshpass, I no longer use it. 73 | # # Install sshpass (unofficial since homebrew admins won't allow this formula in 74 | # # the official repo). 75 | # brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb 76 | brew install vim # Better than default vim. 77 | # wget is already installed on Travis CI 78 | brew install wget || true 79 | brew install jq # For JSON parsing in shell 80 | # https://stackoverflow.com/questions/11834297/how-can-i-remove-silence-from-an-mp3-programmatically 81 | brew install sox # To remove silence from music 82 | brew install google-cloud-sdk 83 | 84 | # TODO(ashishb): Is this still required? 85 | # Fix: 86 | # https://stackoverflow.com/questions/19215590/why-cant-i-install-any-gems-on-my-mac 87 | # brew tap raggi/ale && brew install openssl-osx-ca 88 | 89 | # Allows generation from notification from command line (not that useful). 90 | # brew install terminal-notifier 91 | 92 | # This is not required anymore as per https://github.com/Homebrew/homebrew-core/issues/131 93 | # brew-cask converts brew into a package manager for mac packages. 94 | # brew install caskroom/cask/brew-cask 95 | 96 | # Deprecated since all formulae has been migrated 97 | # brew tap homebrew/binary 98 | 99 | # Deprecated since all formulae has been migrated 100 | # Unstable softwares, right from HEAD of some other repo. 101 | # brew tap brew homebrew/homebrew-head-only 102 | 103 | # Useful macOS softwares. 104 | 105 | # For some reason, this installation fails on Travis CI 106 | # https://travis-ci.org/ashishb/dotfiles/jobs/648627652 107 | if test ! ${CI:-}; then 108 | # Install chrome if it is not installed. 109 | ls /Applications/Google\ Chrome.app || brew install google-chrome 110 | fi 111 | # Too bulky to use, install it only when required. 112 | # brew install adobe-reader # Unavoidable since some pdf forms require this. 113 | # brew install bartender # Clutter control from menu bar. 114 | # brew install bettertouchtool # A tool for adding shortcuts to apps. I use Spectacle now. 115 | # brew install cheatsheet # Use long press cmd button on any mac app to see shortcuts. I don't use this anymore. 116 | # brew install dash # Offline documentation browser (I don't use it anymore) 117 | brew install selfcontrol # To block certain websites for productivity 118 | brew install google-drive 119 | # Great tool but the cask has been deleted - https://github.com/JadenGeller/Helium/issues/207 120 | # brew install jadengeller-helium # Web browser on top of all other windows 121 | brew install iterm2 122 | brew install starship # Awesome prompt configuration tool (see scripts/starship.toml as well) 123 | # Kindle cask has been discontinued 124 | # Ref: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/k/kindle.rb 125 | # brew install kindle # Kindle reader 126 | brew install macdown # Mark-down editor 127 | brew install diffmerge # File diffing GUI 128 | # I moved to Alfred. Alfred is better than QuickSilver. 129 | # brew install quicksilver # Quicksilver is better than Spotlight. 130 | brew install alfred 131 | brew install bitbar 132 | # brew install skype # I don't use Skype anymore 133 | # I prefer spectacle now. 134 | # brew install slate # XMonand like window manager. 135 | # Spectable is no longer maintained, switch to rectangle 136 | # brew install spectacle # Window manager 137 | brew install rectangle 138 | # Cask is not working anymore. I moved to avast 139 | # brew install sophos-anti-virus-home-edition # Free Anti-virus protection 140 | # Seems to fail on GitHub CI 141 | if test ! ${CI:-}; then 142 | brew install avast-security # Free Anti-virus protection 143 | fi 144 | # Not using it anymore. 145 | # brew install spotify # An amazing music streaming service 146 | brew install xquartz # For running X server based apps 147 | brew install wireshark 148 | brew install fanny 149 | # TODO(ashishb): Add cask for Gyazo, an app for taking and uploading screenshots. 150 | 151 | # Battery health info. Not great but still good. 152 | brew install coconutbattery 153 | # Overcome Wi-Fi time restrictions - http://airpass.tiagoalves.me/ 154 | brew install airpass 155 | # Not available anymore 156 | # brew install battery-time-remaining 157 | # Create a cask for http://froyosoft.com/soundbooster.php 158 | brew install pycharm-ce 159 | # Go language - this fails on CI 160 | # https://github.com/ashishb/dotfiles/runs/6838155133?check_suite_focus=true 161 | if test ! ${CI:-}; then 162 | brew install golang 163 | # This unlinks the existing Go 1.17 and fails on CI 164 | brew install golangci-lint 165 | fi 166 | brew install goland 167 | # go get -u golang.org/x/lint/golint # Install go lint 168 | # Install docker 169 | brew install homebrew/cask/docker 170 | # Docker file linter 171 | brew install hadolint 172 | # YAML file linter 173 | brew install yamllint 174 | # GPG for signing git commits 175 | # https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key 176 | brew install gpg 177 | # GitHub Command-line tool 178 | brew install gh 179 | # GitHub CLI Copilot Extension 180 | # This cannot be auto installed without `gh login` first 181 | # gh extension install github/gh-copilot 182 | 183 | # Nice diff for git - https://github.com/dandavison/delta 184 | brew install git-delta 185 | # Run GitHub actions locally 186 | brew install act 187 | # TODO(ashishb) Create a cask for xtype - no point, I use phase express now 188 | # http://mac.softpedia.com/get/Utilities/Presto-app4mac.shtml - a free and good text auto-expander for Mac 189 | 190 | # Install fonts. 191 | echo "Installing fonts..." 192 | brew install --cask font-fira-code 193 | 194 | # Android development and reverse engineering related installs. 195 | brew install android-studio 196 | brew install fastlane # Android release from CLI 197 | brew install pidcat # An amazing alternative to logcat 198 | # PNG compressor 199 | brew install zopfli 200 | # Not required anymore since they are part of Android Studio. 201 | # brew install android-sdk && android update sdk --no-ui --filter 'platform-tools' 202 | # brew install android-ndk # Not required anymore since they are part of Android Studio. 203 | # Not required anymore, since Android uses gradle. 204 | # brew install ant # For building android projects. 205 | brew install apktool # For android reverse engineering. 206 | brew install dex2jar # For android reverse engineering. 207 | brew install jadx # Java decompiler 208 | # brew install jad # Java decompiler. JAD has been discontinued. 209 | brew install jd-gui # For java decompilation. 210 | # Android emulator is good enough now, therefore, I won't be using genymotion anymore. 211 | # brew install virtualbox # Needed for GenyMotion. 212 | # brew install genymotion # Emulator for android. 213 | 214 | # Bluetooth CLI for mac 215 | brew install blueutil 216 | # FOSS text-expander for Mac OS 217 | brew tap espanso/espanso 218 | brew install espanso 219 | # Productivity note-taking app in Markdown 220 | brew install obsidian 221 | # Mac menubar app for meeting 222 | brew install meetingbar 223 | # Media Player for Mac 224 | brew install vlc 225 | # Useful ruler for Mac screen measurements 226 | brew install free-ruler 227 | # Javascript package management 228 | brew install yarn 229 | 230 | # This one seems to fail on GitHub Actions 231 | # https://github.com/ashishb/dotfiles/runs/2258896886 232 | # brew cleanup || true 233 | 234 | # Configure the new version to be default 235 | # Source: https://github.com/mathiasbynens/dotfiles/issues/544#issuecomment-104935642 236 | sudo bash -c 'echo /bin/bash >> /etc/shells' 237 | # This requires password and won't work on Travis CI 238 | # Source: https://docs.travis-ci.com/user/environment-variables/#default-environment-variables 239 | if test ! ${CI:-}; then 240 | chsh -s /bin/bash 241 | fi 242 | 243 | # For re-starting running executable on source file changes 244 | sudo gem install filewatcher 245 | sudo gem install mdl 246 | -------------------------------------------------------------------------------- /setup/setup_new_ubuntu_machine.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | sudo apt-get update 5 | # Install dev tools 6 | # libxss1 is required for Google-chrome 7 | # On Linux, bat is installed as batcat 8 | sudo apt-get -y install ant \ 9 | curl \ 10 | git \ 11 | libxss1 \ 12 | nmap \ 13 | ssh \ 14 | vim \ 15 | whois \ 16 | xsel \ 17 | zip \ 18 | tmux \ 19 | bat \ 20 | fd-find \ 21 | ripgrep \ 22 | golang-go 23 | 24 | # Install latest version of Go - https://github.com/golang/go/wiki/Ubuntu 25 | # sudo add-apt-repository -y ppa:longsleep/golang-backports && sudo apt update && sudo apt -y install golang-go 26 | # Install Python 3.9 27 | sudo add-apt-repository -y ppa:deadsnakes/ppa && sudo apt -y install python3.9 python3-pip 28 | 29 | # For some reason, this fails now 30 | # We don't need Java 8 on Linux right now anyways as I don't use Linux for 31 | # Android development 32 | # http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html 33 | # sudo apt-get -y install oracle-java8-installer # Required for android. 34 | 35 | sudo apt-get -y remove thunderbird # I don't need thunderbird. 36 | sudo pip install --upgrade pip 37 | # Use pip instead of easy_install. 38 | # http://stackoverflow.com/questions/3220404/why-use-pip-over-easy-install 39 | sudo apt-get install google-chrome-stable 40 | 41 | #### Ubuntu specific settings. #### 42 | # Via fixubuntu.com 43 | sudo apt-get remove -y unity-lens-shopping 44 | sudo sh -c 'echo "127.0.0.1 productsearch.ubuntu.com" >> /etc/hosts' 45 | ## Save gnome session on exit. 46 | #command -v dconf 1>/dev/null && 47 | # dconf write /org/gnome/gnome-session/auto-save-session true 1>/dev/null && 48 | ## Don't sent Unity length results to Amazon. 49 | #command -v gsettings 1>/dev/null && 50 | # gsettings set com.canonical.Unity.Lenses remote-content-search none 51 | -------------------------------------------------------------------------------- /setup/solarized_dark.itermcolors.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ansi 0 Color 6 | 7 | Blue Component 8 | 0.19370138645172119 9 | Green Component 10 | 0.15575926005840302 11 | Red Component 12 | 0.0 13 | 14 | Ansi 1 Color 15 | 16 | Blue Component 17 | 0.14145714044570923 18 | Green Component 19 | 0.10840655118227005 20 | Red Component 21 | 0.81926977634429932 22 | 23 | Ansi 10 Color 24 | 25 | Blue Component 26 | 0.38298487663269043 27 | Green Component 28 | 0.35665956139564514 29 | Red Component 30 | 0.27671992778778076 31 | 32 | Ansi 11 Color 33 | 34 | Blue Component 35 | 0.43850564956665039 36 | Green Component 37 | 0.40717673301696777 38 | Red Component 39 | 0.32436618208885193 40 | 41 | Ansi 12 Color 42 | 43 | Blue Component 44 | 0.51685798168182373 45 | Green Component 46 | 0.50962930917739868 47 | Red Component 48 | 0.44058024883270264 49 | 50 | Ansi 13 Color 51 | 52 | Blue Component 53 | 0.72908437252044678 54 | Green Component 55 | 0.33896297216415405 56 | Red Component 57 | 0.34798634052276611 58 | 59 | Ansi 14 Color 60 | 61 | Blue Component 62 | 0.56363654136657715 63 | Green Component 64 | 0.56485837697982788 65 | Red Component 66 | 0.50599193572998047 67 | 68 | Ansi 15 Color 69 | 70 | Blue Component 71 | 0.86405980587005615 72 | Green Component 73 | 0.95794391632080078 74 | Red Component 75 | 0.98943418264389038 76 | 77 | Ansi 2 Color 78 | 79 | Blue Component 80 | 0.020208755508065224 81 | Green Component 82 | 0.54115492105484009 83 | Red Component 84 | 0.44977453351020813 85 | 86 | Ansi 3 Color 87 | 88 | Blue Component 89 | 0.023484811186790466 90 | Green Component 91 | 0.46751424670219421 92 | Red Component 93 | 0.64746475219726562 94 | 95 | Ansi 4 Color 96 | 97 | Blue Component 98 | 0.78231418132781982 99 | Green Component 100 | 0.46265947818756104 101 | Red Component 102 | 0.12754884362220764 103 | 104 | Ansi 5 Color 105 | 106 | Blue Component 107 | 0.43516635894775391 108 | Green Component 109 | 0.10802463442087173 110 | Red Component 111 | 0.77738940715789795 112 | 113 | Ansi 6 Color 114 | 115 | Blue Component 116 | 0.52502274513244629 117 | Green Component 118 | 0.57082360982894897 119 | Red Component 120 | 0.14679534733295441 121 | 122 | Ansi 7 Color 123 | 124 | Blue Component 125 | 0.79781103134155273 126 | Green Component 127 | 0.89001238346099854 128 | Red Component 129 | 0.91611063480377197 130 | 131 | Ansi 8 Color 132 | 133 | Blue Component 134 | 0.15170273184776306 135 | Green Component 136 | 0.11783610284328461 137 | Red Component 138 | 0.0 139 | 140 | Ansi 9 Color 141 | 142 | Blue Component 143 | 0.073530435562133789 144 | Green Component 145 | 0.21325300633907318 146 | Red Component 147 | 0.74176257848739624 148 | 149 | Background Color 150 | 151 | Blue Component 152 | 0.15170273184776306 153 | Green Component 154 | 0.11783610284328461 155 | Red Component 156 | 0.0 157 | 158 | Bold Color 159 | 160 | Blue Component 161 | 0.56363654136657715 162 | Green Component 163 | 0.56485837697982788 164 | Red Component 165 | 0.50599193572998047 166 | 167 | Cursor Color 168 | 169 | Blue Component 170 | 0.51685798168182373 171 | Green Component 172 | 0.50962930917739868 173 | Red Component 174 | 0.44058024883270264 175 | 176 | Cursor Text Color 177 | 178 | Blue Component 179 | 0.19370138645172119 180 | Green Component 181 | 0.15575926005840302 182 | Red Component 183 | 0.0 184 | 185 | Foreground Color 186 | 187 | Blue Component 188 | 0.51685798168182373 189 | Green Component 190 | 0.50962930917739868 191 | Red Component 192 | 0.44058024883270264 193 | 194 | Selected Text Color 195 | 196 | Blue Component 197 | 0.56363654136657715 198 | Green Component 199 | 0.56485837697982788 200 | Red Component 201 | 0.50599193572998047 202 | 203 | Selection Color 204 | 205 | Blue Component 206 | 0.19370138645172119 207 | Green Component 208 | 0.15575926005840302 209 | Red Component 210 | 0.0 211 | 212 | 213 | 214 | -------------------------------------------------------------------------------- /setup_dotfiles.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # Works on both Mac and GNU/Linux. 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | 7 | # Generates colored output. 8 | function special_echo { 9 | echo -e '\E[0;32m'"$1\033[0m" 10 | } 11 | 12 | function error_echo { 13 | echo -e '\E[0;31m'"$1\033[0m" 14 | } 15 | 16 | # This detection only works for mac and linux. 17 | if [ "$(uname)" == "Darwin" ]; then 18 | special_echo "Setting up $HOME/.bashrc" 19 | echo "source $DIR/_bashrc" >> $HOME/.bash_profile 20 | elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then 21 | special_echo "Seeting up $HOME/.bash_profile" 22 | echo "source $DIR/_bashrc" >> $HOME/.bashrc 23 | fi 24 | 25 | special_echo "Overwriting $HOME/.vim" 26 | echo "source $DIR/_vimrc" > $HOME/.vimrc 27 | 28 | # Not working. 29 | echo "Setting $HOME/.vim to link to $DIR/_vim directory" 30 | ln -s $DIR/_vim $HOME/.vim || true 31 | 32 | echo "Overwriting $HOME/.screenrc" 33 | echo "source $DIR/_screenrc" > $HOME/.screenrc 34 | 35 | echo "Overwriting $HOME/.ssh/config" 36 | touch $DIR/_sshconfig 37 | mkdir -p $HOME/.ssh 38 | echo "Include $DIR/_sshconfig" >> ~/.ssh/config 39 | 40 | FILE="$HOME/.inputrc" 41 | echo "Overwriting $FILE" 42 | # https://unix.stackexchange.com/a/179294 43 | echo "\$include $DIR/_inputrc" >> $FILE 44 | 45 | # Disable last two lines which replace https with ssh since it cause Travis CI failures :( 46 | # This is hacky. 47 | if test "${CI:-}"; then 48 | tac $DIR/_gitconfig | tail -n +3 | tac > $DIR/_gitconfig 49 | fi 50 | echo "Including new config file in $HOME/.gitconfig" 51 | echo -e "[include]\n path = $DIR/_gitconfig" > $HOME/.gitconfig 52 | # Disable hgrc, I haven't use mercurial in a long while 53 | # echo "Appending $HOME/.hgrc" 54 | # echo "%include $DIR/_hgrc" >> $HOME/.hgrc 55 | 56 | FILE="$HOME/.gradle/gradle.properties" 57 | echo "Overwriting $FILE" 58 | mkdir -p $HOME/.gradle 59 | ln -s $DIR/gradle.properties $FILE || true 60 | 61 | FILE="$HOME/.config/starship.toml" 62 | echo "Overwriting $FILE" 63 | mkdir -p ~/.config 64 | ln -s $DIR/scripts/starship.toml $FILE 65 | 66 | 67 | echo "Configuring global gitignore file" 68 | git config --global core.excludesfile $DIR/_gitignore 69 | --------------------------------------------------------------------------------