Skip to content

Instantly share code, notes, and snippets.

View ajith05's full-sized avatar

Ajith Kanumuri ajith05

View GitHub Profile
@ajith05
ajith05 / pycache_cleanup.py
Last active July 12, 2024 12:03
This script is to clear all __pycache__ folders within all drives on a windows machine. This does not require any external libraries
'''
This is a helper script to delete all __pycache__ folders
'''
from ctypes import windll
from pathlib import Path
from shutil import rmtree
import os
import string
@ajith05
ajith05 / get_ssh_ip.bat
Created May 9, 2023 10:50
Batch script to print the IP of an ssh host given the name of host is known
@echo off
setlocal
if [%~1]==[] (
echo No input given to the script
echo Usage: %~nx0 name_of_host_to_search
exit /B 0
)
for /f "tokens=2" %%a in ('ssh -G %~1 ^| findstr /i /b hostname') do (
@ajith05
ajith05 / get_ssh_hosts.bat
Last active May 9, 2023 10:53
Batch script to print ssh hosts defined in both the user-specific and the system-wide ssh config files on windows
@echo off
setlocal
set user_config=%USERPROFILE%\.ssh\config
echo.
echo Reading %user_config% i.e., user-specific ssh config
call :parse_ssh_config %user_config%
set global_config=%ProgramData%\ssh\ssh_config
echo.