Compare commits
7 Commits
bb6685cfe0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f167a7c89 | |||
| 0380bb18bb | |||
| 862b8b2fb0 | |||
| 82f4df6e98 | |||
| 5933dca536 | |||
| e248b18308 | |||
| 69abe87fa6 |
46
git/add.md
Normal file
46
git/add.md
Normal 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
75
k8s/api-resources.md
Normal 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 |
|
||||||
12
linux/grep.md
Normal file
12
linux/grep.md
Normal 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"`
|
||||||
Reference in New Issue
Block a user