Skip to content

Instantly share code, notes, and snippets.

View shassaan's full-sized avatar
⚒️
Hacking

Syed Hassaan Ahmed shassaan

⚒️
Hacking
View GitHub Profile
@shassaan
shassaan / Code.cpp
Created October 19, 2021 09:22
Langrange Interpolation Implementation
#include<iostream>
using namespace std;
double* getL(double** dataValues,int nPoints,double pointOfInterest) {
double den = 1, num = 1;
double *L = new double[nPoints];
for (int i = 0; i < nPoints; i++)
{
for (int j = 0; j < nPoints; j++)
{
if (j != i)
@shassaan
shassaan / DInjectQueuerAPC.cs
Created February 14, 2021 07:48 — forked from sunnyneo/DInjectQueuerAPC.cs
.NET Process injection in a new process with QueueUserAPC using D/invoke - compatible with gadgettojscript
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace DinjectorWithQUserAPC
{
public class Program
@shassaan
shassaan / profile.json
Created November 3, 2020 13:13
My Windows terminal profile
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
// You can add more global application settings here.
@shassaan
shassaan / ContextConsumer.cs
Created November 3, 2020 12:49
ContextConsumer
using (var ctx = new SchoolContext())
{
var stud = new Student()
{
StudentName = "Bill"
};
ctx.Students.Add(stud);
ctx.SaveChanges();
}
@shassaan
shassaan / SchoolContext.cs
Created November 3, 2020 12:47
School Context Class
public class SchoolContext: DbContext{
public SchoolContext():base(){}
public DbSet<Student> Students;
public DbSet<Grade> Grades;
}
@shassaan
shassaan / Student.cs
Created November 3, 2020 12:45
Student Class
public class Student{
public int ID { get; set; }
public string Name { get;set;}
public Grade Grade { get; set; }
}
@shassaan
shassaan / Grade.cs
Created November 3, 2020 12:40
Grade Class
public class Grade{
public int GradeId { get; set; }
public string GradeName { get; set; }
public ICollection<Student> Students { get; set; }
}
@shassaan
shassaan / QueryingList.cs
Created November 3, 2020 12:23
Creating List and Querying
IList<string> stringList = new List<string>()
{
"C# Tutorials",
"TS Tutorials",
"Learn python",
"nodejs Tutorials" ,
"adonisjs"
}; // LINQ Query Syntax
var result = stringList.Where(s => s.Contains("Tutorials"));
@shassaan
shassaan / RetrieveDataFromBlockingCollection.cs
Created November 3, 2020 12:14
RetrieveDataFromBlockingCollection
Task t2 = Task.Run(() =>
{
try
{
while (true)
Console.WriteLine(bc.Take());
}
catch (InvalidOperationException)
@shassaan
shassaan / AddDataInBlockingCollection.cs
Created November 3, 2020 12:12
AddDataInBlockingCollection
BlockingCollection<int> data = new BlockingCollection<int>();
Task t1 = Task.Run(() =>{
data .Add(1);
data .Add(2);
data .Add(3);
data .CompleteAdding();
});