Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Docusaurus v3 #12

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: lts/*
cache: yarn

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: lts/*
cache: yarn

- name: Install dependencies
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ Feel free to open an [issue](https://github.com/difranca/difranca.github.io/issu
This is highly inspired by the following projects:

- [learning-notes.mistermicheels.com](https://learning-notes.mistermicheels.com)
- [cheatsheet.dennyzhang.com](https://cheatsheet.dennyzhang.com)
- [github.com/keyvanakbary/learning-notes](https://github.com/keyvanakbary/learning-notes)

## Running Locally

To preview changes as soon as a file is edited, you can run a local development server:

```bash
yarn install
yarn start
```

## License Summary

[![ccbysa4](https://img.shields.io/badge/License-CC%20BY--SA-lightgrey?style=flat-square&logo=creativecommons&&logoColor=white)](https://creativecommons.org/licenses/by-sa/4.0/) [![mit](https://img.shields.io/badge/License-MIT-red?style=flat-square)](https://mit-license.org)
Expand Down
4 changes: 2 additions & 2 deletions docs/tech/cheats.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ slug: /cheats
keywords: [cheat, sheet, cheatsheet]
---

# DevSecOps
# Cheat Sheets

Practices that combines software development, security and operations.
Reference guides for command-line interfaces.

import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
Expand Down
52 changes: 26 additions & 26 deletions docs/tech/cheats/DevSecOps/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Configure Git across all local repositories.

| Command | Description |
| ------- | ----------- |
|**git config --global user.name {name}**|Set global Git user name|
|**git config --global user.email {email}**|Set global Git user email|
|**git config --global user.name \{name\}**|Set global Git user name|
|**git config --global user.email \{email\}**|Set global Git user email|
|**git config --global color.ui auto**|Set automatic Git CLI coloring|

<br/>
Expand All @@ -41,8 +41,8 @@ Initialize and clone repositories.
| Command | Description |
| ------- | ----------- |
|**git init**|Initialize a Git repository|
|**git clone {repository}**|Clone a Git repository default branch to current directory|
|**git clone -b {branch_name} {repository} {clone_directory}**|Clone a Git repository branch|
|**git clone \{repository\}**|Clone a Git repository default branch to current directory|
|**git clone -b \{branch_name\} \{repository\} \{clone_directory\}**|Clone a Git repository branch|
|**git rev-parse --show-toplevel**|Get local repository top level directory|

<br/>
Expand All @@ -55,13 +55,13 @@ Work with stage and unstaged changes.
| ------- | ----------- |
|**git status**|Show modified and staged files|
|**git add .**|Stage all files|
|**git add {file}**|Stage a file|
|**git reset {file}**|Unstage a file|
|**git add \{file\}**|Stage a file|
|**git reset \{file\}**|Unstage a file|
|**git reset .**|Unstage all files|
|**git diff**|Show diff of unstaged files|
|**git diff --staged**|Show diff of staged files|
|**git commit -m {message}**|Commit staged changes|
|**git commit --date="{date}" -m "{message}"**|Commit staged changes modifying the author date|
|**git commit -m \{message\}**|Commit staged changes|
|**git commit --date="\{date\}" -m "\{message\}"**|Commit staged changes modifying the author date|

<br/>

Expand All @@ -72,8 +72,8 @@ Work with branches
| Command | Description |
| ------- | ----------- |
|**git branch**|List branches|
|**git branch {name}**|Create a new branch at the current commit|
|**git checkout {branch}**|Switch to another branch|
|**git branch \{name\}**|Create a new branch at the current commit|
|**git checkout \{branch\}**|Switch to another branch|

<br/>

Expand All @@ -84,9 +84,9 @@ View logs and diffs in branches.
| Command | Description |
| ------- | ----------- |
|**git log**|Show commit history for active branch|
|**git log {branch}..{second_branch}**|Show commits on first branch that are not on the second one|
|**git log --follow {file}**|Show the commits that changed a file|
|**git show {commit_sha}**|Show a commit object details|
|**git log \{branch\}..\{second_branch\}**|Show commits on first branch that are not on the second one|
|**git log --follow \{file\}**|Show the commits that changed a file|
|**git show \{commit_sha\}**|Show a commit object details|

<br/>

Expand All @@ -97,16 +97,16 @@ Retrieve updates from repositories and push changes.
| Command | Description |
| ------- | ----------- |
|**git remote -v**|View all remote for a Git repository|
|**git remote add {name} {url}**|Add a remote for a Git repository|
|**git remote rename {remote_name} {new_name}**|Renames a remote for a Git repository|
|**git remote remove {remote_name}**|Remove a remote for a git repository|
|**git fetch {remote_name}**|Fetch all branches from Git remote|
|**git remote add \{name\} \{url\}**|Add a remote for a Git repository|
|**git remote rename \{remote_name\} \{new_name\}**|Renames a remote for a Git repository|
|**git remote remove \{remote_name\}**|Remove a remote for a git repository|
|**git fetch \{remote_name\}**|Fetch all branches from Git remote|
|**git pull**|Pull commits from remote|
|**git merge {branch}**|Merge specified branch into current branch|
|**git merge \{branch\}**|Merge specified branch into current branch|
|**git merge --abort**|Rollback to pre-merge state|
|**git push**|Push active branch commits to remote|
|**git push -u {remote_name} {current_branch}**|Push local branch commits that does not have upstream to remote|
|**git push {remote_name} {current_branch}:{branch}**|Push local branch commits to another branch|
|**git push -u \{remote_name\} \{current_branch\}**|Push local branch commits that does not have upstream to remote|
|**git push \{remote_name\} \{current_branch\}:\{branch\}**|Push local branch commits to another branch|

<br/>

Expand All @@ -116,11 +116,11 @@ Rewrite commits history.

| Command | Description |
| ------- | ----------- |
|**git rebase {branch}**|Apply commits from specified branch ahead of current branch|
|**git reset --hard HEAD~{number_of_commits}**|Reset commits going back to a number of commits before HEAD (destroy changes)|
|**git reset --soft HEAD~{number_of_commits}**|Reset commits going back to a number of commits before HEAD (keep changes)|
|**git reset --hard {commit_sha}**|Reset commits going back to a specific commit (destroy changes)|
|**git reset --soft {commit_sha}**|Reset commits going back to a specific commit (keep changes)|
|**git rebase \{branch\}**|Apply commits from specified branch ahead of current branch|
|**git reset --hard HEAD~\{number_of_commits\}**|Reset commits going back to a number of commits before HEAD (destroy changes)|
|**git reset --soft HEAD~\{number_of_commits\}**|Reset commits going back to a number of commits before HEAD (keep changes)|
|**git reset --hard \{commit_sha\}**|Reset commits going back to a specific commit (destroy changes)|
|**git reset --soft \{commit_sha\}**|Reset commits going back to a specific commit (keep changes)|

<br/>

Expand All @@ -144,7 +144,7 @@ GitHub useful queries.

| Command | Description |
| ------- | ----------- |
|**https://github.com/pulls?&q=author:{user}+is:open+is:pr**|See all open pull requests of a user on Github|
|**https://github.com/pulls?&q=author:\{user\}+is:open+is:pr**|See all open pull requests of a user on Github|


</TabItem>
Expand Down
19 changes: 9 additions & 10 deletions docs/tech/cheats/Kubernetes/kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TabItem from '@theme/TabItem';
Cheat sheet for kubectl commands.

:::info
This page was automatically generated from a navi cheat file available at [**difranca/navi-cheats**](https://github.com/difranca/navi-cheats).<br />
This page was automatically generated from a navi cheat file available at [**difranca/navi-cheats**](https://github.com/difranca/navi-cheats).<br/>
**Navi** is an interactive cheatsheet tool for the command-line. To learn more about it, visit [**denisidoro/navi**](https://github.com/denisidoro/navi).
:::

Expand All @@ -31,7 +31,7 @@ Set which Kubectl cluster kubectl communicates with and modify configuration inf
|**kubectl config view**|Show Merged kubeconfig settings|
|**kubectl config get-contexts**|Display list of contexts|
|**kubectl config current-context**|Display the current-context|
|**kubectl config use-context {context-name}**|Set the default context to my-cluster-name|
|**kubectl config use-context \{context-name\}**|Set the default context to my-cluster-name|

<br/>

Expand All @@ -41,8 +41,8 @@ Manage applications through files.

| Command | Description |
| ------- | ----------- |
|**kubectl create -f {filename}**|Create resource(s) from file|
|**kubectl apply -f {filename}**|Create or modify resource(s) from file|
|**kubectl create -f \{filename\}**|Create resource(s) from file|
|**kubectl apply -f \{filename\}**|Create or modify resource(s) from file|

<br/>

Expand All @@ -52,8 +52,8 @@ List resources from cluster.

| Command | Description |
| ------- | ----------- |
|**kubectl get {resource} -n {namespace}**|List namespace-scoped resources|
|**kubectl get {resource}**|List cluster-scoped resources|
|**kubectl get \{resource\} -n \{namespace\}**|List namespace-scoped resources|
|**kubectl get \{resource\}**|List cluster-scoped resources|

<br/>

Expand All @@ -63,12 +63,11 @@ Interacting with nodes and cluster.

| Command | Description |
| ------- | ----------- |
|**kubectl cordon {node_name}**|Mark node as unschedulable|
|**kubectl uncordon {node_name}**|Mark my-node as schedulable|
|**kubectl drain {node_name}**|Drain node in preparation for maintenance|
|**kubectl cordon \{node_name\}**|Mark node as unschedulable|
|**kubectl uncordon \{node_name\}**|Mark my-node as schedulable|
|**kubectl drain \{node_name\}**|Drain node in preparation for maintenance|
|**kubectl cluster-info**|Display cluster information|


</TabItem>
<TabItem value="Navi Cheat">

Expand Down
2 changes: 1 addition & 1 deletion docs/tech/cloud/aws/ec2.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Recommended for:

- Allows you to bid for spare EC2 computing capacity
- Up to 90% off the On-Demand price
- The average frequency of interruption across all Regions and instance types is <5%
- The average frequency of interruption across all Regions and instance types is < 5%
- The billing for interrupted spot instances is different depending on [whether it was you or Amazon](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/billing-for-interrupted-spot-instances.html) that stopped/terminated the instance
- Estimated savings over on-demand and frequency of interruption can be found [Spot Instance advisor](https://aws.amazon.com/ec2/spot/instance-advisor/?nc1=h_ls)

Expand Down
33 changes: 33 additions & 0 deletions docs/tech/cloud/kubernetes/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
keywords: [kubernetes, k8s, kubectl]
slug: /cloud/kubernetes
title: Kubernetes | Cloud | Tech-Notes
sidebar_label: Kubernetes
---

# Kubernetes

<br/>

<div style={{textAlign: 'center'}}>

<img width="200" height="200" alt="logo" src="/img/cloud/kubernetes.png"/>

_Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications._

</div>

:::note More Information

- https://www.kubernetes.io

:::

<br/>

## Index

import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';

<DocCardList items={useCurrentSidebarCategory().items}/>
80 changes: 80 additions & 0 deletions docs/tech/cloud/kubernetes/namespace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
keywords: [kubernetes, k8s, kubectl, namespace]
title: Namespaces | Kubernetes | Cloud | Tech-Notes
sidebar_label: Namespaces
---

# Namespaces

Namespaces provides a mechanism for isolating groups of resources within a single cluster.

- Names of resources need to be unique within a namespace
- Namespace-based scoping is applicable only for namespaced objects and not for cluster-wide objects

:::note More Information

- https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/

:::

<br/>

## Namespaces Stuck in Terminating

When deleting a namespace in Kubernetes, the namespace may remain stuck in terminating status.

```bash
$ kubectl get ns

NAME STATUS AGE
default Active 2d
kube-public Active 2d
kube-system Active 2d
my-namespace Terminating 7m
```

### Solution

1. Get the namespace manifest

```bash
kubectl get ns my-namespace -o yaml > namespace.yaml
```

2. Edit the manifest file and remove all finalizers

```yaml title="namespace.yaml"
apiVersion: v1
kind: Namespace
metadata:
name: my-namespace
spec:
finalizers:
status:
phase: Terminating
```

3. Start kubectl proxy

```bash
$ kubectl proxy

Starting to serve on 127.0.0.1:8001
```

4. Call namespace finalize API:

```bash
curl -H "Content-Type: application/yaml" -X PUT --data-binary @namespace.yaml http://127.0.0.1:8001/api/v1/namespaces/my-namespace/finalize
```

5. Confirm if namespace was deleted

```bash
$ kubectl get ns

NAME STATUS AGE
default Active 2d
kube-public Active 2d
kube-system Active 2d
```
10 changes: 9 additions & 1 deletion docs/tech/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@ Feel free to open an [issue](https://github.com/difranca/difranca.github.io/issu
This is highly inspired by the following projects:

- [learning-notes.mistermicheels.com](https://learning-notes.mistermicheels.com)
- [cheatsheet.dennyzhang.com](https://cheatsheet.dennyzhang.com)
- [github.com/keyvanakbary/learning-notes](https://github.com/keyvanakbary/learning-notes)

## Running Locally

To preview changes as soon as a file is edited, you can run a local development server:

```bash
yarn install
yarn start
```

## License Summary

[![ccbysa4](https://img.shields.io/badge/License-CC%20BY--SA-lightgrey?style=flat-square&logo=creativecommons&&logoColor=white)](https://creativecommons.org/licenses/by-sa/4.0/) [![mit](https://img.shields.io/badge/License-MIT-red?style=flat-square)](https://mit-license.org)
Expand Down
Loading