Skip to content

Instantly share code, notes, and snippets.

View kholisrag's full-sized avatar

Kholis Respati Agum Gumelar kholisrag

  • Indonesia
  • 23:27 (UTC +07:00)
View GitHub Profile
@kholisrag
kholisrag / qos_clear.sh
Created September 6, 2017 19:24
Shell Script for Add Queue in Open vSwitch (openvswitch), in my chase it's for openvswitch 2.7.1 with TP-Link TL=WR1043ND v4 Custom Firmware LEDE Reboot (OpenWRT)
#!/bin/sh
for i in eth0.1 eth0.2 eth0.3 eth0.4 eth0.5 eth0.6 wlan0
do
ovs-vsctl clear Port $i qos
echo -e "\033[0;32m Clear QoS and Queue in $i Successful"
done
ovs-vsctl --all destroy QoS
ovs-vsctl --all destroy Queue
echo " "
exit 1
@kholisrag
kholisrag / network
Created September 6, 2017 19:27
Shell Script and LEDE Network Config for working with Open vSwitch v2.7.1 (openvswitch), working with TP-Link TL-WR1043ND v4 custom firmware LEDE Reboot (OpenWRT)
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fded:6c7d:48c4::/48'
@kholisrag
kholisrag / install_doctl.sh
Created February 4, 2020 18:30
Install Digital Ocean doctl latest version automatically (bash script / shell script)
#!/bin/bash
function install_doctl() {
echo "Install doctl"
curl -L $(curl -s https://api.github.com/repos/digitalocean/doctl/releases/latest \
| grep browser_download_url \
| grep linux-amd64 \
| cut -d '"' -f 4) \
| tar xvz
@kholisrag
kholisrag / patch_apt.sh
Created February 5, 2020 16:08
Bash Script / Shell Script Function to Disable Auto Update and Auto Upgrade in Ubuntu
#!/bin/bash
function patch_apt() {
echo "Patching System Auto Update and Auto Upgrade..."
sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
sed -i 's/1/0/g' /etc/apt/apt.conf.d/20auto-upgrades
apt-get clean
echo "Auto Update and Auto Upgrade Disabled!!!"
}
@kholisrag
kholisrag / install_helm3.sh
Created February 5, 2020 23:11
Get Latest Helm3 (Bash script / shell script)
#!/bin/bash
function install_helm() {
echo "Install helm3 latest version"
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod +x get_helm.sh
./get_helm.sh
}
function main () {
@kholisrag
kholisrag / gitlab_group_variables_import.sh
Last active August 11, 2020 17:57
Bash Script for Import CI/CD Variables from one group to another group
#!/bin/bash
init() {
SOURCE_GROUP_ID=
TARGET_GROUP_ID=
GITLAB_PRIVATE_TOKEN=
}
import_group_variables() {
while read group_var_key <&3 && \
@kholisrag
kholisrag / gitlab_project_variables_import.sh
Created August 11, 2020 17:56
Bash Script for Import CI/CD Variables from one project to another project
#!/bin/bash
init() {
SOURCE_PROJECT_ID=
TARGET_PROJECT_ID=
GITLAB_PRIVATE_TOKEN=
}
import_project_variables() {
while read project_var_key <&3 && \
@kholisrag
kholisrag / gitlab_backup_and_delete_project_variables.sh
Last active August 11, 2020 19:41
Bash Script for Backup and Delete CI/CD Variables of a project, store it in json and conf file
#!/bin/bash
init() {
PROJECT_ID=
GITLAB_PRIVATE_TOKEN=
touch ./backup_envar_${PROJECT_ID}.conf
touch ./backup_envar_${PROJECT_ID}.json
}
backup_and_delete_project_variables() {
@kholisrag
kholisrag / gitlab_restore_project_variables.sh
Created August 11, 2020 19:41
Bash Script forRestore CI/CD Variables of a project, from json file
#!/bin/bash
init() {
PROJECT_ID=
GITLAB_PRIVATE_TOKEN=
}
restore_project_variables() {
while read project_var_key <&3 && \
read project_var_value <&4 && \
@kholisrag
kholisrag / convert_yaml_to_one_line.md
Last active July 13, 2021 13:16
convert yaml file to one line, useful for kubectl patch --type=json

Pre-requisite :

  • Python3
  • Pip
pip3 install pyyaml

test.yaml