Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Roar

Gajendra D Ambi MrAmbiG

💭
Roar
View GitHub Profile
@MrAmbiG
MrAmbiG / rkeNodeReset.sh
Last active Mar 25, 2021
rkeNodeReset.sh
View 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 Nov 27, 2020 — forked from funzoneq/ubuntu.ks
Ubuntu kickstart file
View ubuntu.ks
#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 / deleteNamespace
Last active Jul 28, 2020
Delete namespace
View deleteNamespace
# 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 / renamer.py
Created Jul 18, 2020
python rename files in a directory
View renamer.py
# 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
@MrAmbiG
MrAmbiG / gitMigrate
Last active Jul 26, 2020
mirror repos
View gitMigrate
# 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 / cloudSettings
Last active Sep 9, 2020
cloud settings vsc sync
View cloudSettings
{"lastUpload":"2020-09-09T11:54:18.985Z","extensionVersion":"v3.4.3"}
View uppercase
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 Aug 11, 2019
test gist for a project
View uppercase
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
L3Vmotion gateway setter for vmware esxi 6.x [courtesy : lucd]
View l3gateway
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 Jan 19, 2019
Embed video into jupyter notebooks
View jupyter_youtube
address='https://www.youtube.com/embed/e2qQ_T6njhs'
from IPython.display import IFrame
IFrame(address, width="1280", height="720")