Compare commits

...

10 Commits

Author SHA1 Message Date
5f167a7c89 update add -p 2026-05-14 20:04:01 +03:00
0380bb18bb correct add -e 2026-05-14 20:02:01 +03:00
862b8b2fb0 add grep 2026-05-01 23:44:02 +03:00
82f4df6e98 add k8s 2026-04-22 09:14:17 +03:00
5933dca536 correct adding flow usage 2026-04-17 23:06:49 +03:00
e248b18308 add subtitle for git add -p 2026-04-17 22:47:02 +03:00
69abe87fa6 add git + add.md 2026-04-17 22:45:30 +03:00
bb6685cfe0 Add .gitignore 2026-03-28 12:04:27 +03:00
edb4efa502 Add cmds in session 2026-03-28 12:04:06 +03:00
6abe7526e2 md formatting for cmds 2026-03-28 12:02:50 +03:00
6 changed files with 158 additions and 22 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.WIP

46
git/add.md Normal file
View File

@@ -0,0 +1,46 @@
# Git Add Methods
## Git Add Lines
### `git add -e`
Select lines of changes interactively. This allows you to stage only specific lines of changes in a file.\
Pros: More control over what gets staged.
Cons: More manual work, you have to edit the patch file yourself, which can be error-prone and time-consuming.
#### Guidelines:
- The editor shows a unified diff patch of working tree changes.
- `+` lines: additions in the working tree (will be staged if kept).
- `-` lines: deletions in the working tree (will be staged if kept).
- Context lines (no prefix): unchanged lines needed for patch context.
- To stage an addition: keep the `+` line in the patch.
- To NOT stage an addition: **delete** the `+` line from the patch.
- To stage a deletion: keep the `-` line in the patch.
- To NOT stage a deletion: **convert the `-` to a space**.
- For modified content (shown with `-` lines followed by `+` lines):
- To NOT stage the modification: convert the `-` lines to spaces and remove the `+` lines.
- Note: modifying only half of the pair may cause confusing changes to the index.
- To keep a line unchanged: leave context lines as-is.
- If you want to decline the operation entirely, delete all lines of the patch.
- If you break the patch, run `git checkout -- <file>` to undo, then run `git add -e` again.
## Git Add Hunks
### `git add -p`
Select hunks of changes interactively. This allows you to stage only parts of the changes in a file.\
Pros: Easier to use than the -e method for staging specific parts of changes.\
Cons: Sometimes split won't work, which will force you to use the -e method.
#### Guidelines
- Run `git add -p <file>` or `git add -p` to go through patch hunks interactively.
- For each hunk, choose:
- `y` to stage the hunk
- `n` to not stage the hunk
- `q` to quit; do not stage the hunk or any remaining ones
- `a` to stage the hunk and all later hunks in the file
- `d` to not stage the hunk or any later hunks in the file
- `g` to select a hunk to go to
- `/` to search for a hunk matching the given regex
- `j` to go to the next hunk
- `J` to go to the previous hunk
- `k` to go to the previous hunk
- `K` to go to the previous undecided hunk
- `s` to split the current hunk into smaller ones
- `e` to manually edit the current hunk
- `?` to print help
- If you choose `s`, Git will attempt to split the hunk into smaller hunks so you can stage a smaller section.
- If you choose `e`, Git opens the patch in a temporary editor; delete `+` lines you do NOT want staged and convert `-` lines to spaces to prevent staging their deletion, then save and close.
- When finished, run `git status` to verify which hunks were staged.

75
k8s/api-resources.md Normal file
View File

