Skip to content

Instantly share code, notes, and snippets.

@akagaeng
akagaeng / Decode-base64-encoded-Kubernetes-secret.md
Last active January 25, 2023 07:28
Decode base64-encoded Kubernetes secret

Decode base64-encoded Kubernetes secret

With jsonpath

Get secret

  • Common case: nested name with NO dot
# .data.name
@akagaeng
akagaeng / markdown-fold-unfold.md
Created January 4, 2023 02:38
Fold/unfold contents from Markdown with summary and details tags

Markdown

<details>
<summary>Title Here</summary>

<!-- Blank requred under summary -->
## Contents Title
Some contents
@akagaeng
akagaeng / swap_unique_data_from_rows.md
Last active November 25, 2022 02:23
MySQL: Swap values between two rows with unique contraint
# drop table tasks;

#  ddl
create table tasks
(
    id  int primary key,
    seq int not null unique
);
@akagaeng
akagaeng / auto_increment_seq.md
Created November 24, 2022 10:13
Insert seq same as auto_increment id value
START TRANSACTION;

insert into tasks (seq)
values (null);

update tasks
set seq = LAST_INSERT_ID()
where id = LAST_INSERT_ID();
@akagaeng
akagaeng / curl-one-liner.sh
Last active July 8, 2022 02:14
HTTP Request with curl one-liner
# HTTP request to icanhazip.com
while true ; do curl icanhazip.com ; sleep 1; done
@akagaeng
akagaeng / docker-compose.yaml
Created June 29, 2022 08:44
docker-compose.yaml using image
version: "3.8"
services:
app:
container_name: my-app
image: nginx
ports:
- "8080:80"
env_file:
- .env
@akagaeng
akagaeng / docker-compose.yaml
Created June 29, 2022 05:44
docker-compose.yaml build with Dockerfile
version: "3.8"
services:
app:
container_name: my-app
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:80"
env_file:
@akagaeng
akagaeng / git-log-command-line.sh
Last active June 29, 2022 03:14
git log command line
# git log
# Options
# --decorate: the ref name prefixes refs/heads/, refs/tags/ and refs/remotes/ will not be
printed.
# --graph: Draw a text-based graphical representation of the commit history on
printed in between commits
# --oneline: This is a shorthand for "--pretty=oneline --abbrev-commit"
@akagaeng
akagaeng / docker-login.sh
Last active June 23, 2022 05:52
Docker login shell script, passing password with pipe
#!/bin/sh
USERNAME=<DOCKER USERNAME>
PASSWORD=<DOCKER PASSWORD> # alternatively, use access tokens. See https://docs.docker.com/docker-hub/access-tokens/
echo $PASSWORD | docker login -u $USERNAME --password-stdin
@akagaeng
akagaeng / docker-run-linux.sh
Last active June 16, 2022 05:36
Running linux machine with docker mounting current directory as a volume
#!/bin/bash
# Mount PWD onto the docker container path /app
docker run \
-v ${PWD}:/app
node:16-alpine \ # image name i.g. ubuntu, ...
-it /bin/sh
# usage