Skip to content

Instantly share code, notes, and snippets.

@bschwind
bschwind / TCPClientExample.cs
Created April 14, 2012 01:40
TCP Client Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GraphicsToolkit.Networking;
namespace TestClient
{
public class Program
{
@bschwind
bschwind / TCPServerExample.cs
Created April 14, 2012 01:42
TCP Server Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GraphicsToolkit.Networking;
namespace TestServer
{
public class Program
{
@bschwind
bschwind / Client.cs
Created April 14, 2012 01:43
Implements a simple TCP client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace GraphicsToolkit.Networking
{
@bschwind
bschwind / Server.cs
Created April 14, 2012 01:44
Implements a simple TCP server with one thread per client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Collections.Concurrent;
namespace GraphicsToolkit.Networking
@bschwind
bschwind / NetworkBuffer.cs
Created April 14, 2012 01:46
Network Buffer for organizing network stream data
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GraphicsToolkit.Networking
{
/// <summary>
/// This class helps organize the data required for
/// reading and writing to a network stream
find . -name *.png -o -name *.jpg -exec cp {} . \;
@bschwind
bschwind / gist:8495883
Created January 18, 2014 20:32
Building a stroke tree for a particular character
package com.skritter.utils;
import com.skritter.models.Param;
import com.skritter.models.Stroke;
import com.skritter.models.StrokeData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
"use strict";
var BUCKET_NAME = process.env.BUCKET;
var crypto = require("crypto");
var jwt = require("jsonwebtoken");
var logger = require("services/logger").getLogger("general");
var mime = require("mime-types");
var moment = require("moment");
var uuid = require("node-uuid");
readFile("filename.txt", function(err, data) {
console.log("5 seconds have elapsed");
if (err) { return; }
readFile("otherfile.txt", function(err, data) {
console.log("10 seconds have elapsed");
if (err) { return; }
writeFileToNetwork(data, function(err, response) {
if (err) { return; }
console.log("complete");
gfdagadf