Repository: lewagon/dotfiles Branch: master Commit: 0e5fdfef9de0 Files: 14 Total size: 13.1 KB Directory structure: gitextract_b53l74uj/ ├── LICENSE ├── README.md ├── aliases ├── config ├── git_setup.sh ├── gitconfig ├── install.sh ├── irbrc ├── keybindings.json ├── pryrc ├── rspec ├── settings.json ├── zprofile └── zshrc ================================================ FILE CONTENTS ================================================ ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2023 La Loco SAS, head of Le Wagon Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ This repository is used by [Le Wagon](https://www.lewagon.com) students. ## Toolset - [oh-my-zsh](http://ohmyz.sh/) - [Visual Studio Code](https://code.visualstudio.com/) - [git](https://git-scm.com/) ================================================ FILE: aliases ================================================ # Get External IP / Internet Speed alias myip="curl https://ipinfo.io/json" # or /ip for plain-text ip alias speedtest="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -" # Quickly serve the current directory as HTTP alias serve='ruby -run -e httpd . -p 8000' # Or python -m SimpleHTTPServer :) # NOTE: On Q3 2021, Le Wagon decided to change the Web Dev curriculum default text editor alias stt="echo 'Launching VS Code instead of Sublime Text... (cf ~/.aliases)' && code ." ================================================ FILE: config ================================================ Host * UseKeychain yes AddKeysToAgent yes IdentityFile ~/.ssh/id_ed25519 ================================================ FILE: git_setup.sh ================================================ echo "Type in your first and last name (no accent or special characters - e.g. 'ç'): " read full_name echo "Type in your email address (the one used for your GitHub account): " read email git config --global user.email "$email" git config --global user.name "$full_name" git add . git commit --message "My identity for @lewagon in the gitconfig" git push origin master git remote add upstream git@github.com:lewagon/dotfiles.git echo "👌 Awesome, all set." ================================================ FILE: gitconfig ================================================ [color] branch = auto diff = auto interactive = auto status = auto ui = auto [color "branch"] current = green remote = yellow [core] pager = less -FRSX editor = code --wait [alias] co = checkout st = status -sb br = branch ci = commit fo = fetch origin d = !git --no-pager diff dt = difftool stat = !git --no-pager diff --stat # Set remotes/origin/HEAD -> defaultBranch (copied from https://stackoverflow.com/a/67672350/14870317) remoteSetHead = remote set-head origin --auto # Get default branch name (copied from https://stackoverflow.com/a/67672350/14870317) defaultBranch = !git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4 # Clean merged branches (adapted from https://stackoverflow.com/a/6127884/14870317) sweep = !git branch --merged $(git defaultBranch) | grep -E -v " $(git defaultBranch)$" | xargs -r git branch -d && git remote prune origin # http://www.jukie.net/bart/blog/pimping-out-git-log lg = log --graph --all --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)%an%Creset %C(yellow)%d%Creset' # Serve local repo. http://coderwall.com/p/eybtga # Then other can access via `git clone git://#{YOUR_IP_ADDRESS}/ serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git # Checkout to defaultBranch m = !git checkout $(git defaultBranch) # Removes a file from the index unstage = reset HEAD -- [help] autocorrect = 1 [push] default = simple [branch "master"] mergeoptions = --no-edit [pull] rebase = false [init] defaultBranch = master ================================================ FILE: install.sh ================================================ #!/bin/zsh # Define a function which rename a `target` file to `target.backup` if the file # exists and if it's a 'real' file, ie not a symlink backup() { target=$1 if [ -e "$target" ]; then if [ ! -L "$target" ]; then mv "$target" "$target.backup" echo "-----> Moved your old $target config file to $target.backup" fi fi } symlink() { file=$1 link=$2 if [ ! -e "$link" ]; then echo "-----> Symlinking your new $link" ln -s $file $link fi } # For all files `$name` in the present folder except `*.sh`, `README.md`, `settings.json`, # and `config`, backup the target file located at `~/.$name` and symlink `$name` to `~/.$name` for name in aliases gitconfig irbrc pryrc rspec zprofile zshrc; do if [ ! -d "$name" ]; then target="$HOME/.$name" backup $target symlink $PWD/$name $target fi done # Install zsh-syntax-highlighting plugin CURRENT_DIR=`pwd` ZSH_PLUGINS_DIR="$HOME/.oh-my-zsh/custom/plugins" mkdir -p "$ZSH_PLUGINS_DIR" && cd "$ZSH_PLUGINS_DIR" if [ ! -d "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting" ]; then echo "-----> Installing zsh plugin 'zsh-syntax-highlighting'..." git clone https://github.com/zsh-users/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting fi cd "$CURRENT_DIR" # Symlink VS Code settings and keybindings to the present `settings.json` and `keybindings.json` files # If it's a macOS if [[ `uname` =~ "Darwin" ]]; then CODE_PATH=~/Library/Application\ Support/Code/User # Else, it's a Linux else CODE_PATH=~/.config/Code/User # If this folder doesn't exist, it's a WSL if [ ! -e $CODE_PATH ]; then CODE_PATH=~/.vscode-server/data/Machine fi fi for name in settings.json keybindings.json; do target="$CODE_PATH/$name" backup $target symlink $PWD/$name $target done # Symlink SSH config file to the present `config` file for macOS and add SSH passphrase to the keychain if [[ `uname` =~ "Darwin" ]]; then target=~/.ssh/config backup $target symlink $PWD/config $target ssh-add --apple-use-keychain ~/.ssh/id_ed25519 fi # Refresh the current terminal with the newly installed configuration exec zsh echo "👌 Carry on with git setup!" ================================================ FILE: irbrc ================================================ begin require 'rubygems' require 'pry' rescue LoadError end if defined?(Pry) Pry.start exit end ================================================ FILE: keybindings.json ================================================ // Place your key bindings in this file to override the defaults [ { "key": "ctrl+shift+v", "command": "pasteAndIndent.action", "when": "editorTextFocus && !editorReadonly" }, { "key": "cmd+shift+v", "command": "pasteAndIndent.action", "when": "editorTextFocus && !editorReadonly" } ] ================================================ FILE: pryrc ================================================ # https://github.com/pry/pry/tree/master/lib/pry if defined?(Rails) short_env_name_options = { 'development' => 'dev', 'production' => 'prod' } app_name = Rails.application.class.module_parent_name.underscore.dasherize env_name = short_env_name_options.fetch(Rails.env) { Rails.env } description = 'Prompt has to match the rails app name' else current_directory = Dir.pwd.split('/').last.to_s description = 'Prompt has to match the current directory name' end # https://github.com/pry/pry/blob/master/lib/pry/prompt.rb Pry::Prompt.add(:current_app) do |context, nesting, pry_instance, sep| format( '[%s] %s(%s)%s%s ', in_count: pry_instance.input_ring.count, current_app: app_name || current_directory, context: env_name || Pry.view_clip(context), nesting: (nesting > 0 ? ":#{nesting}" : ''), separator: sep ) end prompt = Pry::Prompt[:current_app] procs = [ proc { |*args| prompt.wait_proc.call(*args).to_s }, proc { |*args| prompt.incomplete_proc.call(*args).to_s } ] Pry.config.prompt = Pry::Prompt.new( 'custom_app_prompt', description, procs ) ================================================ FILE: rspec ================================================ --color --format documentation ================================================ FILE: settings.json ================================================ { "[python]": { "editor.bracketPairColorization.enabled": false, "editor.guides.bracketPairs": false, "editor.tabSize": 4 }, "editor.bracketPairColorization.enabled": true, "editor.detectIndentation": false, "editor.fontSize": 14, "editor.guides.bracketPairs": true, "editor.minimap.enabled": false, "editor.multiCursorModifier": "ctrlCmd", "editor.renderControlCharacters": true, "editor.rulers": [ 80, 120 ], "editor.showFoldingControls": "always", "editor.snippetSuggestions": "top", "editor.tabSize": 2, "emmet.includeLanguages": { "erb": "html" }, "emmet.showSuggestionsAsSnippets": true, "emmet.triggerExpansionOnTab": true, "explorer.confirmDelete": false, "files.exclude": { "__pycache__": true, "_site": true, ".asset-cache": true, ".bundle": true, ".ipynb_checkpoints": true, ".pytest_cache": true, ".sass-cache": true, ".svn": true, "**/.DS_Store": true, "**/.egg-info": true, "**/.git": true, "build": true, "coverage": true, "dist": true, "log": true, "node_modules": true, "public/packs": true, "tmp": true }, "files.hotExit": "off", "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, "files.watcherExclude": { "**/audits/**": true, "**/coverage/**": true, "**/log/**": true, "**/node_modules/**": true, "**/tmp/**": true, "**/vendor/**": true }, "git.enabled": false, "notebook.diff.ignoreMetadata": true, "notebook.lineNumbers": "on", "notebook.markup.fontSize": 13, "python.defaultInterpreterPath": "~/.pyenv/shims/python", "python.formatting.provider": "yapf", "python.languageServer": "Pylance", "python.linting.enabled": false, "python.linting.flake8Enabled": false, "python.linting.pylintEnabled": false, "python.terminal.activateEnvironment": false, "ruby.lint": { "rubocop": true }, "search.exclude": { // Inherits all glob patterns from the `files.exclude` setting. "**/.venv": true }, "telemetry.telemetryLevel": "off", "window.restoreWindows": "none", "window.newWindowDimensions": "maximized", "workbench.editor.enablePreview": true, "workbench.iconTheme": "vscode-great-icons", "workbench.settings.editor": "json", "workbench.settings.openDefaultSettings": true, "workbench.settings.useSplitJSON": true, "workbench.startupEditor": "newUntitledFile", "workbench.panel.defaultLocation": "right", } ================================================ FILE: zprofile ================================================ # Setup the PATH for pyenv binaries and shims export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(/opt/homebrew/bin/brew shellenv 2> /dev/null)" type -a pyenv > /dev/null && eval "$(pyenv init --path)" ================================================ FILE: zshrc ================================================ ZSH=$HOME/.oh-my-zsh # You can change the theme with another one from https://github.com/robbyrussell/oh-my-zsh/wiki/themes ZSH_THEME="robbyrussell" # Useful oh-my-zsh plugins for Le Wagon bootcamps plugins=(git gitfast last-working-dir common-aliases zsh-syntax-highlighting history-substring-search) # (macOS-only) Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/docs/Analytics.md export HOMEBREW_NO_ANALYTICS=1 # Disable warning about insecure completion-dependent directories ZSH_DISABLE_COMPFIX=true # Actually load Oh-My-Zsh source "${ZSH}/oh-my-zsh.sh" unalias rm # No interactive rm by default (brought by plugins/common-aliases) unalias lt # we need `lt` for https://github.com/localtunnel/localtunnel # Load rbenv if installed (to manage your Ruby versions) export PATH="${HOME}/.rbenv/bin:${PATH}" # Needed for Linux/WSL type -a rbenv > /dev/null && eval "$(rbenv init -)" # Load pyenv (to manage your Python versions) export PYENV_VIRTUALENV_DISABLE_PROMPT=1 type -a pyenv > /dev/null && eval "$(pyenv init -)" && eval "$(pyenv virtualenv-init - 2> /dev/null)" && RPROMPT+='[🐍 $(pyenv version-name)]' # Load nvm (to manage your node versions) export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Call `nvm use` automatically in a directory with a `.nvmrc` file autoload -U add-zsh-hook load-nvmrc() { if nvm -v &> /dev/null; then local node_version="$(nvm version)" local nvmrc_path="$(nvm_find_nvmrc)" if [ -n "$nvmrc_path" ]; then local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") if [ "$nvmrc_node_version" = "N/A" ]; then nvm install elif [ "$nvmrc_node_version" != "$node_version" ]; then nvm use --silent fi elif [ "$node_version" != "$(nvm version default)" ]; then nvm use default --silent fi fi } type -a nvm > /dev/null && add-zsh-hook chpwd load-nvmrc type -a nvm > /dev/null && load-nvmrc # Rails and Ruby uses the local `bin` folder to store binstubs. # So instead of running `bin/rails` like the doc says, just run `rails` # Same for `./node_modules/.bin` and nodejs export PATH="./bin:./node_modules/.bin:${PATH}:/usr/local/sbin" # Store your own aliases in the ~/.aliases file and load the here. [[ -f "$HOME/.aliases" ]] && source "$HOME/.aliases" # Encoding stuff for the terminal export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 export BUNDLER_EDITOR=code export EDITOR=code # Set ipdb as the default Python debugger export PYTHONBREAKPOINT=ipdb.set_trace