42-Seoul-Cursus / 42cursus

2023-03-13 ~
0 stars 0 forks source link

클러스터 맥 세팅 #1

Open seungwonme opened 1 year ago

seungwonme commented 1 year ago
setting.json

{
    "code-runner.executorMap": {
        "javascript": "node",
        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
        "c": "cd $dir && gcc -Wall -Wextra -Werror $fileName && $dir/a.out",
        "zig": "zig run",
        "cpp": "cd $dir && g++ -Wall -Wextra -Werror $fileName && $dir/a.out",
        "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "php": "php",
        "python": "python -u",
        "perl": "perl",
        "perl6": "perl6",
        "ruby": "ruby",
        "go": "go run",
        "lua": "lua",
        "groovy": "groovy",
        "powershell": "powershell -ExecutionPolicy ByPass -File",
        "bat": "cmd /c",
        "shellscript": "bash",
        "fsharp": "fsi",
        "csharp": "scriptcs",
        "vbscript": "cscript //Nologo",
        "typescript": "ts-node",
        "coffeescript": "coffee",
        "scala": "scala",
        "swift": "swift",
        "julia": "julia",
        "crystal": "crystal",
        "ocaml": "ocaml",
        "r": "Rscript",
        "applescript": "osascript",
        "clojure": "lein exec",
        "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
        "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
        "racket": "racket",
        "scheme": "csi -script",
        "ahk": "autohotkey",
        "autoit": "autoit3",
        "dart": "dart",
        "pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
        "d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
        "haskell": "runghc",
        "nim": "nim compile --verbosity:0 --hints:off --run",
        "lisp": "sbcl --script",
        "kit": "kitc --run",
        "v": "v run",
        "sass": "sass --style expanded",
        "scss": "scss --style expanded",
        "less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
        "FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "sml": "cd $dir && sml $fileName"
    },
    "editor.tokenColorCustomizations": {
        "comments": "#8e8e8e"
    },
    "emmet.variables": {
        "lang": "ko"
    },
    "[c]": {
        "editor.defaultFormatter": "keyhr.42-c-format"
    },
    "[cpp]": {
        "editor.defaultFormatter": "keyhr.42-c-format"
    },
    "[html]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[css]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "prettier.tabWidth": 4,
    "prettier.useTabs": true,
    "code-runner.runInTerminal": true,
    "code-runner.saveFileBeforeRun": true,
    "editor.renderWhitespace": "all",
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "editor.minimap.enabled": false,
    "explorer.sortOrder": "type",
    "editor.insertSpaces": false,
    "lldb.showDisassembly": "never",
    "lldb.launch.cwd": "${fileDirname}",
    "debug.inlineValues": "on",
    "debug.onTaskErrors": "debugAnyway",
    "debug.disassemblyView.showSourceCode": false,
    "hexeditor.columnWidth": 16,
    "hexeditor.showDecodedText": true,
    "hexeditor.defaultEndianness": "little",
    "hexeditor.inspectorType": "aside",
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "git.openRepositoryInParentFolders": "always",
    "explorer.confirmDragAndDrop": false,
    "explorer.confirmDelete": false,
    "extensions.ignoreRecommendations": true,
    "liveServer.settings.donotShowInfoMsg": true,
    "workbench.startupEditor": "none",
    "update.showReleaseNotes": false,
    "workbench.colorTheme": "One Dark Pro Darker",
    "editor.inlineSuggest.enabled": true,
    "security.workspace.trust.untrustedFiles": "open",
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "42header.email": "seunan@student.42seoul.kr",
    "42header.username": "seunan",
    "workbench.activityBar.visible": false,
    "workbench.iconTheme": "material-icon-theme",
    "remoteHub.uncommittedChangesOnEntry": "none",
    "editor.fontFamily": "'D2Coding ligature', 'D2Coding', 'Fira Code', 'Droid Sans Mono', 'monospace', 'Droid Sans Fallback'",
    "editor.fontSize": 14,
    "editor.fontLigatures": true,
}
seungwonme commented 1 year ago

.vscode

// tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "LLDB",                                // launch.json의 preLaunchTask와 일치
            "command": "/usr/bin/gcc",
            "args": [
                "-fdiagnostics-color=always",               // 컴파일러가 출력 메시지에 색상을 추가하여 가독성을 높임
                "-g",                                       // 디버깅 정보를 컴파일된 바이너리에 포함
                "-O0",                                      // 최적화를 끄고 예측 가능한 코드 형태로 컴파일
                "-Wall",                                    // 모든 경고를 출력하여 잠재적인 문제 검사
                "-Wextra",
                "-fsanitize=address",                       // AddressSanitizer를 활성화하여 메모리 오류를 감지
                "-fno-omit-frame-pointer",                  // 프레임 포인터를 생략하지 않고 유지
                "${file}",                                  // 컴파일할 소스 파일의 경로를 지정
                "-o",                                       // 컴파일된 실행 파일의 이름과 경로를 지정
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": ["$gcc"],                     // 컴파일러 오류 및 경고 메시지를 처리하는 방법을 지정
            "group": "build",
            "detail": "compiler: /usr/bin/gcc"
        }
    ]
}
// launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "lldb",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "cwd": "${fileDirname}",
            "preLaunchTask": "LLDB",    // tasks.json의 task label과 일치
        }
    ]
}
// setting.json
{
    "lldb.displayFormat": "auto",
    "lldb.dereferencePointers": true,
    "lldb.consoleMode": "commands",
    "lldb.showDisassembly": "auto"
}
seungwonme commented 1 year ago

snippet


c.json

{
    "c!": {
        "prefix": "c!",
        "body": [
            "#include <stdio.h>",
            "#include <stdlib.h>",
            "#include <string.h>",
            "",
            "int\tmain(void)",
            "{",
            "\t$0",
            "\treturn (0);",
            "}",
        ],
        "description": "make main func"
    },
    "ic": {
        "prefix": "ic",
        "body": [
            "#include $0",
        ],
        "description": "make main func"
    },
    "ret": {
        "prefix": "ret",
        "body": [
            "return ($0);",
        ],
        "description": "return"
    },
    "leak": {
        "prefix": "leak",
        "body": [
            "void\tleak(void)",
            "{",
            "\tsystem(\"leaks $1a.out > leaks_result_temp; cat leaks_result_temp | grep leaked && rm -rf leaks_result_temp\");",
            "}",
            "$2atexit(leak);"
        ],
        "description": "check memory leaks"
    },
    "rm": {
        "prefix": "rm",
        "body": [
            "$0",
            "remove(\"a.out\");",
            "remove(\"tempCodeRunnerFile.c\");",
        ],
        "description": "remove files"
    },
}

cpp.json

{
    "c!": {
        "prefix": "c!",
        "body": [
            "#include <iostream>",
            "#include <string>",
            "#include <vector>",
            "#include <algorithm>",
            "#define int long long",
            "using namespace std;",
            "",
            "unsigned\tmain()",
            "{",
            "\t$0",
            "\treturn (0);",
            "}",
        ],
        "description": "make main func"
    },
    "ret": {
        "prefix": "ret",
        "body": [
            "return ($0);",
        ],
        "description": "return"
    },
    "leak": {
        "prefix": "leak",
        "body": [
            "",
            "void\tleak(void)",
            "{",
            "\tsystem(\"leaks a.out > leaks_result_temp; cat leaks_result_temp | grep leaked && rm -rf leaks_result_temp\");",
            "}",
            "$0atexit(leak);"
        ],
        "description": "check memory leaks"
    },
    "rm": {
        "prefix": "rm",
        "body": [
            "$0",
            "remove(\"a.out\");",
            "remove(\"tempCodeRunnerFile.cpp\");",
        ],
        "description": "remove files"
    },
    "ios": {
        "prefix": "ios",
        "body": [
            "ios::sync_with_stdio(false), cin.tie(nullptr);",
        ],
        "description": "cin/cout에서 입출력으로 인한 시간초과를 막기 위해 (절대 cout, printf를 섞어쓰면 안된다.)"
    },
}
seungwonme commented 1 year ago

keybindings.json

