Skip to content

Instantly share code, notes, and snippets.

View gogsbread's full-sized avatar

Antony Thomas gogsbread

  • facebook
  • San Francisco Bay area,CA
View GitHub Profile
@gogsbread
gogsbread / gradeschool_tables.py
Created January 4, 2013 03:38
Funny algorithms - Printing grade school tables
def mulTables(n):
for i in range(1,n+1):
for j in range(1,n + 1):
print i * j,
print
if __name__ == '__main__':
mulTables(12)
@gogsbread
gogsbread / AnonymousPipes.cs
Created January 2, 2013 23:36
Anonymous pipes server and client examples.
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
namespace dotNetPlayGround
{
class AnonymousPipesServer
{
static void Main()
@gogsbread
gogsbread / AsyncWriter.cs
Created January 2, 2013 23:34
Basic Asynchronous writer example.
using System;
using System.IO;
using System.Threading;
namespace dotNetPlayGround
{
class AsyncState
{
public string name;
public Stream stream = null;
@gogsbread
gogsbread / Graph_MST.cs
Created January 2, 2013 23:32
Basic Graph ADTs. MST Algorithms using Kruskal and Prim
//design questions:
// why is node<t> not derived from graphNode<t> . during implementaion you find that Node<t> and graphNode<t>
// are siblings rather than parent-child.
namespace dotNetPlayGround
{
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Text;
@gogsbread
gogsbread / MEFCalculator.cs
Created January 2, 2013 23:31
Simple MEF based calculator. MEF hacks
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
namespace dotNetPlayGround
{
public interface ICalculator
{
@gogsbread
gogsbread / Permutations.cs
Created January 2, 2013 23:29
Calculater permutations of a string
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace dotNetPlayGround
{
class Permutations
{
private static int[] permutationValue = new int[0];
@gogsbread
gogsbread / Sockets.cs
Created January 2, 2013 23:26
Creating sockets to raise a HTTP request.
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace dotNetPlayGround
{
class Sockets
{
@gogsbread
gogsbread / StopWatch.cs
Created January 2, 2013 23:25
Basic StopWatch
using System;
using System.Threading;
using System.Collections.Generic;
using Diag = System.Diagnostics;
namespace dotNetPlayGround
{
class StopWatch
{
public static void Main()
@gogsbread
gogsbread / BasicThreads.cs
Created January 2, 2013 23:24
Basic Thread play
using System;
using System.Threading;
namespace dotNetPlayGround
{
class Threads
{
static void Main()
{
Console.WriteLine("I am executing in thread {0}",Thread.CurrentThread.ManagedThreadId);
Thread fg = new Thread(new ParameterizedThreadStart(Method1));
@gogsbread
gogsbread / TypeDescriptor.cs
Created January 2, 2013 23:23
Basic TypeDescriptor example
using System;
using System.ComponentModel;
namespace dotNetPlayGround
{
public enum DataType : int
{
None = 0,
[Description("A")]
Alpha = 1,