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 / gist:c47b0bf87b696b9324019bf0101500e0
Created September 13, 2024 11:47
pythong alphanumeric string example
import string
letters = list(string.ascii_lowercase)
vowels = ['a', 'e', 'i', 'o', 'u']
consonants = set(letters).difference(set(vowels))
unwanted = {'x','w','z','f','q'}
unwanted2 = {'x','w','z','f','q','h'}
cons = consonants.difference(unwanted)
cons1 = consonants.difference(unwanted2)
@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 / 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 / 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
@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 / cloudSettings
Last active September 9, 2020 11:54
cloud settings vsc sync
{"lastUpload":"2020-09-09T11:54:18.985Z","extensionVersion":"v3.4.3"}
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