Skip to content

Instantly share code, notes, and snippets.

@aminvakil
aminvakil / .bashrc
Last active March 6, 2023 13:42
bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@aminvakil
aminvakil / lint6.6.0_bug.sh
Last active September 19, 2022 07:28
Schema bug with user module
#!/bin/bash
ansible-galaxy role init lint_test
cd lint_test/
ansible-lint .
#####
# Current errors are ok and we don't have anything to do with them
#####
echo "- name: Create user
Step 9/10 : RUN pip install --ignore-installed implicit==0.4.8 -v
---> Running in 8ed28a7f9227
Using pip 22.2.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
Collecting implicit==0.4.8
Downloading implicit-0.4.8.tar.gz (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 1.4 MB/s eta 0:00:00
Installing build dependencies: started
Running command pip subprocess to install build dependencies
Collecting setuptools>=40.8.0
Downloading setuptools-65.0.0-py3-none-any.whl (1.2 MB)
@aminvakil
aminvakil / copy.sh
Last active February 4, 2022 13:18
Copies file between two servers without ssh keys (scp syntax)
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
pv_key=${script_dir}/copy.key
pb_key=${script_dir}/copy.key.pub
src_host=${1%:*}
dst_host=${2%:*}
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat << EOF # remove the space between << and EOF, this is due to web plugin issue
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
$ bash build_katran.sh
++ nproc
+ NCPUS=16
+ (( NCPUS < 4 ))
++ pwd
+ ROOT_DIR=/home/aminvakil/katran
+ COLOR_RED='\033[0;31m'
+ COLOR_GREEN='\033[0;32m'
+ COLOR_OFF='\033[0m'
+ getopts :hp:i:m arg
@aminvakil
aminvakil / docker_installation.sh
Last active September 29, 2020 11:13
Docker Installation
CentOS 7:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo systemctl enable docker --now
CentOS 8:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install docker-ce --nobest -y
sudo systemctl enable docker --now