@@ -0,0 +1,75 @@
# Kubernetes API Resources
| NAME | SHORTNAMES | APIVERSION | NAMESPACED | KIND |
|------|------------|------------|------------|------|
| bindings | | v1 | true | Binding |
| componentstatuses | cs | v1 | false | ComponentStatus |
| configmaps | cm | v1 | true | ConfigMap |
| endpoints | ep | v1 | true | Endpoints |
| events | ev | v1 | true | Event |
| limitranges | limits | v1 | true | LimitRange |
| namespaces | ns | v1 | false | Namespace |
| nodes | no | v1 | false | Node |
| persistentvolumeclaims | pvc | v1 | true | PersistentVolumeClaim |
| persistentvolumes | pv | v1 | false | PersistentVolume |
| pods | po | v1 | true | Pod |
| podtemplates | | v1 | true | PodTemplate |
| replicationcontrollers | rc | v1 | true | ReplicationController |
| resourcequotas | quota | v1 | true | ResourceQuota |
| secrets | | v1 | true | Secret |
| serviceaccounts | sa | v1 | true | ServiceAccount |
| services | svc | v1 | true | Service |
| mutatingwebhookconfigurations | | admissionregistration.k8s.io/v1 | false | MutatingWebhookConfiguration |
| validatingadmissionpolicies | | admissionregistration.k8s.io/v1 | false | ValidatingAdmissionPolicy |
| validatingadmissionpolicybindings | | admissionregistration.k8s.io/v1 | false | ValidatingAdmissionPolicyBinding |
| validatingwebhookconfigurations | | admissionregistration.k8s.io/v1 | false | ValidatingWebhookConfiguration |
| customresourcedefinitions | crd,crds | apiextensions.k8s.io/v1 | false | CustomResourceDefinition |
| apiservices | | apiregistration.k8s.io/v1 | false | APIService |
| controllerrevisions | | apps/v1 | true | ControllerRevision |
| daemonsets | ds | apps/v1 | true | DaemonSet |
| deployments | deploy | apps/v1 | true | Deployment |
| replicasets | rs | apps/v1 | true | ReplicaSet |
| statefulsets | sts | apps/v1 | true | StatefulSet |
| selfsubjectreviews | | authentication.k8s.io/v1 | false | SelfSubjectReview |
| tokenreviews | | authentication.k8s.io/v1 | false | TokenReview |
| localsubjectaccessreviews | | authorization.k8s.io/v1 | true | LocalSubjectAccessReview |
| selfsubjectaccessreviews | | authorization.k8s.io/v1 | false | SelfSubjectAccessReview |
| selfsubjectrulesreviews | | authorization.k8s.io/v1 | false | SelfSubjectRulesReview |
| subjectaccessreviews | | authorization.k8s.io/v1 | false | SubjectAccessReview |
| horizontalpodautoscalers | hpa | autoscaling/v2 | true | HorizontalPodAutoscaler |
| cronjobs | cj | batch/v1 | true | CronJob |
| jobs | | batch/v1 | true | Job |
| certificatesigningrequests | csr | certificates.k8s.io/v1 | false | CertificateSigningRequest |
| leases | | coordination.k8s.io/v1 | true | Lease |
| endpointslices | | discovery.k8s.io/v1 | true | EndpointSlice |
| events | ev | events.k8s.io/v1 | true | Event |
| flowschemas | | flowcontrol.apiserver.k8s.io/v1 | false | FlowSchema |
| prioritylevelconfigurations | | flowcontrol.apiserver.k8s.io/v1 | false | PriorityLevelConfiguration |
| helmchartconfigs | | helm.cattle.io/v1 | true | HelmChartConfig |
| helmcharts | | helm.cattle.io/v1 | true | HelmChart |
| addons | | k3s.cattle.io/v1 | true | Addon |
| etcdsnapshotfiles | | k3s.cattle.io/v1 | false | ETCDSnapshotFile |
| nodes | | metrics.k8s.io/v1beta1 | false | NodeMetrics |
| pods | | metrics.k8s.io/v1beta1 | true | PodMetrics |
| ingressclasses | | networking.k8s.io/v1 | false | IngressClass |
| ingresses | ing | networking.k8s.io/v1 | true | Ingress |
| ipaddresses | ip | networking.k8s.io/v1 | false | IPAddress |
| networkpolicies | netpol | networking.k8s.io/v1 | true | NetworkPolicy |
| servicecidrs | | networking.k8s.io/v1 | false | ServiceCIDR |
| runtimeclasses | | node.k8s.io/v1 | false | RuntimeClass |
| poddisruptionbudgets | pdb | policy/v1 | true | PodDisruptionBudget |
| clusterrolebindings | | rbac.authorization.k8s.io/v1 | false | ClusterRoleBinding |
| clusterroles | | rbac.authorization.k8s.io/v1 | false | ClusterRole |
| rolebindings | | rbac.authorization.k8s.io/v1 | true | RoleBinding |
| roles | | rbac.authorization.k8s.io/v1 | true | Role |
| deviceclasses | | resource.k8s.io/v1 | false | DeviceClass |
| resourceclaims | | resource.k8s.io/v1 | true | ResourceClaim |
| resourceclaimtemplates | | resource.k8s.io/v1 | true | ResourceClaimTemplate |
| resourceslices | | resource.k8s.io/v1 | false | ResourceSlice |
| priorityclasses | pc | scheduling.k8s.io/v1 | false | PriorityClass |
| csidrivers | | storage.k8s.io/v1 | false | CSIDriver |
| csinodes | | storage.k8s.io/v1 | false | CSINode |
| csistoragecapacities | | storage.k8s.io/v1 | true | CSIStorageCapacity |
| storageclasses | sc | storage.k8s.io/v1 | false | StorageClass |
| volumeattachments | | storage.k8s.io/v1 | false | VolumeAttachment |
| volumeattributesclasses | vac | storage.k8s.io/v1 | false | VolumeAttributesClass |

