Skip to content

Instantly share code, notes, and snippets.

View wojciech-kulik's full-sized avatar
🤩
Fascinated by Neovim

Wojciech Kulik wojciech-kulik

🤩
Fascinated by Neovim
View GitHub Profile
#define INT_MAX 2147483647
#include <stdio.h>
#include <vector>
#include <list>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <string>
@wojciech-kulik
wojciech-kulik / dijkstra.cpp
Created November 4, 2015 21:15
[C++] Dijkstra's algorithm - http://wojciechkulik.pl
#include <stdio.h>
#include <set>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
struct Edge
{
@wojciech-kulik
wojciech-kulik / bellman_ford.cpp
Created November 4, 2015 21:12
[C++] Bellman-Ford algorithm - http://wojciechkulik.pl
#include <stdio.h>
#include <vector>
#include <climits>
using namespace std;
struct Vertex
{
long long minCost;
};
@wojciech-kulik
wojciech-kulik / Navigation.cs
Created November 4, 2015 21:07
[C#] WKFramework - navigation - http://wojciechkulik.pl
new NavigationService()
.GetWindow<PersonDetailsViewModel>()
.WithParam(vm => vm.Person, personToShow)
.DoIfAccepted(vm => RefreshList())
.ShowDialog();
@wojciech-kulik
wojciech-kulik / WKFrameworkRead.cs
Created November 4, 2015 21:06
[C#] WKFramework - reading from settings - http://wojciechkulik.pl
var person = new Person();
var settings = FileSettings("settings.dat");
settings.ReadProperties(person);
settings.ReadStaticProperties(typeof(Settings));
var lastUpdate = settings.ReadValue<DateTime>("LastUpdate");
var counter = settings.ReadValue<int>(SettingsKey.Counter);
@wojciech-kulik
wojciech-kulik / WKFrameworkWrite.cs
Created November 4, 2015 21:06
[C#] WKFramework - writting to settings - http://wojciechkulik.pl
var person = new Person()
{
FirstName = "John",
LastName = "Smith"
};
//the same interface is availalbe for MsSqlServerSettings
var settings = FileSettings("settings.dat");
settings.WriteProperties(person); //saves only public properties
@wojciech-kulik
wojciech-kulik / Program.cs
Created November 4, 2015 20:57
[C#] Load DLLs from resources - http://wojciechkulik.pl
using System;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
namespace EmbeddedLibraries
{
static class Program
{
private static Assembly ExecutingAssembly = Assembly.GetExecutingAssembly();
@wojciech-kulik
wojciech-kulik / CMemoryExecute.cs
Last active October 20, 2023 08:04
Run Win32 app from memory - http://wojciechkulik.pl
using System;
using System.Runtime.InteropServices;
/*
* Title: CMemoryExecute.cs
* Description: Runs an EXE in memory using native WinAPI. Very optimized and tiny.
*
* Developed by: affixiate
* Release date: December 10, 2010
* Released on: http://opensc.ws
@wojciech-kulik
wojciech-kulik / MemoryUtils.cs
Last active November 4, 2015 20:42
Run .NET application from memory - http://wojciechkulik.pl
using System.Reflection;
using System.Threading;
namespace MemoryAppLoader
{
public static class MemoryUtils
{
public static Thread RunFromMemory(byte[] bytes)
{
var thread = new Thread(new ThreadStart(() =>