Skip to content

Instantly share code, notes, and snippets.

@keshy
keshy / mcp_gemini_client.py
Last active June 10, 2025 15:50
MCP Client demonstrating a chat interface with message history and able to perform recursive computations using function calling with Gemini
import os
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
import asyncio
from google import genai
from google.genai import types
from google.genai.types import Tool, FunctionDeclaration
server_params = StdioServerParameters(
command="python",
import boto3
import gzip
import json
import logging
import os
from StringIO import StringIO
from datetime import datetime, timedelta
firehose = boto3.client('firehose')
ec2 = boto3.client('ec2')
@keshy
keshy / aws_service.py
Created July 26, 2017 01:59
Get AWS Service Name from namespace value
from bs4 import BeautifulSoup
import requests
import argparse
import csv
def getPageSource(url, result_path):
if not url:
print "No url entered"
return None
source = requests.get(url, verify=False).text
@keshy
keshy / iterationCode.py
Created December 11, 2015 06:55
Simple iteration problem to determine contiguous repetitions in a string.
# recursion approach
def iterCount(numList, itemCount, maxIteration):
if itemCount == 0:
return numList
outputList = []
lastSeen = numList[0]
count = 1
if len(numList) == 1:
@keshy
keshy / sample_code
Created December 20, 2013 06:50
greatest integer from python lists
def getMaxFromList(max, items):
"""
Function to return the max integer found in the list. This could be a recursive call where the max value is compared with the items in the list and the if an item greater than max is found then
we set max to that item value and return max
@param max: Maximum value found in the root array so far
@type max: integer
@param items: List of items that includes items and other lists