View File

@@ -1,32 +1,32 @@
# Dotfiles Management # Dotfiles Management
## Create new bare repo ## Create new bare repo
### 1. Initialize a bare repo in your home directory ### 1. Initialize a bare repo in your home directory
git init --bare $HOME/.dotfiles `git init --bare $HOME/.dotfiles`
### 2. Create an alias (add this to your .bashrc / .zshrc) ### 2. Create an alias (add this to your .bashrc / .zshrc)
alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' `alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'`
### 3. Hide untracked files (so 'config status' isn't noisy) ### 3. Hide untracked files (so 'config status' isn't noisy)
config config --local status.showUntrackedFiles no `config config --local status.showUntrackedFiles no`
### 4. Start tracking files ### 4. Start tracking files
config add ~/.config/nvim/init.lua `config add ~/.config/nvim/init.lua`
config add ~/.config/alacritty/alacritty.toml `config add ~/.config/alacritty/alacritty.toml`
config commit -m "Add nvim and alacritty config" `config commit -m "Add nvim and alacritty config"`
config push `config push`
## Clone to a new machine ## Clone to a new machine
### Clone repo ### Clone repo
git clone --bare https://github.com/you/dotfiles.git $HOME/.dotfiles `git clone --bare https://github.com/you/dotfiles.git $HOME/.dotfiles`
### Set up the alias again, then checkout ### Set up the alias again, then checkout
alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME' `alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'`
config checkout `config checkout`
### If there are conflicts with existing files, back them up first ### If there are conflicts with existing files, back them up first
mkdir -p ~/.config-backup && \ `mkdir -p ~/.config-backup && \`
config checkout 2>&1 | grep "\s\+\." | awk '{print $1}' | \ `config checkout 2>&1 | grep "\s\+\." | awk '{print $1}' | \`
xargs -I{} mv {} ~/.config-backup/{} `xargs -I{} mv {} ~/.config-backup/{}`
``` ```
## Key Principles ## Key Principles

12
linux/grep.md Normal file
View File

@@ -0,0 +1,12 @@
# Useful grep arguments
## Search without case sensitivity
`cat file.txt | grep -i "pattern"`
## Add lines to match pattern
### Before
`cat file.txt | grep -B 3 "pattern"`
### After
`cat file.txt | grep -A 3 "pattern"`
### Both
`cat file.txt | grep -C 3 "pattern"`
## Show line numbers with matches
`cat file.txt | grep -n "pattern"`

View File

@@ -1,21 +1,23 @@
# tmux Shortcuts # tmux Shortcuts
## tmux Commands Inside a Session
`C-b :`
## Session management ## Session management
### Detach session ### Detach Session
`C-b d` `C-b d`
### List sessions ### List Sessions
`C-b s` `C-b s`
### Rename session ### Rename Session
`C-b $` `C-b $`
## Panes ## Panes
### Vertical split ### Vertical Split
`C-b %` `C-b %`
### Horizontal split ### Horizontal Split
`C-b "` `C-b "`
### Switch panes ### Switch Panes
`C-b r-arrow` `C-b r-arrow`
`C-b l-arrow` `C-b l-arrow`
## Text manipulation ## Text Manipulation
### tmux Copy mode ### tmux Copy Mode
`C-b [` `C-b [`
### tmux Paste mode ### tmux Paste Mode
`C-b ]` `C-b ]`