Skip to content

Instantly share code, notes, and snippets.

View ramanshrivastava's full-sized avatar
💭
Always learning

Raman ramanshrivastava

💭
Always learning
View GitHub Profile
@ramanshrivastava
ramanshrivastava / raw_socket_resolver.py
Created August 30, 2026 22:11
An iterative DNS resolver from raw Python sockets — companion to https://ramanshrivastava.com/blog/dns-was-the-internets-first-cdn
#!/usr/bin/env python3
"""An iterative DNS resolver from raw sockets. No libraries, no recursion bit.
Usage: python3 raw_socket_resolver.py example.com
Starts at a root server and follows referrals down the hierarchy, the same
walk `dig +trace` shows you: root -> TLD -> authoritative.
"""
import random
import socket
@ramanshrivastava
ramanshrivastava / torch.py
Created August 11, 2025 11:22
quick torch with gpu
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
import time
def check_gpu_availability():
"""Check and display GPU availability information"""
print("=" * 50)
print("GPU AVAILABILITY CHECK")