Skip to content

Instantly share code, notes, and snippets.

View medhatelmasry's full-sized avatar

Medhat Elmasry medhatelmasry

View GitHub Profile
@medhatelmasry
medhatelmasry / create-students-table-sql-server.sql
Last active October 8, 2026 20:22
Create Students table in SQL Server
CREATE DATABASE SchoolDB;
GO
USE SchoolDB;
GO
CREATE TABLE Students (
StudentId int IDENTITY(1,1) PRIMARY KEY,
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
@medhatelmasry
medhatelmasry / Program.cs
Created July 24, 2026 03:30
Foundry SDK C# Code
using Betalgo.Ranul.OpenAI.ObjectModels.RequestModels;
using Microsoft.AI.Foundry.Local;
using Microsoft.Extensions.Logging;
CancellationToken ct = new();
var config = new Configuration {
AppName = "foundry_local_samples",
LogLevel = Microsoft.AI.Foundry.Local.LogLevel.Information
};
@medhatelmasry
medhatelmasry / Program.cs
Last active February 4, 2026 02:23
MCP .NET Client Program.cs
using ModelContextProtocol.Client;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.AI;
using System.Text.Json;
using Microsoft.Extensions.Configuration;
// Load configuration from appsettings.json
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
@medhatelmasry
medhatelmasry / pokemon.json
Created December 9, 2025 00:04
pokemon.json
[{"id":1,"name":"bulbasaur","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/1.png"},{"id":2,"name":"ivysaur","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/2.png"},{"id":3,"name":"venusaur","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/3.png"},{"id":4,"name":"charmander","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/4.png"},{"id":5,"name":"charmeleon","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/5.png"},{"id":6,"name":"charizard","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/6.png"},{"id":7,"name":"squirtle","imageUrl":"https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/7.png"},{"id":8,"name":"wartortl
@medhatelmasry
medhatelmasry / nba.json
Created December 8, 2025 23:54
nba.json
[
{
"id": 1,
"name": "Atlanta Hawks",
"city": "Atlanta",
"abbreviation": "ATL",
"logoUrl": "https://a.espncdn.com/i/teamlogos/nba/500/atl.png"
},
{
"id": 2,
@medhatelmasry
medhatelmasry / students.json
Created November 22, 2025 18:06
students.json
[
{
"StudentId": 1,
"FirstName": "Tom",
"LastName": "Max",
"School": "Nursing",
"Gender": "Male",
"DateOfBirth": "1998-06-12"
},
{
@medhatelmasry
medhatelmasry / Program.cs
Last active October 23, 2025 17:17
AI Toolkit OpenAI Client - Program.cs
using OpenAI;
using OpenAI.Chat;
using System.ClientModel;
using System.Text;
var model = "mistral-7b-v02-int4-cpu";
var baseUrl = "http://localhost:5272/v1/"; // root URL for local OpenAI-like server
var apikey = "unused";
OpenAIClientOptions options = new OpenAIClientOptions();
@medhatelmasry
medhatelmasry / Program.cs
Created October 22, 2025 23:30
AI Toolkit Sematic Kernel Client
using System.Text;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.OpenAI;
var model = "mistral-7b-v02-int4-cpu";
var baseUrl = "http://localhost:5272/v1/";
var apikey = "unused";
// Create a chat completion service
@medhatelmasry
medhatelmasry / fifa-world-cup.json
Last active October 2, 2025 02:20
List of men and women FIFA Soccer World Cups (JSON)
[
{
"GameId": 1,
"Year": 1930,
"Gender": "Men",
"City": "Montevideo",
"Country": "Uruguay",
"Continent": "South America",
"Winner": "Uruguay"
},
@medhatelmasry
medhatelmasry / ZodiacMcpTool.cs
Created September 29, 2025 20:24
ZodiacMcpTool
public class ZodiacMcpTool {
[Function("ZodiacMcpTool")]
public IActionResult Run(
[McpToolTrigger(McpToolDefinitions.ZodiacTool.Name, McpToolDefinitions.ZodiacTool.Description)]
ToolInvocationContext context,
[McpToolProperty(McpToolDefinitions.ZodiacTool.Param.Name, McpToolDefinitions.DataTypes.Number, McpToolDefinitions.ZodiacTool.Param.Description)]
int year)
{
return new OkObjectResult($"Hi. I am {McpToolDefinitions.ZodiacTool.Name}!. The zodiac animal for the year {year} is: {GetZodiacAnimal(year)}");
}