Skip to content

Latest commit

 

History

History
254 lines (241 loc) · 4.79 KB

LOCAL_CONFIG.md

File metadata and controls

254 lines (241 loc) · 4.79 KB

VSCode - Config

Launch

launch.json

{
  "version": "0.2.0",
  "configurations": [
      {
          "name": "(gdb) Launch",
          "type": "cppdbg",
          "request": "launch",
          "program": "${fileDirname}\\currentFile.exe",
          "args": [],
          "stopAtEntry": false,
          "cwd": "${fileDirname}",
          "environment": [],
          "externalConsole": false,
          "MIMode": "gdb",
          "miDebuggerPath": "gdb.exe",
          "setupCommands": [
              {
                  "description": "Enable pretty-printing for gdb",
                  "text": "-enable-pretty-printing",
                  "ignoreFailures": true
              }
          ],
          "preLaunchTask": "C/C++: g++.exe build active file"
      }
  ]
}

Tasks

tasks.json

{
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++.exe build active file",
			"command": "g++.exe",
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\currentFile.exe",
				"-std=c++23"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "Task generated by Debugger."
		}
	],
	"version": "2.0.0"
}

CPP Properties

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64",
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
}

Snippets

Settings (F1) > Snippets: Configure Snippets

cpp.json

{
	"Competitive Programming - Read String Array": {
		"prefix": [
			"readstringarr",
			"stringarrread"
		],
		"body": [
			"vector<string> ${1:a};",
			"for (size_t i = 0; i < ${2:n}; i++)",
			"{",
			"\tstring name;",
			"\tcin >> name;",
			"\t${1:a}.push_back(name);",
			"}",
			"$0"
		],
		"description": "Competitive Programming template."
	},
	"Competitive Programming - Read Int Array": {
		"prefix": [
			"readintarr",
			"intarrread"
		],
		"body": [
			"int ${1:a}[${2:n}];",
			"for (int i = 0; i < ${2:n}; i++)",
			"    cin >> ${1:a}[i];",
			"",
			"$0"
		],
		"description": "Competitive Programming template."
	},
	"Competitive Programming - Read Vector": {
		"prefix": [
			"readvector",
			"vectorread"
		],
		"body": [
			"int x;",
			"vector<int> a;",
			"for (int i = 0; i < n; i++)",
			"{",
			"    cin >> x;",
			"    a.push_back(x);",
			"}",
			"",
			"$0"
		],
		"description": "Competitive Programming template."
	},
	"Competitive Programming - Read Matrix": {
		"prefix": [
			"readmatrix",
			"matrixread"
		],
		"body": [
			"int n, m;",
			"cin >> n >> m;",
			"",
			"string a[n];",
			"for (int i = 0; i < n; i++)",
        	"    cin >> a[i];",
			"",
			"$0"
		],
		"dsdaescription": "Competitive Programming template."
 },
 "Competitive Programming - Main": {
		"prefix": [
			"maincp",
			"cpmain"
		],
		"body": [
			"// ${1}",
			"// DISCLAIMER: This is NOT production-quality code.",
			"#include <bits/stdc++.h>",
			"#define Error {cout<<-1;return 0;}",
			"#define int long long",
			"using namespace std;",
			"",
			"void solve()",
			"{",
			"\tint ans = 0, n;",
			"\tcin >> n;${0}",
			"\t",
			"\tcout << ans << endl;",
			"}",
			"",
			"main()",
			"{",
			"\tios::sync_with_stdio(0);",
			"\tcin.tie(0);",
			"\t",
			"#ifndef ONLINE_JUDGE",
			"\tfreopen(\"input.txt\", \"r\", stdin);",
			"\tfreopen(\"output.txt\", \"w\", stdout);",
			"#endif",
			"\t",
			"\tint TC;",
			"\tcin >> TC;",
			"\twhile (TC--)",
			"\t\tsolve();",
			"}",
		],
		"description": "Competitive Programming (main) template."
	},
	"UVa - Main": {
		"prefix": [
			"mainuva",
			"uvamain"
		],
		"body": [
			"// ${1}",
			"#include <bits/stdc++.h>",
			"using namespace std;",
			"",
			"main()",
			"{",
			"\tint ${2:N}, ${3:k};",
			"\tcin >> ${2:N} >> ${3:k};",
			"\t",
			"\t$0",
			"\t",
			"}"
		],
		"description": "UVa (main) template."
	}
}

Bash Aliases

Update .bashrc file:
code ~/.bashrc

alias ls='ls -F --color --show-control-chars'
alias gs='git status'
alias ga='git add '
alias gaa='git add -A'
commitPush() { git add . && git commit -m "$1" && git push; }
alias gcm=commitPush
alias yolo='gcm "Daily programming practice"'

# Careful! Will remove unpushed commits as well
alias reset='git reset --hard origin/main && git clean -fd'

alias pl='git pull -r'
alias push='git push'
alias go='git checkout'

Then refresh:
source ~/.bashrc