[
    {
        "key": "alt+cmd+up",
        "command": "cursorColumnSelectUp",
        "when": "textInputFocus"
    },
    {
        "key": "alt+cmd+down",
        "command": "cursorColumnSelectDown",
        "when": "textInputFocus"
    },
    {
        "key": "alt+f",
        "command": "notebook.formatCell",
        "when": "editorHasDocumentFormattingProvider && editorTextFocus && inCompositeEditor && notebookEditable && !editorReadonly && activeEditor == 'workbench.editor.notebook'"
    },
    {
        "key": "alt+f",
        "command": "editor.action.formatDocument",
        "when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
    },
    {
        "key": "alt+f",
        "command": "editor.action.formatDocument.none",
        "when": "editorTextFocus && !editorHasDocumentFormattingProvider && !editorReadonly"
    },
    {
        "key": "cmd+m",
        "command": "editor.debug.action.openDisassemblyView"
    },
    {
        "key": "cmd+;",
        "command": "terminal.focus"
    },
    {
        "key": "cmd+;",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+shift+z",
        "command": "workbench.action.toggleActivityBarVisibility"
    },
    {
        "key": "ctrl+shift+p",
        "command": "workbench.view.extension.project-manager"
    },
    {
        "key": "shift+cmd+c",
        "command": "workbench.panel.chatSidebar.copilot"
    },
    {
        "key": "ctrl+cmd+i",
        "command": "-workbench.panel.chatSidebar.copilot"
    },
    {
        "key": "ctrl+shift+t",
        "command": "workbench.action.terminal.openNativeConsole",
        "when": "!terminalFocus"
    },
    {
        "key": "shift+cmd+c",
        "command": "-workbench.action.terminal.openNativeConsole",
        "when": "!terminalFocus"
    },
    {
        "key": "ctrl+shift+f",
        "command": "workbench.view.extension.figma"
    },
]
seungwonme commented 1 year ago

.zshrc


export ZSH="$HOME/.oh-my-zsh"
export PATH="$HOME/goinfre/brew/bin:$PATH"
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
# code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}

ZSH_THEME="robbyrussell"
source $ZSH/oh-my-zsh.sh

plugins=(git)

# 42 Seoul
export MAIL='seunan@student.42seoul.kr'
alias norm='norminette -R CheckForbiddenSourceHeader'
alias francinette='/Users/seunan/francinette/tester.sh' # 클러맥
alias paco='~/francinette/tester.sh'
alias pacos='paco --strict'

# git
alias gcw='gcc -Wall -Wextra -Werror'
alias gcf='gcc -g3 -fsanitize=memory -Wall -Wextra -Werror'
alias gpw='g++ -Wall -Wextra -Werror'
alias gpf='g++ -g3 -fsanitize=memory -Wall -Wextra -Werror'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gsh='git stash'
alias gp='git push'
alias gpl='git pull'
alias gm='git merge'
alias gd='git diff'
alias gl='git log'
alias glo='git log --oneline'
alias gch='git checkout'
alias gsw='git switch'
alias gb='git branch'
alias gig='git config core.ignorecase false'
seungwonme commented 1 year ago

# 42Seoul_Setting.zsh

rm -rf brew

if [[ -d "$HOME/goinfre/42cursus" ]]
then
  echo "- the directory exists. : ~/goinfre/42cursus"
else
  git clone https://github.com/seungwonme/42cursus.git $HOME/goinfre/42cursus
  echo "- the directory added. : ~/goinfre/42cursus"
fi

if [[ -d "$HOME/goinfre/algorithm" ]]
then
  echo "- the directory exists. : ~/goinfre/algorithm"
else
  git clone https://github.com/seungwonme/Algorithm.git $HOME/goinfre/algorithm
  echo "- the directory added. : ~/goinfre/algorithm"
fi

if [[ -d "$HOME/goinfre/til" ]]
then
  echo "- the directory exists. : ~/goinfre/til"
else
  git clone https://github.com/seungwonme/TIL.git $HOME/goinfre/til
  echo "- the directory added. : ~/goinfre/til"
fi

if [[ -d "$HOME/brew" ]]
then
  echo "- the directory exists. : ~/brew"
else
  mkdir brew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C brew
  echo "- the directory added. : ~/brew"
fi

brew update

# 42Seoul_Cache.zsh

rm -rf "/Users/$USER/Library/Caches"
rm -rf "/Users/$USER/Library/Containers/"
rm -rf "/Users/$USER/Library/Application Support/Code/User/workspaceStorage"
rm -rf "/Users/$USER/Library/Application Support/Code/Cache"
rm -rf "/Users/$USER/Library/Application Support/Code/CachedData"
rm -rf "/Users/$USER/Library/Application Support/Code/Code Cache"
rm -rf "/Users/$USER/Library/Application Support/Code/CachedExtensions"
rm -rf "/Users/$USER/Library/Application Support/Code/CachedExtensionVSIXs"
rm -rf "/Users/$USER/Library/Application Support/Slack/Service Worker"
rm -rf "/Users/$USER/Library/Application Support/Slack/Cache"
rm -rf "/Users/$USER/Library/Application Support/Slack/CachedData"
rm -rf "/Users/$USER/Library/Application Support/Slack/Service Worker/CacheStorage"
rm -rf "/Users/$USER/Library/Application Support/Slack/Service Worker/ScriptCache"