Skip to content

Instantly share code, notes, and snippets.

View ankurdivekar's full-sized avatar

Ankur Divekar ankurdivekar

  • Pune, India
View GitHub Profile
@ankurdivekar
ankurdivekar / skill.md
Created March 4, 2026 17:21
Zinsser rules skill.md
name zinsser-rules
description Edits text to follow William Zinsser's "On Writing Well" principles (clarity, simplicity, brevity, active voice).
use when User asks to edit, rewrite, or improve writing for clarity and conciseness.

Zinsser Writing Style Guide

Apply these rules strictly to the text provided:

@ankurdivekar
ankurdivekar / html2fh
Created December 24, 2024 08:59
Quick conversion from plain HTML to FastHTML components. Also checks if SVG is used and inserts imports accordingly
import argparse
import os
import sys
from fasthtml.components import html2ft
def main():
# Set up the argument parser
parser = argparse.ArgumentParser(
@ankurdivekar
ankurdivekar / Merge_substrings.py
Created August 28, 2024 13:55
Find & Merge substrings
import re
from typing import List
def process_text(long_string: str, short_strings: List[str]) -> List[str]:
"""
Iteratively merge adjacent substrings from a list within a longer string.
This function takes a long string and a list of shorter strings, and iteratively
merges adjacent or near-adjacent occurrences of the shorter strings within the
longer string. It continues merging until no further merges are possible.
@ankurdivekar
ankurdivekar / hypen_handler.py
Last active June 26, 2024 07:25
Hypen standardization
def standardize_hypens(input_str:str, std_to_char:str='\u002D'):
# Ux002D is the unicode for the normal hypen
return (input_str
.replace('\u2014', std_to_char)
.replace('\u2013', std_to_char)
.replace('\u2012', std_to_char)
.replace('\u2011', std_to_char)
.replace('\u2010', std_to_char)
.replace("\u002D", std_to_char)
.replace("\u27D7", std_to_char)
@ankurdivekar
ankurdivekar / port_scanner.py
Last active April 7, 2024 04:09
Script for scanning open ports
import socket
import sys
from prettytable import PrettyTable
# Dictionary mapping common ports to vulnerabilities (Top 15)
vulnerabilities = {
80: "HTTP (Hypertext Transfer Protocol) - Used for unencrypted web traffic",
443: "HTTPS (HTTP Secure) - Used for encrypted web traffic",
22: "SSH (Secure Shell) - Used for secure remote access",
21: "FTP (File Transfer Protocol) - Used for file transfers",
@ankurdivekar
ankurdivekar / st_footer.py
Last active February 20, 2023 14:50
Streamlit Footer