Skip to content

Instantly share code, notes, and snippets.

View GregaMohorko's full-sized avatar

Gregor Mohorko GregaMohorko

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
namespace GM.Security.Cryptography
{
public class SimpleRectangleCipher
{
private const string ALPHABET = "ABCDEFGHIJKLMNOPRSTUVZ";
private const char SPACE_REPLACEMENT = 'Q';
@GregaMohorko
GregaMohorko / QuickSort.cpp
Created August 5, 2017 09:12
An implementation of Quick Sort algorithm with median.
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <math.h>
using namespace std;
int divide(int* a, int bottom, int top);
void switchAt(int* a, int bottom, int top);
@GregaMohorko
GregaMohorko / BinarySearchTree.cpp
Created August 3, 2017 18:04
An implementation of Binary Search Tree data structure.
#include <sstream>
#include <iostream>
#include <ctime>
using namespace std;
struct element
{
element* next;
};
@GregaMohorko
GregaMohorko / DoublyLinkedList.cpp
Created July 30, 2017 20:57
An implementation of Doubly Linked List data structure.
#include <sstream>
#include <cstdlib>
#include <iostream>
using namespace std;
// Represents an element of the doubly linked list.
struct element
{
// The key of the element.
@GregaMohorko
GregaMohorko / StackAndQueue.cpp
Last active July 30, 2017 20:59
A static implementation of Stack & Circular Queue data structures.
// Stack is LIFO (Last In First Out)
// Circular Queue is FIFO (First In First Out)
#include <iostream>
#include <sstream>
using namespace std;
#define LENGTH_MAX 10
@GregaMohorko
GregaMohorko / KneserNey.cs
Created May 8, 2017 08:41
Implementation of Kneser-Ney language model used for smoothing.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GM.NLP.Smoothing
{
/// <summary>
/// Implementation of Kneser-Ney language model.
///
@GregaMohorko
GregaMohorko / Equalizer.cs
Last active April 25, 2017 22:50
Audio Equalizer as WaveStream and with real-time band-changing.
using System;
using System.ComponentModel;
using System.Linq;
using GalaSoft.MvvmLight;
using NAudio.Dsp;
using NAudio.Wave;
namespace GM.SP.Audio
{
public class EqualizerBand : ObservableObject
@GregaMohorko
GregaMohorko / TelephoneKeypadDecoder.cs
Last active April 17, 2017 13:09
Realtime telephone keypad decoder.
using System;
using System.Threading.Tasks;
namespace GM.SP
{
/// <summary>
/// https://en.wikipedia.org/wiki/Telephone_keypad
/// </summary>
public class TelephoneKeypadDecoder : IDisposable
{
@GregaMohorko
GregaMohorko / DTMFDecoder.cs
Last active April 15, 2017 13:46
Realtime dual-tone multi-frequency signaling (DTMF) decoder.
using System;
using System.Collections.Generic;
using System.Linq;
using NAudio.Wave;
using Frequency = GM.SP.Audio.SignalAnalysis.Frequency;
namespace GM.SP.Audio
{
/// <summary>
/// https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling
@GregaMohorko
GregaMohorko / SignalAnalysis.cs
Last active April 13, 2017 16:35
Audio signal analysis to get information about frequencies.
using System;
using NAudio.Dsp;
using NAudio.Wave;
using NAudio.Wave.SampleProviders;
namespace GM.SP.Audio
{
public static class SignalAnalysis
{
public class Frequency