Skip to content

Instantly share code, notes, and snippets.

View TyeolRik's full-sized avatar

TyeolRik TyeolRik

View GitHub Profile
@TyeolRik
TyeolRik / add_osd.yaml
Created September 26, 2023 02:45
Ceph adding osd
# ceph orch apply -i add_osd.yaml
service_type: osd
service_id: osd_localhost
placement:
hosts:
- node1
data_devices:
paths:
- /dev/sdb
- /dev/sdc
#!/bin/bash
function snakecase_to_camelCase() {
local ret
ret=$(echo $1 | sed -E 's/_(.)/\U\1/g')
echo "$ret"
}
SomeString="snakecase_looks_very_bad"
camelCase=$(snakecase_to_camelCase "$SomeString")
function camelcase_to_snakecase() {
local ret
ret=$(echo "$1" | sed -r 's/([A-Z])/_\L\1/g' | sed 's/^_//')
echo "$ret"
}
SomeString="helloWorldMyFriend"
snake_case=$(camelcase_to_snakecase "${SomeString}")
echo $snake_case
@TyeolRik
TyeolRik / ConvertUpperCase.sh
Last active May 24, 2023 01:08
Function return values in Shell Script
#!/bin/bash
function all_uppercase() {
local ret=${1^^} # Make input parameter Upper case. Should be declared in local variable.
echo "$ret" # This is like return.
}
SomeString="HelloWorld"
UpperCase=$(all_uppercase "${SomeString}")
echo $UpperCase
@TyeolRik
TyeolRik / test.sql
Last active December 29, 2022 14:52
[Oracle] Use list using VARRAY data type.
CREATE TYPE SUBUSER AS OBJECT (
ID VARCHAR2(200),
PERMISSIONS VARCHAR2(12)
);
CREATE TYPE SUBUSERS AS VARRAY(1000) OF SUBUSER; -- Nested Table type.
CREATE TABLE USER (
UID VARCHAR2(50),
SUBUSERS_COLUMN SUBUSERS -- An Instance of Nested Table
@TyeolRik
TyeolRik / CEPH_Install_For_Admin_at_closed_networks.sh
Last active July 12, 2022 03:49
CEPH Installation in Closed Network Nodes with maintaining firewalld and selinux. OS: CentOS 8 Stream, CEPH Version: Pacific (v16.2.9)
#!/bin/bash
###########################
# Information
# Host 1 (node1): 172.22.4.101 - admin
# host 2 (node2): 172.22.4.102
# host 3 (node3): 172.22.4.103
# host 4 (node4): 172.22.4.104
# host 5 (node5): 172.22.4.105
###########################
@TyeolRik
TyeolRik / CEPH_Install.sh
Last active September 27, 2023 05:48
CEPH Installation with maintaining firewalld and selinux. OS: CentOS 8 Stream, CEPH Version: Pacific (v16.2.9)
#!/bin/bash
###########################
# Information
# Host 1 (node1): 172.22.4.101 - admin
# host 2 (node2): 172.22.4.102
# host 3 (node3): 172.22.4.103
# host 4 (node4): 172.22.4.104
# host 5 (node5): 172.22.4.105
###########################
@TyeolRik
TyeolRik / remove_CEPH1_DownOSDs_and_Hosts.sh
Last active January 2, 2024 06:27
How to remove CEPH. OS: CentOS 8 Stream, CEPH Version: Pacific (v16.2.9)
#!/bin/bash
################# README #################
# Please run this scripts on admin node! #
# Please set whether all SSH keys are removed from all HOSTs
ssh_remove=false
##########################################
# https://www.flamingbytes.com/posts/uninstall-ceph/
#################################################
# Variable targetDisk should be configured. #
@TyeolRik
TyeolRik / enable_GUI_within_SSH.sh
Last active June 21, 2022 16:37
Host: CentOS 8 Stream / Client: Windows 10 Powershell (exactly Windows Terminal)
#!/bin/bash
# Host: CentOS 8 (192.168.8.119)
# Client: Windows 10 Powershell (192.168.8.120)
# ssh -Y [email protected]
# Before Begin in Client(Windows)
# 1. Install VcXsrv (https://sourceforge.net/projects/vcxsrv/)
# 2. Execute Xlaunch.exe
# Check {Multiple Windows and Display number = -1, Start no client, {Clipboard, Primary Selection, Native opengl, Additional parameter: "-ac"} -> Save Configuration}
#!/bin/bash
dnf update -y &&\
dnf install -y kernel-devel kernel-header* make gcc elfutils-libelf-devel
echo "Installing Docker"
yum install -y yum-utils telnet &&\
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo &&\
yum install -y --allowerasing docker-ce docker-ce-cli containerd.io docker-compose-plugin &&\
systemctl enable docker.service &&\
systemctl start docker.service