Skip to content

Instantly share code, notes, and snippets.

@nuthanc
nuthanc / ssh_config
Last active June 9, 2020 06:34
Remote ssh config vs code
Host noden18
HostName 10.204.216.194
User root
IdentityFile ~/.ssh/id_rsa
# After this need to copy id to n18
ssh-copy-id root@10.204.216.194
@nuthanc
nuthanc / ps1.sh
Created June 8, 2020 14:14
PS1 which is red, yellow and blue
PS1='\[$(tput bold)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;11m\]@\h:\[$(tput sgr0)\]\[\033[38;5;33m\][\[$(tput sgr0)\]\[\033[38;5;39m\]\w\[$(tput sgr0)\]\[\033[38;5;33m\]]\[$(tput sgr0)\]\[\033[38;5;15m\]\\$ \[$(tput sgr0)\]'
@nuthanc
nuthanc / short.sh
Last active August 14, 2024 12:42
Kubectl short commands
alias k="kubectl"
alias kgp="kubectl get pods -o wide"
alias kgpn="kubectl get pods -n"
alias kgpa="kubectl get pods -o wide --all-namespaces"
alias kgd="kubectl get deployments"
alias kgs="kubectl get services"
alias ke="kubectl exec -it"
function keb {
kubectl exec -it $1 bash || kubectl exec -it $1 sh
@nuthanc
nuthanc / curtin_command
Last active June 8, 2020 06:20
MAAS commissioning script
custom_host: ["curtin", "in-target", "--", "sh", "-c", "/bin/sed -i -e '/127.0.0.1 localhost/i 192.168.40.20 noden20.maas noden20' -e '/127.0.0.1 localhost/i 192.168.40.19 noden19.maas noden19' /etc/hosts"]
@nuthanc
nuthanc / automate.py
Last active June 5, 2020 08:10
Contrail Command Juju
import yaml
import base64
import pexpect
import os
import time
import subprocess
def change_user_password():
try:
change_command = pexpect.spawn('juju change-user-password')
@nuthanc
nuthanc / history_n17
Last active July 7, 2020 07:16
n17 important history
virt-install --help | less
virsh dumpxml 9 | less
//mnt/disk1/images/vm1.img
//mnt/disk1/images/
virt-install --dry-run --name vm4 --memory 4096 --vcpus 4 --disk size=1 --location images
virt-install --dry-run --name vm4 --memory 4096 --vcpus 4 --location images --disk size=1
virt-install --help | less
virt-install --dry-run --name vm4 --memory 4096 --vcpus 4 --location images --disk=?
virt-install --dry-run --name vm4 --memory 4096 --vcpus 4 --disk size=1 --disk pool=images
virt-install --dry-run --name vm4 --memory 4096 --vcpus 4 --disk size=1 --disk pool=images --location images
@nuthanc
nuthanc / fix_hashsummismatch_error
Last active March 24, 2021 07:00 — forked from ThinGuy/fix_hashsummismatch_error
Fix Hash sum mismatch error in maas that can occur when a local mirror and maas apt-proxy cache get out of sync
#To fix bad hashInsert the following as after "late_commands:" in /etc/maas/preseeds/curtin_userdata
prxyfix_01_cmd: ["curtin", "in-target", "--", "sh", "-c", "/bin/echo 'Acquire::http::Pipeline-Depth 0;' > /etc/apt/apt.conf.d/99FixBadProxy"]
prxyfix_02_cmd: ["curtin", "in-target", "--", "sh", "-c", "/bin/echo 'Acquire::http::No-Cache true;' >> /etc/apt/apt.conf.d/99FixBadProxy"]
prxyfix_03_cmd: ["curtin", "in-target", "--", "sh", "-c", "/bin/echo 'Acquire::BrokenProxy true;' >> /etc/apt/apt.conf.d/99FixBadProxy"]
#Automatically insert above into /etc/maas/preseeds/curtin_userdata using sed
sudo sed -e '/late_commands:/a \ \ prxyfix_01_cmd: ["curtin", "in-target", "--", "sh", "-c", "/bin/echo '"'"'Acquire::http::Pipeline-Depth 0;'"'"' > /etc/apt/apt.conf.d/99FixBadProxy"]\n\ \ prxyfix_02_cmd: ["curtin", "in-target", "--", "sh", "-c", "/bin/echo '"'"'Acquire::http::No-Cache true;'"'"' >> /etc/apt/apt.conf.d/99FixBadProxy"]\n\ \ prxyfix_03_cmd: ["curtin", "in-target", "--", "sh", "-c", "/bin/ec
@nuthanc
nuthanc / .bashrc
Last active August 22, 2020 14:04
Common utility bashrc #MAC #noden18 #nodea35 #PS1
alias s="source ~/.bashrc"
alias gaa="git add --all"
alias cb="code ~/.bashrc || vi ~/.bashrc"
p(){
cd $(pwd)
git add --all
git commit -m "$1"
git push origin master
}
@nuthanc
nuthanc / .zshrc
Last active February 3, 2022 12:11
Configs for bashrc to include
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/nuthanc/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
@nuthanc
nuthanc / README.md
Last active May 23, 2021 09:44
RHOSP Netronome deployment

RHOSP Netronome deployment

In nodem21(which is setup as undercloud)

###Login
# To get ip
virsh list
virsh domifaddr <id or name>
ssh stack@<ip>