Skip to content

Instantly share code, notes, and snippets.

@georgepowell
georgepowell / fib.java
Created February 27, 2017 14:05
Timing the 2^n approach
import java.util.*;
public class Main {
public static void main(String[] args) {
for (int n = 0; n < 1000; n++) {
long startTime = System.nanoTime();
fib(n);
long endTime = System.nanoTime();
double duration = (endTime - startTime) / 1000000000.0;
@georgepowell
georgepowell / Program.cs
Last active January 8, 2022 11:45
Roman Numerals converter in C#. Run as a console application from Visual Studio. The 'Romanise' function is where the magic happens.
using System;
namespace RomanNumerals
{
class Program
{
// Create rules in descending order
static Rule[] Rules = new Rule[]
{
new Rule(1000, "M"),
@georgepowell
georgepowell / Program.cs
Created September 26, 2014 14:55
CryptSharp BCrypt sample with secure salt generation and variable difficulty
using System;
using System.Text;
using CryptSharp;
using CryptSharp.Utility;
using System.Security.Cryptography;
using System.Diagnostics;
namespace PasswordHashingTest
{
class Program