Skip to content

Instantly share code, notes, and snippets.

View MrAmbiG's full-sized avatar
💭
Roar

Gajendra D Ambi MrAmbiG

💭
Roar
View GitHub Profile
@MrAmbiG
MrAmbiG / rkeNodeReset.sh
Last active March 25, 2021 19:17
rkeNodeReset.sh
#!/bin/bash
sudo ls
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
@MrAmbiG
MrAmbiG / ubuntu.ks
Created November 27, 2020 04:07 — forked from funzoneq/ubuntu.ks
Ubuntu kickstart file
#Generated by Kickstart Configurator
#platform=x86
# Fetch content from here
url –url http://nl.archive.ubuntu.com/ubuntu/
#System language
lang en_US.UTF-8
#Language modules to install
@MrAmbiG
MrAmbiG / cloudSettings
Last active September 9, 2020 11:54
cloud settings vsc sync
{"lastUpload":"2020-09-09T11:54:18.985Z","extensionVersion":"v3.4.3"}
@MrAmbiG
MrAmbiG / deleteNamespace
Last active July 28, 2020 16:30
Delete namespace
# find out what is still there in namespace
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n <namespace>
# edit those resources and comment out all those under finalizers.
# try deleting namespace now
@MrAmbiG
MrAmbiG / gitMigrate
Last active July 26, 2020 16:50
mirror repos
# clone the repo from your existing git source [gilab, github etc]
git clone OLDREPO
# cd into the cloned repo
cd NEWCLONEDREPO
# check in and check out of all clones branches to mirror them locally
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
# fetch and pull
@MrAmbiG
MrAmbiG / renamer.py
Created July 18, 2020 08:14
python rename files in a directory
# Pythono3 code to rename multiple
# files in a directory or folder
# importing os module
import os
# Function to rename multiple files
def main():
for file in os.listdir():
original = file
def uppercase(data):
'''takes a non nested dictionary and converts the values to uppercase'''
output = {}
for k, v in data.items():
output[k] = v.upper()
return output
@MrAmbiG
MrAmbiG / uppercase
Created August 11, 2019 18:40
test gist for a project
def uppercase(data):
'''takes a non nested dictionary and converts the values to uppercase'''
output = {}
for k, v in data.items():
output[k] = v.upper()
return output
@MrAmbiG
MrAmbiG / l3gateway
Created May 26, 2019 06:55
L3Vmotion gateway setter for vmware esxi 6.x [courtesy : lucd]
Write-Host "make sure you are connected to a vcenter first"
$cluster = Read-Host "cluster name?"
$vmhosts = Get-Cluster $cluster | Get-VMHost | sort
$stackName = 'vmotion'
$ipGateway = Read-Host "default gateway?"
$ipDevice = Read-Host "vmk device?" # ex: vmk2
forech $VMHost in $vmhosts {
$esx = Get-VMHost -Name $VMHost
$netSys = Get-View -Id $esx.ExtensionData.ConfigManager.NetworkSystem
@MrAmbiG
MrAmbiG / jupyter_youtube
Last active January 19, 2019 19:52
Embed video into jupyter notebooks
address='https://www.youtube.com/embed/e2qQ_T6njhs'
from IPython.display import IFrame
IFrame(address, width="1280", height="720")