Skip to content

Instantly share code, notes, and snippets.

View iambryancs's full-sized avatar
💭
Wishing it's Friday already...

Bryan CS iambryancs

💭
Wishing it's Friday already...
View GitHub Profile
@iambryancs
iambryancs / install-ca-ubuntu.md
Created October 17, 2023 05:07
Install CA - Ubuntu

Install root CA in PEM format

To install a root CA, do

$ sudo apt-get install -y ca-certificates
$ sudo cp local-ca.crt /usr/local/share/ca-certificates
$ sudo update-ca-certificates

The CA trust store location

  • /etc/ssl/certs/ca-certificates.crt - single file (PEM bundle)
@iambryancs
iambryancs / get-argocd-default-password.md
Created October 3, 2023 03:05
Get ArgoCD default admin password

Get ArgoCD default admin password

To get ArgoCD default admin password after installation, run:

kubectl -n argocd get secret argocd-initial-admin-secret \
          -o jsonpath="{.data.password}" | base64 -d; echo

The default admin user is admin.

@iambryancs
iambryancs / nvim-plug-health.md
Created August 3, 2023 22:34
nvim check plugin health

To check the health of a plugin, run:

:checkhealth <plugin_name>

Example, to check telescope plugin's health and see any missing deps:

:checkhealth telscope
@iambryancs
iambryancs / slack-notif-stack.md
Created August 1, 2023 04:19
Clear stucked Slack notifications

To clear stucked unread Slack notifications, simply type:

Shift + Escape
@iambryancs
iambryancs / share-docker-build-arg-multi-stage.md
Created July 20, 2023 13:21
Sharing Docker build ARG in multi-stage builds

Sharing Docker build ARG in multi-stage builds

To share Docker build ARGs in a multi-stage build, simply declare it globally then mention it in subsequent builds to renew.

ARG IMG=alpine:3.14.2
FROM gcr.io/kaniko-project/executor:v1.9.0-debug AS kaniko

ARG IMG
FROM ${IMG}
RUN apk --update add \
@iambryancs
iambryancs / mongodumprestore.sh
Last active July 5, 2023 12:26
MongoDB dump and restore using mongodump and mongorestore.
#!/bin/bash
SRC_DB_URI='mongodb+srv://username:password@src_host/'
SRC_DB_NAME=src_db_name
DEST_DB_URI='mongodb+srv://username:password@dest_host/'
#not probably needed as well as the `--db` under `mongorestore`
DEST_DB_NAME=dest_db_name
mongodump \
@iambryancs
iambryancs / nginx-spa-routing.md
Created July 3, 2023 09:49
SPA routing with Nginx

SPA routing with Nginx

To allow Nginx to route non-existing path back to index.html, do:

server {
      listen 80;
      listen [::]:80;
      server_name localhost;

 location / {
@iambryancs
iambryancs / move-var-part-ubuntu.md
Created June 5, 2023 02:31
Move /var to another partition in Ubuntu

Move /var to another partition in Ubuntu

Create partition with fdisk or gparted

fdisk /dev/sdb
...
...

Create fs

@iambryancs
iambryancs / krsync.sh
Created June 5, 2023 01:42
Kubernetes rsync wrapper
#!/bin/bash
# Source: https://serverfault.com/a/887402/169782
# Usage:
# krsync -av --progress --stats src-dir/ pod<@namespace>:/dest-dir
if [ -z "$KRSYNC_STARTED" ]; then
export KRSYNC_STARTED=true
exec rsync --blocking-io --rsh "$0" $@
@iambryancs
iambryancs / pyenv-wsl-ubuntu_22.04.md
Created May 31, 2023 10:31
Using Pyenv in WSL Ubuntu 22.04 LTS to install Python 3.8

Using Pyenv in WSL Ubuntu 22.04 LTS to install Python 3.8

Env

  • Windows 10
  • Ubuntu 22.04 WSL
  • zsh

Requirements

  • git