Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
//global constants
const char X = 'X';
const char O = 'O';
@KorbenC
KorbenC / Matrix.cpp
Last active December 19, 2015 06:29
#include <iostream>
#include <windows.h>
int Modulus(int iN, int iMod) {
int iQ = (iN/iMod);
return iN - (iQ*iMod);
}
char GetChar(int iGenerator, char cBase, int iRange) {
return (cBase + Modulus(iGenerator, iRange));
#include <stdio.h>
#include <windows.h>
#define MAX_ARRAY_SIZE 7
#define BAD_NUMERAL -1
void ConvertRToD();
int GetVal( char Letter, char RomanNum[], int DecNum[] );
int main ( ) {
@KorbenC
KorbenC / progress_bar.py
Last active December 20, 2015 20:39
Progress bar class implemented in Python.
from __future__ import with_statement
import threading
import sys
# Implementation of Ticker class
class Ticker(threading.Thread):
def __init__(self, msg):
threading.Thread.__init__(self)
self.msg = msg
@KorbenC
KorbenC / reversebinary.py
Created September 12, 2013 06:01
Spotify Reversed Binary Numbers Puzzle Task Your task will be to write a program for reversing numbers in binary. For instance, the binary representation of 13 is 1101, and reversing it gives 1011, which corresponds to number 11. Input The input contains a single line with an integer N, 1 ≤ N ≤ 1000000000. Output Output one line with one integer…
#!/usr/bin/env python
from __future__ import with_statement
import threading
import time
import sys
# Implementation of Ticker class
@KorbenC
KorbenC / bench.py
Created September 28, 2013 13:30 — forked from eoconnell/bench.py
#!/usr/bin/python
from time import time
mark = 0
def tic():
global mark
mark = time()
@KorbenC
KorbenC / FizzBuzz.py
Created September 29, 2013 08:50
Classic FizzBuzz test
#!/usr/bin/env python
def fizzbuzz():
for x in xrange(1, 100):
if x % 5 == 0 and x % 3 == 0:
print "FizzBuzz"
elif x % 3 == 0:
print "Fizz"
elif x % 5 == 0:
print "Buzz"
@KorbenC
KorbenC / TestConnection.py
Created September 29, 2013 10:44
Test a connection
#!/usr/bin/env python
import socket
import time
HOST=""
PORT=""
TIMEOUT=1.0
while True:
@KorbenC
KorbenC / algorithms.py
Created October 3, 2013 20:55
Implementations of a few sorting algorithms and there worst case performance written in python.
#!/usr/bin/env python
import random
#Merge Sort Worst Case: O(n*Log(n))
def merge(left, right):
result = []
i ,j = 0, 0
while i < len(left) and j < len(right):
if left[i] <= right[j]:
result.append(left[i])
@KorbenC
KorbenC / sfdcidconverter.py
Created November 7, 2013 15:40
Salesforce.com ID Converter allows you to convert 15 digit, case-sensitive IDs to an 18 digit, case-safe version for use with Salesforce.com records.
#!/usr/var/env python
import sys
def convert_To_18(id):
#check valid input
if id is None:
return id
if len(id) < 15:
print "not a valid 15 digit ID"
return