Skip to content

Instantly share code, notes, and snippets.

View wilfreddesert's full-sized avatar

wilfreddesert

View GitHub Profile
@wilfreddesert
wilfreddesert / Calculator.cs
Created May 20, 2018 12:50
A simple calculator.
using System;
namespace CalculatorDelegate
{
class Program
{
private static double Item1 { get; set; }
private static double Item2 { get; set; }
private static string Action { get; set; }
def Push_Relabel(graph,s,t):
if s < 0 or t < 0 or s > len(graph) - 1 or t > len(graph) - 1:
return "Error input"
if len(graph) == 0:
return "No graph to process"
n = len(graph)
h = [0] * n
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#define M_PI 3.14159265358979323846
int max (int a, int b) {
return a>=b?a:b;
}
@wilfreddesert
wilfreddesert / iron_ocr_comp.cs
Last active November 28, 2019 06:54
Iron OCR
using System;
using IronOcr;
namespace Iron_OCR_Test
{
class Program
{
private const string filepath = @"C:\Users\Wilfred Desert\Documents\OCR_Comparison\input\300_";
private const string KEY = "IRONOCR-874700B964-135488-37C336-398EAFCF0B-F560892-UEx2102E38B2BA87D8-COMMUNITY.TRIAL.EXPIRES.27.DEC.2019";
using System;
using IronOcr;
namespace Iron_OCR_Test
{
class Program
{
private const string filepath = @"C:\Users\Wilfred Desert\Documents\OCR_Comparison\input\";
private const string KEY = "IRONOCR-874700B964-135488-37C336-398EAFCF0B-F560892-UEx2102E38B2BA87D8-COMMUNITY.TRIAL.EXPIRES.27.DEC.2019";
@wilfreddesert
wilfreddesert / poisson.py
Last active December 11, 2019 06:23
Poisson sample
import numpy as np
from scipy.sparse import linalg as linalg
from scipy.sparse import lil_matrix as lil_matrix
OMEGA = 0
DEL_OMEGA = 1
OUTSIDE = 2
def point_location(index, mask):
if in_omega(index,mask) == False:
@wilfreddesert
wilfreddesert / polygon_extension_final.cpp
Created January 24, 2020 10:50
polygon_extension_final
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
import unittest
from math import sqrt
from vector import Vector
class TestVector(unittest.TestCase):
def test_repr(self):
v = Vector([1, 2, 3])
self.assertEqual(str(v), "Vector([1, 2, 3])")
from lru_cache import LRUCache
from pytest import raises
def test_init():
lru = LRUCache(4)
assert lru.maxsize == 4
assert lru.cache == {}
import pytest
import random
@pytest.fixture
def make_rnd_gen():
def _get_result(seed, mode):
# Hint: use pytest.fixture
if mode == 0:
return random.Random(seed).randint(-1000, 1000)