Skip to content

Instantly share code, notes, and snippets.

Avatar
⚒️
Hacking

Syed Hassaan Ahmed shassaan

⚒️
Hacking
View GitHub Profile
@shassaan
shassaan / Code.cpp
Created Oct 19, 2021
Langrange Interpolation Implementation
View Code.cpp
#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 Feb 14, 2021 — forked from sunnyneo/DInjectQueuerAPC.cs
.NET Process injection in a new process with QueueUserAPC using D/invoke - compatible with gadgettojscript
View DInjectQueuerAPC.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace DinjectorWithQUserAPC
{
public class Program
@shassaan
shassaan / profile.json
Created Nov 3, 2020
My Windows terminal profile
View profile.json
// 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.
View ContextConsumer.cs
using (var ctx = new SchoolContext())
{
var stud = new Student()
{
StudentName = "Bill"
};
ctx.Students.Add(stud);
ctx.SaveChanges();
}
@shassaan
shassaan / SchoolContext.cs
Created Nov 3, 2020
School Context Class
View SchoolContext.cs
public class SchoolContext: DbContext{
public SchoolContext():base(){}
public DbSet<Student> Students;
public DbSet<Grade> Grades;
}
View Student.cs
public class Student{
public int ID { get; set; }
public string Name { get;set;}
public Grade Grade { get; set; }
}
View Grade.cs
public class Grade{
public int GradeId { get; set; }
public string GradeName { get; set; }
public ICollection<Student> Students { get; set; }
}
@shassaan
shassaan / QueryingList.cs
Created Nov 3, 2020
Creating List and Querying
View QueryingList.cs
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 Nov 3, 2020
RetrieveDataFromBlockingCollection
View RetrieveDataFromBlockingCollection.cs
Task t2 = Task.Run(() =>
{
try
{
while (true)
Console.WriteLine(bc.Take());
}
catch (InvalidOperationException)
View AddDataInBlockingCollection.cs
BlockingCollection<int> data = new BlockingCollection<int>();
Task t1 = Task.Run(() =>{
data .Add(1);
data .Add(2);
data .Add(3);
data .CompleteAdding();
});