Skip to content

Instantly share code, notes, and snippets.

View sleshJdev's full-sized avatar

Eugene sleshJdev

  • Belarus, Minsk
View GitHub Profile
@sleshJdev
sleshJdev / ansible-vault-env-client.py
Created October 17, 2022 11:21
Ansible vault script to retrieve vault-id from the environment variables | Ansible vault env vars password provider
#!/usr/bin/env python
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# =============================================================================
#
# This script is to be used with ansible-vault's --vault-id arg
# to retrieve the vault password via your OS's environment variable.
#
# This file *MUST* be saved with executable permissions. Otherwise, Ansible
# will try to parse as a password file and display: "ERROR! Decryption failed"
@sleshJdev
sleshJdev / adduser.sh
Last active October 15, 2022 11:11
SSH script to manage manager users on remote host: create user, add public key
set -euo pipefail
DEV_GROUP="somegroup"
sudo groupadd --force "${DEV_GROUP}"
function adduser() {
local var_user="$1"
shift
local var_ssh_pub_key="$*"
id --user "${var_user}" &>/dev/null || sudo useradd --gid "${DEV_GROUP}" --groups wheel,docker "${var_user}"
@sleshJdev
sleshJdev / Vagrant
Created March 15, 2021 22:31
k8s single-node cluster on vagrant ubuntu vm
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<-SCRIPT
sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo add-apt-repository "deb [arch=amd64] https://apt.kubernetes.io/ kubernetes-xenial main"
@sleshJdev
sleshJdev / limit-tc.sh
Created October 14, 2015 17:58
TC limiting
#!/bin/bash
# Full path to tc binary
TC=$(which tc)
#
# NETWORK CONFIGURATION
# interface - name of your interface device
# interface_speed - speed in mbit of your $interface
# ip - IP address of your server, change this if you don't want to use