Skip to content

Instantly share code, notes, and snippets.

View dotchev's full-sized avatar

Petar Dochev dotchev

View GitHub Profile
@dotchev
dotchev / Linux.md
Last active May 23, 2025 06:38
Linux recipes

Read process env vars (replace 1 with pid)

cat /proc/1/environ | tr '\0' '\n' | sort

Generate a random alphanumeric string (replace 10 with string length)

LC_ALL=C tr -dc 'A-Z0-9' < /dev/urandom | head -c 10
@dotchev
dotchev / settings.json
Created December 3, 2024 09:31
VSCode Settings
{
"files.autoSave": "onFocusChange",
"git.enableSmartCommit": true,
"git.autofetch": true,
"editor.minimap.enabled": false,
"editor.fontSize": 14,
"go.lintTool": "golangci-lint",
"terminal.integrated.scrollback": 100000,
"git.confirmSync": false,
"terminal.integrated.fontSize": 14,
alias gt='go test -race -timeout 20m ./... && echo "All passed! ✅" || echo "Failed! ❌"'

Set current namespace

kubectl config set-context --current --namespace [NAMESPACE_NAME]
@dotchev
dotchev / vscode.jsonc
Last active January 8, 2018 08:08
VS Code User Settings
// Place your settings in this file to overwrite the default settings
{
// Controls the font size.
"editor.fontSize": 14,
// The number of spaces a tab is equal to.
"editor.tabSize": 2,
// Columns at which to show vertical rulers
"editor.rulers": [80],
@dotchev
dotchev / pr
Created September 11, 2017 13:44
Checkout GitHub pull request
function pr { git fetch origin pull/$1/merge && git checkout FETCH_HEAD; }
@dotchev
dotchev / ssh-no-pass.md
Last active September 11, 2017 11:57
ssh without password
@dotchev
dotchev / .eslintrc
Created May 9, 2017 19:57
eslint max line length
{
"rules": {
"max-len": ["error", 35]
}
}
@dotchev
dotchev / random-id.js
Last active October 9, 2018 19:42
Random id
// max len is 10
function randomId(len) {
return Math.random().toString(36).slice(2, 2 + len);
}
You can configure globally (for all projects) which files git should ignore
Just add them to $HOME/.config/git/ignore
For example if you use VS Code, add .vscode there so you don't have to add it to each .gitignore
Source: https://git-scm.com/docs/gitignore