Skip to content

Instantly share code, notes, and snippets.

@Luxcium
Last active September 22, 2019 22:07
Show Gist options
  • Save Luxcium/9ce00ab3225184172baa75470bb65682 to your computer and use it in GitHub Desktop.
Save Luxcium/9ce00ab3225184172baa75470bb65682 to your computer and use it in GitHub Desktop.
Generate a folder with VSCode for macOS portable edition when run in an empty folder with internet connection
#!/usr/bin/env /bin/sh
rm -f .DS_Store
this_file="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
in_this_folder="$(ls -A ./)"
if [ -z "$in_this_folder" ] || [ "$this_file" = "$in_this_folder" ]; then
echo ""
echo "πŸ§žβ€β™€οΈ"
echo 'please wait:'
else
sleep 1
echo "$this_file != $in_this_folder"
echo "ERROR: Not Empty!"
echo "Please run this script in an empty folder."
exit
fi
echo ""
echo "⏱ . . ."
echo 'it will take few minutes'
echo 'tmp' > .gitignore
echo 'cache' >> .gitignore
echo 'Cache' >> .gitignore
echo 'CachedData' >> .gitignore
echo 'GpuCache' >> .gitignore
echo 'node_modules' >> .gitignore
echo 'machineid' >> .gitignore
echo ""
echo "πŸ”¨ . . ."
git init
git add .
git commit -qm "first commit visual studio code tribes -- Scientia is lux principiumβœ¨β„’"
echo ""
echo "πŸ”§ . . ."
# echo "πŸ§šπŸ»β€β™€οΈ"
# echo "πŸ§œπŸΏβ€β™‚οΈ"
# echo ""
# echo ""
# echo "πŸ§šπŸ½β€β™‚οΈ"
mkdir -p code-portable-data/tmp && \
echo 'dowloading VSCode-darwin-stable.zip . . . ' && \
curl -LsS https://vscode-update.azurewebsites.net/latest/darwin/stable > code-portable-data/tmp/VSCode-darwin-stable.zip && \
echo 'uziping VSCode-darwin-stable.zip . . . ' && \
unzip -q code-portable-data/tmp/VSCode-darwin-stable.zip && \
echo 'successful uziping of VSCode-darwin-stable.zip' && \
rm code-portable-data/tmp/VSCode-darwin-stable.zip && \
mv Visual\ Studio\ Code.app VisualStudioCode.app && \
echo ""
echo "⛏ . . ."
git add .
git commit -qm "download vscode completed"
# echo ""
# echo "πŸ§šπŸ½β€β™‚οΈ"
# echo ""
xattr -dr com.apple.quarantine VisualStudioCode.app
sleep 2
git add .
git commit -m "xattr -dr com.apple.quarantine"
echo ""
echo "πŸ›  . . ."
mkdir -p code-portable-data/user-data/User/
echo "configuration modificaiton in ./code-portable-data/user-data/..."
echo "{" >"code-portable-data/user-data/User/settings.json";
echo " \"workbench.colorTheme\": \"Pop N' Lock Theme by Luxcium ✨\"," >>"code-portable-data/user-data/User/settings.json";
echo " \"workbench.iconTheme\": \"material-icon-theme\"," >>"code-portable-data/user-data/User/settings.json";
echo " \"workbench.editor.highlightModifiedTabs\": true," >>"code-portable-data/user-data/User/settings.json";
echo " \"editor.showUnused\": true," >>"code-portable-data/user-data/User/settings.json";
echo " \"window.title\": \"\${dirty}\${activeEditorMedium}\${separator}\${rootName}\"," >>"code-portable-data/user-data/User/settings.json";
echo " \"editor.cursorBlinking\": \"phase\",">>"code-portable-data/user-data/User/settings.json";
echo " \"editor.cursorSmoothCaretAnimation\": true,">>"code-portable-data/user-data/User/settings.json";
echo " \"editor.cursorStyle\": \"line\",">>"code-portable-data/user-data/User/settings.json";
echo " \"editor.renderControlCharacters\": true,">>"code-portable-data/user-data/User/settings.json";
echo " \"editor.renderWhitespace\": \"boundary\",">>"code-portable-data/user-data/User/settings.json";
echo " \"editor.rulers\": [">>"code-portable-data/user-data/User/settings.json";
echo " 80,">>"code-portable-data/user-data/User/settings.json";
echo " 120,">>"code-portable-data/user-data/User/settings.json";
echo " 121">>"code-portable-data/user-data/User/settings.json";
echo " ],">>"code-portable-data/user-data/User/settings.json";
echo " \"telemetry.enableCrashReporter\": false,">>"code-portable-data/user-data/User/settings.json";
echo " \"telemetry.enableTelemetry\": false,">>"code-portable-data/user-data/User/settings.json";
echo "}" >>"code-portable-data/user-data/User/settings.json";
echo ""
echo " ✨ . . .\nUser/settings.json -> workbench.colorTheme: Pop N Lock Theme by Luxcium ✨,"
echo " ✨ . . .\nUser/settings.json -> workbench.iconTheme: material-icon-theme,"
echo " ✨ . . .\nUser/settings.json -> workbench.editor.highlightModifiedTabs: true,"
echo " ✨ . . .\nUser/settings.json -> editor.showUnused: true,"
echo " ✨ . . .\nUser/settings.json -> window.title: \${dirty}\${activeEditorMedium}\${separator}\${rootName},"
echo " ✨ . . .\nUser/settings.json -> editor.cursorBlinking: phase,"
echo " ✨ . . .\nUser/settings.json -> editor.cursorSmoothCaretAnimation: true,"
echo " ✨ . . .\nUser/settings.json -> editor.cursorStyle: line,"
echo " ✨ . . .\nUser/settings.json -> editor.renderControlCharacters: true,"
echo " ✨ . . .\nUser/settings.json -> editor.renderWhitespace: boundary,"
echo " ✨ . . .\nUser/settings.json -> editor.rulers: [80,120,121],"
echo " ✨ . . .\nUser/settings.json -> telemetry.enableCrashReporter: false,"
echo " ✨ . . .\nUser/settings.json -> telemetry.enableTelemetry: false,"
echo ""
git add .
git commit -qm "ready includes modif. to settings.json"
# ./VisualStudioCode.app/Contents/Resources/app/bin/code --install-extension && \
# ./VisualStudioCode.app/Contents/Resources/app/bin/code --enable-proposed-api && \
echo ""
echo "πŸ“¦ πŸ“• . . ."
./VisualStudioCode.app/Contents/Resources/app/bin/code --install-extension ms-vscode.typescript-javascript-grammar && \
./VisualStudioCode.app/Contents/Resources/app/bin/code --enable-proposed-api ms-vscode.typescript-javascript-grammar
echo ""
echo "πŸ“¦ 🐲 . . ."
./VisualStudioCode.app/Contents/Resources/app/bin/code --install-extension luxcium.pop-n-lock-theme-vscode&& \
./VisualStudioCode.app/Contents/Resources/app/bin/code --enable-proposed-api luxcium.pop-n-lock-theme-vscode
git add .
git commit -qm "ready for first start after install-extension"
echo ""
echo "πŸ§žβ€β™‚οΈ"
echo ""
echo 'starting VisualStudioCode.app for the first time'
./VisualStudioCode.app/Contents/Resources/app/bin/code -v
./VisualStudioCode.app/Contents/Resources/app/bin/code
sleep 30
git add .
git commit -qm "first start"
# Visual Studio Code 1.38.1
#
# Usage: code [options][paths...]
#
# To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')
#
# Options
# -d --diff <file> <file> Compare two files with each other.
# -a --add <folder> Add folder(s) to the last active window.
# -g --goto <file:line[:character]> Open a file at the path on the specified line and character position.
# -n --new-window Force to open a new window.
# -r --reuse-window Force to open a file or folder in an already opened window.
# -w --wait Wait for the files to be closed before returning.
# --locale <locale> The locale to use (e.g. en-US or zh-TW).
# --user-data-dir <dir> Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.
# -v --version Print version.
# -h --help Print usage.
# --telemetry Shows all telemetry events which VS code collects.
# --folder-uri <uri> Opens a window with given folder uri(s)
# --file-uri <uri> Opens a window with given file uri(s)
#
# Extensions Management
# --extensions-dir <dir> Set the root path for extensions.
# --list-extensions List the installed extensions.
# --show-versions Show versions of installed extensions, when using --list-extension.
# --category Filters installed extensions by provided category, when using --list-extension.
# --install-extension <extension-id | path-to-vsix> Installs or updates the extension. Use `--force` argument to avoid prompts.
# --uninstall-extension <extension-id> Uninstalls an extension.
# --enable-proposed-api <extension-id> Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.
#
# Troubleshooting
# --verbose Print verbose output (implies --wait).
# --log <level> Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.
# -s --status Print process usage and diagnostics information.
# --prof-startup Run CPU profiler during startup
# --disable-extensions Disable all installed extensions.
# --disable-extension <extension-id> Disable an extension.
# --inspect-extensions <port> Allow debugging and profiling of extensions. Check the developer tools for the connection URI.
# --inspect-brk-extensions <port> Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.
# --disable-gpu Disable GPU hardware acceleration.
# --max-memory Max memory size for a window (in Mbytes).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment